Computers, Science, Technology, Xen Virtualization, Hosting, Photography, The Internet, Geekdom And More

A slightly better Xen console

Posted on | October 15, 2008 | 2 Comments

I love the ability to console in to a paravirtualized domain, especially when making changes to firewall rules. What I do not like is what the redirect does to the terminal when using stuff that heavily depends on ncurses, like ‘top’ or the midnight commander.

If your not familiar with minicom, its a simple ‘telex style’ terminal emulator. Most people use it when communicating over a null modem cable, or for direct AT command access to a modem. You might use it if you access your router’s serial console from a Linux box.

Using xenstore-ls and minicom, you can get a slightly better console into a paravirtualized guest. The steps are really simple:

1 – Make sure you have minicom. A simple apt-get install minicom (or yum install minicom) should suffice. As far as I know, every distribution under the sun packages it.

2 – Obtain the psuedo terminal of the guest. For this you will need to find out the guest’s domain ID and then use xenstore-ls to discover which terminal you need to use. An example is this:

# xm list

Name ID Mem VCPUs State Time(s) Domain-0 0 802 2 r----- 773.3 Mini1 1 32 1 -b---- 0.2 Mini2 2 32 1 -b---- 0.2

# xenstore-ls /local/domain/1/console | grep ^tty tty = "/dev/pts/3"

Now we know that we need /dev/pts/3 to get a console to domid 1.

So we fire up minicom with a few special switches, telling it to skip initializing of the device and that we’re connecting to a psuedo terminal.

minicom --noinit --ptty=/dev/pts/3

Now your in console :) Tap enter once or twice to see it come to life. Once in, hit CTRL-A, release, then press Z .. you’ll see a menu of stuff you can configure. Minicom also supports startup configuration files, so you can set your common preferences there.

Don’t expect the world, you’re still looking at a dumb terminal .. however curses/dialog based things will behave much better and your screen won’t kludge up as often.

If you want something much lighter than minicom, try Ivan’s one shot simple tiny serial terminal. Using that you would just issue the following:

./com /dev/pts/3 115200

Hopefully you found this tip to be of use :)


2 Responses to “A slightly better Xen console”

  1. Buzer
    April 7th, 2009 @ 5:30 pm

    Thanks for the hint. I made a small script based on that idea (licensed under WTFPL2):

    nanoha:~# cat /usr/sbin/xen-console


    if [ -z "$1" ]; then echo “You need to specify the domain” exit; fi CONCMD=’minicom –noinit –ptty={}’ DOMID=xm list | grep "^$1 " | awk '{ print $2; }' if [ -z "$DOMID" ]; then echo “Domain doesn’t exists” exit; fi DOMCONSOLE=xenstore-ls /local/domain/$DOMID/console | grep tty | sed 's/tty = "\(.*\)"/\1/' $(echo $DOMCONSOLE | xargs -I ‘{}’ echo $CONCMD)

    There’s probably an easier way as well, but oh well.

  2. tinkertim
    April 7th, 2009 @ 5:55 pm


    I started working on a hand rolled terminal client that was ‘xen aware’ , but its not much better than the current console. What I’ll probably do is publish patches to minicom to let it access the store and get the real PTY on dom-0 needed to get to the guest’s console. So it would be:

    minicom –xendom (domname or domid)

    I doubt they’d ever get included, since Xen is such a corner case .. but its not like minicom moves much and the patch would be easy to maintain.

Leave a Reply

  • Monkey Plus Typewriter
  • Stack Overflow

  • Me According To Ohloh

  • Meta