Showing posts with label serial console. Show all posts
Showing posts with label serial console. Show all posts

Wednesday, October 29, 2008

Can't access serial devices in Dom0. How to fix it?

A lot of xen users report that when they access a serial device while running xen kernel, they get "Cannot get serial info: Invalid argument", but while running the generic kernel (non-xen kernel), they have no problem to access the serial device. Eg,

[root@xen ~]# setserial /dev/ttyS0
Cannot get serial info: Invalid argument

To solve this, kernel output need to be redirected to xen console by adding "console=xvc console=tty0 xencons=xvc" to "module /vmlinuz" line in grub.conf as below.

module /vmlinuz-2.6.18-92.1.13.el5xen ro root=/dev/VolGroup00/LogVol00 rhgb quiet console=xvc console=tty0 xencons=xvc

Reboot the host and everything would work fine after that.

[root@xen ~]# setserial /dev/ttyS0
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 7

I can't access the PV guest serial console via "xm console" or "virsh console" in RHEL5 xen. How can I fix it?

This would work out of the box in most cases, but in certain scenarios it may not work as expected. If someone hits such a situation, please make sure below things are done correctly.

1 - Edit /boot/grub/grub.conf of the guest and add "console=tty0 console=xvc0" to the kernel line, if you wanted the boot messages to appear on the serial console.

Eg, RHEL4 PV guest grub.conf would look like as below.

title Red Hat Enterprise Linux ES (2.6.9-78.ELxenU)
root (hd0,0)
kernel /boot/vmlinuz-2.6.9-78.ELxenU ro root=LABEL=/ console=tty0 console=xvc0
initrd /boot/initrd-2.6.9-78.ELxenU.img

2 - Add the below line to /etc/inittab under "Run gettys in standard run levels" if a login prompt is needed on serial console after system is booted.

co:2345:respawn:/sbin/agetty xvc0 9600 vt100-nav

3 - Add "xvc0" to /etc/securetty if root to log in need to be allowed from this console.

Make sure that the guest is rebooted after checking the abov three points.