Xen console grabbded /dev/ttyS0

Posted by: admin  :  Category: Virtualization, Xen

This week I started on evaluating an iSCSI storage system which should get connected to a Xen-enabled host. An article covering this particular topic is in preparation.

Since the iSCSI device offered management capabilities over serial console I though to attach it to COM1 (/dev/ttyS0) of my host system.
This is well the point when I noticed that Xen had already grabbed /dev/ttyS0. Since my host system offered only one serial port and I didn’t have a spare serial server at hands I needed to change this behaviour to get it working.

By means of ‘dmesg’ it can be easily verified if Xen grabbed the serial port:

# dmesg|grep ttyS0
Xen virtual console successfully installed as ttyS0

Then make sure you know which kernel version you’re running:

# uname -r
Linux gic-ftp-lin-001.genotec.ch 2.6.18-8.el5xen #1 SMP Fri Jan 26 14:29:35 EST 2007 x86_64 x86_64 x86_64 GNU/Linux

Look for the corresponding kernel section in your grub.conf (or whatever boot loader you use).

title Red Hat Enterprise Linux Server (2.6.18-8.el5xen)
        root (hd0,0)
        kernel /boot/xen.gz-2.6.18-8.el5
        module /boot/vmlinuz-2.6.18-8.el5xen ro root=LABEL=/
        module /boot/initrd-2.6.18-8.el5xen.img

Then add the ‘xencons’ option to the module line stating the kernel arguments.

title Red Hat Enterprise Linux Server (2.6.18-8.el5xen)
        root (hd0,0)
        kernel /boot/xen.gz-2.6.18-8.el5
        module /boot/vmlinuz-2.6.18-8.el5xen ro root=LABEL=/ xencons=tty6
        module /boot/initrd-2.6.18-8.el5xen.img

In this case I added ‘xencons=tty6’ to have Xen grab /dev/tty6 for it’s console.

Other possibilities are:

xencons=off   disable console at all
xencons=ttyX   attach console to /dev/ttyX
xencons=ttySX   attach console to /dev/ttySX
xencons=xvcX   attach console to /dev/xvcX

After changing this line and rebooting the system I could finally connect my iSCSI’s serial terminal.

5 Responses to “Xen console grabbded /dev/ttyS0”

  1. Tim Says:

    Thanks much. I’ve spent a week on and off looking around, looking for a good simple fix.

  2. Arun Says:

    hello,
    when I run command:::::::::::::::::dmesg |grep tty
    Xen virtual console successfully installed as ttyS0

    I am not getting whats actually going on with my serial ports…..
    I am writing code which is fully dependent on setial communication….due to this I am not able to use my serial port.
    1.)So any method to come out of this problem…….
    2.)Moreover can you guide me in details what is this virtual console….and why it is not allowing me to use my serial port…..
    3.)Steps to follow while doing serial programming.
    4.) Any commands which can verify that my serial port is recieving data or sending data or any tool to do such …..

    thanks & regards,
    Arun

  3. Gianpaolo Del Matto Says:

    @arun

    1. my article says exactly how to disable the xen virtual console
    2. for information about Xen virtual machine monitor please read the fine manual at http://www.cl.cam.ac.uk/research/srg/netos/xen/

    You will have to figure 3. and 4. on your own, I have no experience in serial port programming at all.

    Greeetings
    Gianpaolo

  4. corsair8575 Says:

    well after much bashing brains i figured it out to get console
    working enabling bios redirect -> kernel messages -> booted login console.

    disable in grub.conf or bios redirection will cause grub to hang!
    Let bios do the redirection not grub!!!!
    #serial –unit=0 –speed=9600
    #terminal –timeout=0 serial console

    set options as so for kernel
    kernel /boot/xen.gz-2.6.18-92.1.6.el5 com1=9600 console=com1
    module /boot/vmlinuz-2.6.18-92.1.6.el5xen ro root=LABEL=/ xencons=xvc console=xvc
    module /boot/initrd-2.6.18-92.1.6.el5xen.img

    then in your /etc/inittab add entry
    by the runlevels:
    SC:12345:respawn:/sbin/mingetty xvc0
    1:2345:respawn:/sbin/mingetty tty1

    There you go finally the xen ttys0 nuisance is consolable!

  5. Kara Says:

    Thank you! Though this article has been around for awhile it took me a surprising amount of time to find it. I needed ttys0 for the new APC UPS that we installed, and couldn’t figure out how to connect it. I finally found an article from APC that with Xen installed, the APC may not work over a com port. Which eventually led me here. Thanks for documenting the fix.