Notes running Xen under Debian Lenny (dom0 and domU)

Tags:

These are possibly my worst written notes ever below. Beware!

Xen was remarkably easy to install on Lenny. I just installed the latest xen kernel
(2.6.26-2-xen-686) and xen-hypervisor-3.2-1-i386 xen-utils (3.0?), also these bridge-utils
iproute sysfsutils libc6-xen xen-tools

Made sure these were in /etc/xen/xend-config.sxp

(network-script network-bridge)<br>
(vif-script vif-bridge)<br>

/etc/xen-tools/xen-tools.conf was basically this:

dir = /opt/xen #mkdir'd this first
install-method = debootstrap
size = 4Gb # Disk image size.
memory = 128Mb # Memory size
swap = 128Mb # Swap size
# noswap = 1 # Don't use swap at all for the new system.
fs = ext3 # use the EXT3 filesystem for the disk image.
dist = lenny # Default distribution to install.
image = sparse # Specify sparse vs. full disk images.
gateway = 192.168.1.254
netmask = 255.255.255.0
broadcast = 192.168.1.255
passwd = 1
mirror = <a href="http://ftp.us.debian.org/debian/">http://ftp.us.debian.org/debian/
[/geshifilter-code]

After creating the DomU and firing it up, couldn't get a login prompt at the console, and ssh'ing in gave this error when logging in:

stdin is not a tty

From the docs:

"Additional note for domU on lenny using xen-tools
xen-tools don't use hvc0 as the console device in /etc/inittab and don't install udev (leading to /dev/pts missing in domU).
This makes logging in via xm console and via ssh impossible, because getty doesn't have a proper console to attach to and ssh can't attach to a pseudo terminal.
To fix this,
1. add to /etc/xen-tools/xen-tools.cfg:

serial_device = hvc0"

So added that line to /etc/xen-tools/xen-tools.cfg as required.

Also made these changes to /boot/grub/menu.lst on the Dom0 first:

title Xen 3.2-1-i386 / Debian
GNU/Linux, kernel 2.6.26-2-xen-686
root (hd0,0)
kernel /boot/xen-3.2-1-i386.gz
com1=9600,8n1 console=com1,vga
module /boot/vmlinuz-2.6.26-2-xen-686
root=/dev/sda1 ro console=tty0 console=hvc0
module /boot/initrd.img-2.6.26-2-xen-686

Changes being the console and com1 lines.

From the same notes above: reason is 'To get output from grub, XEN, the kernel and getty (login prompt) via both vga and serial console to work'.

Also modified /etc/inittab so it included this

1:2345:respawn:/sbin/getty 38400 hvc0<br>
2:23:respawn:/sbin/getty 38400 tty1<br>

From the same notes above, 'The tty1 will show up at the vga output, and the hvc0 will show up at the serial console.'

Then after a reboot of the Dom0, I could create new DomU like this:

xen-create-image --hostname=HOSTNAME --ip=IP --passwd --role udev<br>

and it would actually install udev properly, no having to fiddle with /etc/fstab with devpts like mentioned here, or having to install udev while mounting the image locally and chrooted etc etc etc. With the grub, inittab and xen-tools changes above, along with the '--role udev' when creating new images, it 'just works' (tm) both via console and ssh.

Other thing I did was quickly install openntpd on the DomU as this removed the 'clock went backwards' errors flooding the logs/console.

(edit : apparently this is how to deal with those 'clock backwards' errors)

Short story: I'm liking Xen a lot! And not just because Dom0 reminds me of this guy