Xen on Ubuntu Gutsy

Xen is awesome, and so is Ubuntu, but there are some bugs in the ubuntu xen packages. However, these have easy fixes and you can be up and running on xen in a matter of minutes.

This is a quick walkthrough of getting it working with gutsy as Dom0 ( host ) and gutsy as the DomUs ( virtual machines ), however it’s not a complete how-to. If you are unsure about an aspect ( e.g. LVM or loopback) google it.

Load up a computer with ubuntu gutsy server. If you have hyper-threading on your CPU, make sure it is disabled in the BIOS.

apt-get install ubuntu-xen-server libc6-xenThis will install all packages needed to run xen. Then reboot to make sure the xen kernel works on your hardware.

Edit /etc/xen/xend-config.sxp and comment out
(network-script network-dummy)
then uncomment
(vif-script vif-bridge)

That will get your network bridge going after you restart xend with /etc/init.d/xend restart

Now for xen-tools. Xen tools are a set of scripts that can create virtual images by debootstraping debian/ubuntu.
Edit /etc/xen-tools/xen-tools.conf and fill in your settings – select gutsy for your distro. The main one is LVM or loopback images for the virtual disks. I use LVM and it’s great, but there is a learning curve, if you’re just testing loopback images will be easier.

ubuntu-xen Bug #1 : The console doesn’t work.
Fix: add
extra = ' TERM=xterm xencons=tty console=tty1'
to the end of /etc/xen-tools/xm.tmpl

ubuntu-xen Bug #2 : The xen instance hangs on boot, caused by the virtual machine trying to set the hardware clock.
Fix: edit /usr/lib/xen-tools/gutsy.d/15-disable-hwclock
underneath the line
chroot ${prefix} /usr/sbin/update-rc.d -f hwclock.sh remove
add
chroot ${prefix} /usr/sbin/update-rc.d -f hwclockfirst.sh remove
rm -f ${prefix}/etc/init.d/hwclock.sh ${prefix}/etc/init.d/hwclockfirst.sh ${prefix}/etc/udev/rules.d/85-hwclock.rules

ubuntu-xen Bug #3 : DomU networking fails to work after a reboot. ( This bug doesn’t always happen, it may only happen when you have multiple ethernet cards )
Fix : Always give a mac address when creating a virtual machine. Xen has it’s own mac address prefix assigned, so make mac addresses start with 00:16:3E e.g. 00:16:3E:11:12:22

Now you can create your virtual machines :
xen-create-image --ip=10.1.1.5 --hostname=myvm --mac=00:16:3E:11:12:22

and once it’s made, you can start it with xm create /etc/xen/myvm.cfg and access it’s console with xm console myvm

Hope this helps.

Tags: , , , , , , , , , , , ,

Leave a comment