Running Xen on Ubuntu Intrepid and Jaunty

Written by NickWal

Step by Step guide to using Xen with Ubuntu Intrepid and Juanty - How to Set Up Xen Dom0 on Jaunty Jakalope 9.04

Introduction

Distribution: Ubuntu 9.04 (Jaunty Jackalope) 9.04 - Should also work with Ubuntu 8.10 (Intrepid Ibex)

This is tried and tested on a 32bit machine. I cannot use KVM with this machine as virtualization extensions are not supported. While this machine was built before Intel or AMD had introduced their virtualizaion extensions, I notice that even very new machines (such as laptops, netbooks and so on) are being sold with CPUs that don’t have these extensions. For this reason alone KVM cannot be the only virtualization solution available on linux. For me, as I already have quite a bit of experience with Xen, Xen continues to be the best option.

Installing a Kernel Dom0 that works

To get started you will need a Debian Dom0 Kernel. There kernel I used is this one: linux-image-2.6.26-2-xen-686_2.6.26-15_i386.deb

Download from here:

Kernel: http://packages.debian.org/lenny/i386/linux-image-2.6.26-2-xen-686/download

Modules: http://packages.debian.org/lenny/i386/linux-modules-2.6.26-2-xen-686/download

Then install using

sudo dpkg -i linux-image-2.6.26-2-xen-686_2.6.26-15lenny2_i386.deb linux-modules-2.6.26-2-xen-686_2.6.26-15lenny2_i386.deb

Install Xen Hypervisor and tools

Obviously, in order to get Xen installed, I installed the latest versions of Xen available in the Xen repository, like as follows:

From the menus choose to System -> Administration -> Software Sources you will see several check boxes.

  • Canonical-supported Open Source software (main)
  • Community-maintained Open Source software (universe)
  • Proprietary drivers for devices (restricted)
  • Software restricted by copyright or legal issues (multiverse)

you should checked all these 4 boxes then click ‘Close’. You should see a box that says “The information about available software is out of date”. Click on the reload button. When these boxes have gone you should be able to use:

sudo apt-get install python2.5 ubuntu-xen-desktop

Configuring the bootloader

I use grub as my bootloader, so the entry in menu.lst to load and run Xen looks like this:

    title        Xen 3.3 / Ubuntu 9.04, kernel 2.6.26-2-xen-686  
    uuid        bd2c08f6-e705-4c85-8fdb-aa884ca8a0b7  
    kernel        /xen-3.3.gz  
    module        /vmlinuz-2.6.26-2-xen-686 root=UUID=c397979f-01e0-4180-83eb-8c9324fced1e ro console=tty0  
    module        /initrd.img-2.6.26-2-xen-686  
    quiet

If you are lucky, when you install the kernel and modules using dpkg -i, the utility grub-update should automatically create the right menu entry. root= should be pointing to the correct file system.

Getting Dom0 networking running

The key to getting the network running is removing the Ubuntu network manager

sudo apt-get remove network-manager

then update the file /etc/network/interfaces to look like this:

auto lo  
iface lo inet loopback  

auto eth0  
iface eth0 inet dhcp

This should work fine for most people who have DHCP server running which is common in both a corporate environment and an environment where you have an ADSL router running.

Configuring and Installing DomU clients

Creating New DomU Clients

If you would like to run Jaunty DomU clients on your Ubuntu Dom0 machine, I have written another article on how to create DomU images using the Xen tool xen-create-image. This tool provides a largely automated way of creating the disk images and the configuration files required to run Jaunty DomU images. You can read the article here: https://www.infohit.net/blog/post/installing-and-running-xen-domu-jaunty-on-dom0-ubuntu-juanty/

Installing Existing DomU images

You can use the Debian kernel installed in the earlier stage as a DomU kernel too, so this means you can create a configuration file something like this:

kernel      = '/boot/vmlinuz-2.6.26-2-xen-686'  
ramdisk     = '/boot/initrd.img-2.6.26-2-xen-686'  
memory = 1024  
name = "ubuntu"  
vif = [ 'bridge=xenbr0' ]  
dhcp = "dhcp"  
disk = ['file:/workarea/xen/images/ubuntu.img,xvda1,w',  
        'file:/workarea/xen/images/swapubuntu.img,xvda2,w']  
root = "/dev/xvda1 ro"

You should note that the virtual console of this kernel is found on /dev/hvc0 therefore if you want to be able to use the xen console (xm create -c domain or xm console domain) you must run a getty on /dev/hvc0 either by updating /etc/inittab or placing an entry in /etc/event.d/

References