Redirecting Linux console messages to another machine

From WBITT's Cooker!

(Difference between revisions)
Jump to: navigation, search
m
m
Line 61: Line 61:
</pre>
</pre>
-
Well, now we need to reboot our guest machine and check whether it is accessible using the follwoing command.
+
Well, now we need to reboot our guest machine and check whether it is accessible using the following command.
<pre>
<pre>
#Virsh console Node1
#Virsh console Node1
</pre>
</pre>

Revision as of 10:42, 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)

Perform the following mentioned steps on your guest machine.

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 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

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