Redirecting Linux console messages to another machine

From WBITT's Cooker!

(Difference between revisions)
Jump to: navigation, search
m
m
Line 5: Line 5:
*Created one virtual machine (Linux OS)
*Created one virtual machine (Linux OS)
   
   
-
Here are the steps used in our lab to accomplish this task.
+
Here are the steps we used in our lab to accomplish this task.
Before we begin, it is important to know that your Serial Ports (COM1 and COM2) are named as /dev/ttyS0 and /dev/ttyS1 respectively and so on.
Before we begin, it is important to know that your Serial Ports (COM1 and COM2) are named as /dev/ttyS0 and /dev/ttyS1 respectively and so on.

Revision as of 10:52, 26 March 2011

Here I am going to present how to redirect console messages from virtual machine to physical (base) machine. We used, in our lab, one physical machine running Linux OS and created one virtual machine in it.

Requirement:

  • One physical machine running Linux OS
  • Created one virtual machine (Linux OS)

Here are the steps we used in our lab to accomplish this task.

Before we begin, it is important to know that your Serial Ports (COM1 and COM2) are named as /dev/ttyS0 and /dev/ttyS1 respectively and so on.

Check if Linux detects your serial port or not.

One way you could do is to give the following command:

#dmesg |grep ttyS

You should see something like this:

Example:

serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550

The above output shows that your COM1 and COM2 ports are available and Linux recognizes them.

Another way to test is to give the following command:

# ls > /dev/ttyS0

If the command does not return any error message then your Serial Ports are recognized by your Linux system. In case, Linux does not detect your Serial Port, then try giving the following command:

#setserial /dev/ttyS0 autoconfig auto_irq

Well, above we just discussed only basics about how to find serial ports installed in our machine.

Here, our actual task starts. Make changes in the grub file of guest machine which was created in our lab.

Add the following line to grub.conf file of guest machine. Open the grub.conf file using VI editor and append below lines to it.

serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
terminal --timeout=10 serial console

And also in the grub.conf file, append the following parameters right after the kernel value as shown below.

#vi /etc/grub.conf
kernel /vmlinuz-2.4.9-21 ro root=/dev/hda6 console=tty0 console=ttyS0,115200
:wq
#

Create a copy of the inittab file and add the following line to it.

#cp /etc/inittab /etc/inittab.orig
#vi /etc/inittab
co:23:respawn:/sbin/agetty ttyS0 115200 linux
:wq
#init q

Well, now we need to reboot our guest machine and check whether it is accessible using the following command.

#Virsh console Node1
Personal tools