Home > Server Admin > Installing Xen on Ubuntu 9.10

Installing Xen on Ubuntu 9.10

January 16th, 2010

Recently I switched to Ubuntu as the primary operating system on my desktop machine. As part of the switch, I wanted to install Xen to virtualize some additional operating systems. Xen provides very good performance when virtualizing Linux distributions due to paravirtualization. The latest versions can also virtualize certain unmodified guest operating systems on processors that support virtualization.

In a Xen setup, the Xen hypervisor runs directly on the hardware (bare-metal). The first guest operating system (dom0) runs “on top” of Xen and has full access to the underlying hardware. Additional guests (domU) also run on top of the Xen hypervisor, but with limited access to the underlying hardware.

Converting an existing Ubuntu install to a Xen dom0 install requires installing the Xen hypervisor. In previous versions of Ubuntu this could easily be done using apt. Unfortunately no packages exist for Ubuntu 9.10 (Karmic Koala). In this post I’ll describe the steps I took to install Xen from source on Karmic. If you’d rather install via binary packages you’ll need to find a third-party repository.

Install Xen hypervisor and tools

# In order to compile Xen, you must first install some build dependencies:
$ sudo apt-get install bin86 bcc iasl uuid-dev libsdl-dev

$ cd /usr/src

# See http://www.xen.org/products/xen_source.html for latest downloads
$ wget http://bits.xensource.com/oss-xen/release/3.4.2/xen-3.4.2.tar.gz
$ tar -xzf xen-3.4.2.tar.gz

# I created this small patch to adapt Xen to Ubuntu’s layout
$ wget http://www.bltweb.net/patches/xen-3.4.2-ubuntu.patch
# or if you are using Xen 4.0:
$ wget http://www.bltweb.net/patches/xen-4.0.0-ubuntu.patch

$ cd xen-3.4.2
$ patch -p1 < ../xen-3.4.2-ubuntu.patch
$ make dist-xen dist-tools dist-stubdom
$ sudo make install-xen install-tools install-stubdom

Install Xen Kernel Sources

The stock Karmic kernel will not work when running as dom0 in Xen. You must install a new kernel. I chose to compile my own kernel. Compiling a kernel is not for the faint of heart, but isn’t as hard as you might think.

You have two main choices when it comes to a dom0 kernel. The Xen kernel or a dom0 pv-ops kernel. Normally I would recommend using a pv-ops kernel. The same pv-ops kernel can run on bare-metal or under the Xen hypervisor. The pv-ops kernel is going to be the default in future versions of Xen and will most likely be included in the mainline Linux kernel soon.

Unfortunately, the pv-ops kernel will not work with binary graphics drivers provided by Nvidia. Since I have an Nvidia graphics card (and want to use the binary drivers) I need to use the standard Xen kernel. The standard Xen kernel is still version 2.6.18, however luckily Andrew Lyon maintains forward ported patches for Gentoo that we can use on our Ubuntu install.

First things first, let’s get the kernel sources downloaded and patched:

$ cd /usr/src

# Download the vanilla kernel sources from http://www.kernel.org/
$ wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.31.8.tar.bz2
$ tar -xjf linux-2.6.31.8.tar.bz2
$ mv linux-2.6.31.8 linux-2.6.31.8-xen0-amd64

# Download the forward ported xen patches from http://code.google.com/p/gentoo-xen-kernel/downloads/list
$ wget http://gentoo-xen-kernel.googlecode.com/files/xen-patches-2.6.31-10.tar.bz2
$ mkdir xenpatches-v10_2.6.31.8
$ cd xenpatches-v10_2.6.31.8
$ tar -xjf ../xen-patches-2.6.31-10.tar.bz2
$ cd ../

# Apply the xen patches
$ cd linux-2.6.31.8-xen0-amd64
$ for i in `ls ../xenpatches-v10_2.6.31.8/`; do patch -p1 < ../xenpatches-v10_2.6.31.8/"$i"; done

At this point I like to modify the kernel’s “extra version” to clearly identify that this is a dom0 kernel. To do this, modify the Makefile using your favorite text editor and change the EXTRAVERSION line to look like:

VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 31
EXTRAVERSION = .8-xen0-amd64
NAME = Man-Eating Seals of Antiquity
...

Compile Xen Kernel

Configuring your kernel is left as an exercise for the reader. There is a ton of existing documentation on how to do this. The easiest way to get started is to copy the configuration from the stock Ubuntu kernel and run make menuconfig.

$ cp /boot/config-2.6-31-17-generic .config
$ make menuconfig

There are some options that you want to be sure you enable:

Processor type and features --->
  [*] Enable Xen compatible kernel
Networking support --->
  Networking options --->
    <*> 802.1d Ethernet Bridging
Device Drivers --->
  XEN --->
    [*] Privileged Guest (domain 0)
    <M> Backend driver support
    <M>   Block-device backend driver
    <M>   Block-device tap backend driver
    <M>   Block-device tap backend driver 2
    <M>   Network-device backend driver
    <M>   PCI-device backend driver
    <M>   SCSI backend driver
    <M>   USB backend driver
    <*> Block-device frontend driver
    <*> Network-device frontend driver
    <M> SCSI frontend driver
    <M> USB frontend driver
    <*> Framebuffer-device frontend driver
    <*>   Keyboard-device frontend driver
    [*] Disable serial port drivers
    <*> Export Xen attributes in sysfs
        Xen version compatibility (3.3.0 and later) --->
           3.3.0 and later

Now compile and install your kernel:

# To speed up the compile, set CONCURRENCY_LEVEL to one higher than the number of processor cores in your machine
$ export CONCURRENCY_LEVEL=5
$ make
$ sudo make install
$ sudo make modules_install

# Make an initramfs
$ sudo mkinitramfs -o /boot/initrd.img-2.6.31.8-xen0-amd64 2.6.31.8-xen0-amd64

If you compiled the Xen net, block and usb backend drivers as modules, you will probably want to load them by default by adding them to your /etc/modules file:

# /etc/modules
...
# These modules are required for Xen DomUs to work
netbk
blkbk
usbbk

Update Grub

Most existing Xen documentation on the web refers to the first version of Grub. Ubuntu 9.10 ships with Grub 2. Grub 2 works great with Xen, unless you use fakeraid. If you use fakeraid, I would suggest downgrading to Grub 1.

Ubuntu’s update-grub command won’t recognize your new Xen kernel, but you can easily modify the /etc/grub.d/40_custom script to manually insert it into your Grub configuration. Here’s what my 40_custom file looks like:

#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

menuentry "Ubuntu, Xen 3.4.2 dom0 2.6.31.8-xen0-amd64" {
   set quiet=1
   insmod raid
   insmod mdraid
   insmod ext2
   set root=(md1)
   search --no-floppy --fs-uuid --set 31d4873b-fed1-49d9-b37d-89d9f7a46566
   multiboot (md1)/xen-3.4.2.gz vga=gfx-1440x900x32 quiet
   module (md1)/vmlinuz-2.6.31.8-xen0-amd64 root=/dev/mapper/vg0-root root=/dev/mapper/vg0-root ro quiet splash
   module (md1)/initrd.img-2.6.31.8-xen0-amd64
}

You will need to adjust this for your system. You can use the blkid command to get the UUID for your disk partitions. You might notice that I passed the root= parameter twice on the module line. This may be a bug somewhere in Xen or Grub but I could not get anything to work when only including this parameter once.

You also need to update your default operating system. You may want to wait until after you’ve verified everything works, but eventually you should edit /etc/default/grub. Mine looks like:

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.

GRUB_DEFAULT="Ubuntu, Xen 3.4.2 dom0 2.6.31.8-xen0-amd64"
#GRUB_DEFAULT="0"
#GRUB_HIDDEN_TIMEOUT=1
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT="3"
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# The resolution used on graphical terminal
GRUB_GFXMODE=1440x900x32

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entrys
#GRUB_DISABLE_LINUX_RECOVERY="true"

GRUB_DISABLE_OS_PROBER=true

Now run update-grub:

$ sudo update-grub

Reboot

Cross your fingers, it’s time to reboot into the Xen hypervisor and your new Xen kernel. If you are lucky everything will work and you’ll soon be back to your desktop. You may run into driver issues, in which case you’ll need to boot your original kernel and try your hand at reconfiguring and recompiling your kernel.

If you use Nvidia or ATI binary drivers they won’t work with the Xen kernel (yet). Enabling these is a subject for another day, but it can be done. For now, let’s stay focused on getting Xen fully installed and running.

After rebooting, you can check a couple of things:

$ uname -r
2.6.31.8-xen0-amd64
$ sudo cat /proc/xen/capabilities
control_d

Start Xen tools

Once you are running the Xen hypervisor and a Xen compatible dom0 kernel, you need to start the Xen daemon. This is done with:

$ sudo /etc/init.d/xend start

You can start this automatically by establishing sysvinit links with:

$ sudo update-rc.d xend start 20 2 3 4 5 . stop 80 0 1 6 .

If you want Xen domUs in /etc/xen/auto to start automatically on boot, set the xendomains init script to run on boot:

$ sudo update-rc.d xendomains start 21 2 3 4 5 . stop 79 0 1 6 .

Compile a domU kernel

This step is optional. You may want to compile a kernel for use by your Linux domUs. Many distributions can run as a domU with their stock kernel however if that doesn’t work you can configure them to use a Xen domU kernel.

Configuring a Xen domU kernel is similar to configuring a Xen dom0 kernel:

$ cd /usr/src

$ tar -xjf linux-2.6.31.8.tar.bz2
$ mv linux-2.6.31.8 linux-2.6.31.8-xenU-amd64

# Modify Makefile so EXTRAVERSION = .8-xenU-amd64

$ cp /boot/config-2.6-31-17-generic .config
$ make menuconfig
$ sudo make install
$ sudo make modules_install

When configuring the domU kernel, you’ll want to make sure you enable:

Processor type and features --->
  [*] Paravirtualized guest support --->
    [*] Xen guest support
Device drivers --->
  [*] Xen /dev/xen/evtchn device
  <*> Xen filesystem
  [*] Create xen entries under /sys/hypervisor

Ready for domUs

Congratulations, your Ubuntu 9.10 Karmic Koala installation is now running as a domain 0 on top of the latest Xen hypervisor. You are ready to start installing domUs.

Brandon Server Admin , ,

  1. jason
    March 22nd, 2010 at 21:39 | #1

    Hello I have followed the walk through flawlessly as far as I know everything to the letter, however I ended up with my initrd.img-2.6.33.1-xen0-amd64 in the root folder and it was named as bootinitrd.img-2.6.33.1-xen0-amd64?

    well I have a proble or issue with the booing of the multiboot&&kernel&&initrd

    during the boot process the whole system just halts with a

    No filesystem could mount root, tried:
    Kernel panic -not syncing:VFS: Unable to mount root fs on unknown-block (1,0)

    then thats that?? any help would be appreciated.
    Im on a internal drive on my pc partition is /dev/sda9 so in grub its marked to boot, root and look for all files at that point (hd0,9)

    example:
    multiboot (hd0,9)/boot/xen.gz
    module (hd0,9)/boot/vmlinuz-2.6.33.1-xen0-amd64 root=/dev/sda9 root=/dev/disk/by-uuid/xxxxx-xxxxxx-xxxxxx
    module (hd0,9)/boot/initrd.img-xen0-amd64

    well thats my grub pretty much.. any suggestions are welcomed!

    Thanks in advance

  2. jason
    March 22nd, 2010 at 22:08 | #2

    hitoshi :
    I met same problem with 2.6.33.1.
    I avoided this problem with changing source at line 460 in arch/x86/kernel/acpi/boot.c.
    original: #ifdef(CONFIG_X86_IO_APIC)/p>
    changed to: #if defined(CONFIG_X86_IO_APIC) && !defined(CONFIG_XEN)

    hey, I was getting the same thing, I {{solved}} :P that by using a completely experimental version of the xen source {{(unstable version) 4.0.0-r6}} first compiling that asper this web post.

    http://recluze.wordpress.com/2010/02/09/building-xen-from-source-on-ubuntu-8-04/

    Then downloading the updated patches for a updated kernel linux kernel-2.6.33.1
    then downloading updated patches for the updated latest kernel version patch-2.6.33.1

    then patched, and did standard installs.

    1. Compiled the xen-4.0.0-r6 $sudo make world.
    2. Compiled the linux-2.6.33.1 kernel
    make menuconfig-edited it accordingly plus added ect4 filesystem support.
    make
    sudo make install
    sudo make modules_install

    then made the initrd.img

    then updated the /etc/grub.d/40_custom
    /etc/default/grub
    ran sudo update-grub

    then thats where im stuck I did compile it correctly however I ran into booting problems later with my filesystem not mounting root..

    Like I said in the other post any and all help is greatly appreciated :)

  3. Douglas Servellon
    March 23rd, 2010 at 10:22 | #3

    hey Brandon and friends….im newbie on ubuntu and im trying to install XEN on ubuntu KARMIC, can you tell me how do i modify the MAKEFILE please??…please tell wich instruction do i use to do that.

    ill appreciatte your help!

    THXS!

  4. Douglas Servellon
    March 23rd, 2010 at 10:48 | #4

    @Brandon
    hey brandon, i need your help…how can i modify the MAKEFILE, can you tell me how to do that, wich instruction do i use??…

    THXS for your help!

  5. March 23rd, 2010 at 12:01 | #5

    @jason
    You probably ended up with the file bootinitrd.img-2.6.33.1-xen0-amd64 because you mistyped (forgot a slash between boot and initrd) the mkinitramfs command. The command in my post is:
    sudo mkinitramfs -o /boot/initrd.img-2.6.31-8-xen0-amd64 2.6.31.8-xen0-amd64
    You need to modify this (obviously) since you are using a newer kernel.

    Fix that and make sure you have a correct /boot/initrd.img-2.6.xx-x-xen0-amd64 file. Also make sure this filename matches the filename on the last module line in your grub configuration (the example you provided did not match).

    If you did all of this and are still having problems mounting root, you have probably have a driver issue (wrong drivers for your SATA controller) or a bad disk (not likely).

  6. March 23rd, 2010 at 12:05 | #6

    @Douglas Servellon
    As I said in my post, use your favorite text editor. For example vim, emacs, nano.

    I’m not trying to be rude, but I would proceed with extreme caution. My post calls for compiling the kernel from scratch, not an easy task in itself. If you’re still learning the ropes in linux and don’t know how to edit text files, I would strongly advise you not try to install Xen from scratch, you could completely hose your box. Try VirtualBox or wait for Ubuntu to package Xen.

  7. jason
    March 23rd, 2010 at 14:25 | #7

    @jason
    According to the Xen wiki websource website

    “Xen 4.0 switched to using Linux pv_ops based dom0 kernel as a default. This is the kernel all users should be using and testing, and all the development should be made against this kernel tree.”

  8. March 23rd, 2010 at 14:40 | #8

    @jason
    I agree, and in fact in my post I say:

    You have two main choices when it comes to a dom0 kernel. The Xen kernel or a dom0 pv-ops kernel. Normally I would recommend using a pv-ops kernel. The same pv-ops kernel can run on bare-metal or under the Xen hypervisor. The pv-ops kernel is going to be the default in future versions of Xen and will most likely be included in the mainline Linux kernel soon.

    However, the pv-ops kernel will not work with Nvidia’s binary driver and since I was installing Xen for use on a desktop box with an Nvidia graphics card, I wanted to be able to use the Nvidia binary drivers (at least until KMS and the Nouveau driver mature a little). As of today, the Nvidia binary drivers require the “xenified” kernel. If you don’t need these drivers, pv-ops is the way to go. In fact, pv-ops dom0 support will probably be included in the mainline kernel very soon (2.6.34 or 2.6.35) – which will hopefully cause Ubuntu to start packaging Xen again and render this post obsolete!

  9. jason
    March 23rd, 2010 at 14:44 | #9

    @Brandon
    hello Brandon, I did rename the Initrd.img file I figured I typed it wrong :P I must have hit the button on the post too quick, or was thinking out loud with my key board.

    It indeed is a correct initrd image file and yes I renamed it correctly to match the gentoo linux kernel.

    It is erroring out on me again. It keeps giving me the same error yes. and sorry I was not clear on the first post.

    Incidentaly I am thinking of debugging using kexec-tools as seen in the grub entry im setting up a dump kernel (as the xen-4.0.gz) however I am unsure how to properly set up this scenario, and using a gz image? I believe I am meant to use a uncompresses image. Any suggestions will be greatly rewarded, well Ill buy you a beer :P )

    im reading this site on root mounting problems:
    http://www.howtoforge.com/forums/showthread.php?p=112023

    and was thinking about the whole dump scenario

    grub was updated and now reads:

    menuentry “Ubuntu, Xen 4.0.0-rc6 dom0 2.6.33.1-xen0-amd64″ {
    set quiet=1
    insmod ext2
    insmod ext4
    set root=(hd0,9)
    search –no-floppy –fs-uuid –set b0d66caf-41fc-437a-bf92-fe2424de9017
    multiboot (hd0,9)/boot/xen-4.0.gz quiet
    module (hd0,9)/boot/vmlinuz-2.6.33.1-xen0-amd64 root=UUID=b0d66caf-41fc-437a-bf92-fe2424de9017 root=/dev/sda9 ro quiet splash all_generic_ide
    module (hd0,9)/boot/initrd.img-2.6.31.12-xen0-amd64
    }

    menuentry “Ubuntu-DUMP! DUMP!, Xen 4.0.0-rc6 dom0 2.6.33.1-xen0-amd64″ {
    set quiet=1
    insmod ext2
    insmod ext4
    set root=(hd0,9)
    search –no-floppy –fs-uuid –set b0d66caf-41fc-437a-bf92-fe2424de9017
    multiboot (hd0,9)/boot/xen-4.0.gz quiet crashkernel=128M@16M
    module (hd0,9)/boot/vmlinuz-2.6.33.1-xen0-amd64 root=UUID=b0d66caf-41fc-437a-bf92-fe2424de9017 root=/dev/sda9 ro quiet
    module (hd0,9)/boot/initrd.img-2.6.31.12-xen0-amd64
    }

  10. March 23rd, 2010 at 15:09 | #10

    @jason
    Are you copying and pasting your grub configuration into my blog, because some things still look strange. For example I’d expect the version numbers on the initrd.img file to match the kernel version. Your latest post shows 2.6.33.1 as the kernel and 2.6.31.12 as the initrd.img. Perhaps you renamed these, but you want to make sure you are generating the initrd image for the correct kernel (with the mkinitramfs command). Simply renaming the file to match the kernel version won’t work.

    If you copied Ubuntu’s original .config file, you really shouldn’t have any driver problems – but it’d be worth a few minutes to run through your menuconfig and check that you’ve enabled the correct filesystem types and SATA drivers for your system. I tend to compile my SATA driver and filesystem into the kernel rather than as a module (eliminates the dependence on an initramfs).

    One quick question: What filesystem are you using? You may need an appropriate insmod line in your grub configuration (hint: look at the Ubuntu generated sections in /boot/grub/grub.cfg)

  11. chenchao
    March 23rd, 2010 at 21:11 | #11

    @Brandon
    Thank you for your help. I change dash to two dash.It’s OK.
    But there is a new problem.

    “error:file not found.”appears when booting “Ubuntu, Linux 2.6.31.8-xen0-amd64″

    menuentry “Ubuntu, Linux 2.6.31.8-xen0-amd64″ {
    insmod ext4
    set root=(hd0)
    search –fs-uuid –set d4d38180-6c21-4eb1-b675-d82328b09771
    multiboot (hd0)/boot/xen-3.4.2.gz vga=gfx-1440*900*32 quiet
    module (hd0)/boot/vmlinuz-2.6.31.8-xen0-amd64 root=/dev/mapper/VolGroup01-LogVo100 root=/dev/mapper/VolGroup01-LogVo100 ro quiet splash
    module /boot/initrd.img-2.6.31.8-xen0-amd64
    }

    These are the files under boot.
    ls /boot
    abi-2.6.31-14-server
    grub
    System.map-2.6.31-14-server
    vmlinuz-2.6.31-14-server
    config-2.6.31-14-server
    initrd.img-2.6.31-14-server
    xen-3.gz xen.gz xen-3.4.gz xen-3.4.2.gz
    System.map-2.6.31.8-xen0-amd64
    vmlinuz-2.6.31.8-xen0-amd64
    config-2.6.31.8-xen0-amd64
    initrd.img-2.6.31.8-xen0-amd64
    System.map-2.6.31.8-xen0-amd64.old
    vmlinuz-2.6.31.8-xen0-amd64.old
    xen-syms-3.4.2
    vmcoreinfo-2.6.31-14-server
    config-2.6.31.8-xen0-amd64.old
    memtest86+.bin

    cat /proc/mounts
    rootfs / rootfs rw 0 0
    none /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
    none /proc proc rw,nosuid,nodev,noexec,relatime 0 0
    udev /dev tmpfs rw,relatime,mode=755 0 0
    /dev/mapper/VolGroup01-LogVo100 / ext4 rw,relatime,errors=remount-ro,barrir=1,data=ordered 0 0
    none /sys/kernel/security securityfs rw,relatime 0 0
    none /sys/fs/fuse/connections fusectl rw,relatime 0 0
    none /sys/kernel/debug debugfs rw,relatime 0 0
    none /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxode=000 0 0
    none /dev/shm tmpfs rw,nosuid,nodev,relatime 0 0
    none /var/run tmpfs rw,nosuid,relatime,mode=755 0 0
    none /var/lock tmpfs rw,nosuid,nodev,noexec,relatime 0 0
    none /lib/init/rw tmpfs rw,nosuid,relatime,mode=755 0 0

    How can I do now? How to change the menuentry? Please help me. Thank you very much.

  12. jason
    March 25th, 2010 at 01:01 | #12

    You may have been right.

    Okey, I apologize for not checking my posts the grub config it is set at:

    #!/bin/sh
    exec tail -n +3 $0
    # This file provides an easy way to add custom menu entries. Simply type the
    # menu entries you want to add after this comment. Be careful not to change
    # the ‘exec tail’ line above.

    menuentry “Ubuntu, Xen 4.0.0-rc6 2.6.31.12-xenU-64bit-Hypervisor” {
    set quiet=1
    insmod ext2
    insmod ext4
    set root=(hd0,9)
    search –no-floppy –fs-uuid –set b0d66caf-41fc-437a-bf92-fe2424de9017
    multiboot (hd0,9)/boot/xen-4.0.gz quiet
    module (hd0,9)/boot/vmlinuz-2.6.31.12-xenU-64bit-Hypervisor root=UUID=b0d66caf-41fc-437a-bf92-fe2424de9017 root=/dev/sda9 ro quiet splash all_generic_ide
    module (hd0,9)/boot/initrd.img-2.6.31.12-xenU-64bit-Hypervisor
    }

    menuentry “Ubuntu, Xen 4.0.0-rc6 dom0 2.6.33.1-xen1-amd64″ {
    set quiet=1
    insmod ext2
    insmod ext4
    set root=(hd0,9)
    search –no-floppy –fs-uuid –set b0d66caf-41fc-437a-bf92-fe2424de9017
    multiboot (hd0,9)/boot/xen-4.0.gz quiet
    module (hd0,9)/boot/vmlinuz-2.6.32.10-xen1-amd64 root=UUID=b0d66caf-41fc-437a-bf92-fe2424de9017 root=/dev/sda9 ro quiet splash all_generic_ide
    module (hd0,9)/boot/initrd.img-2.6.32.10-xen1-amd64
    }

    menuentry “Ubuntu, Xen 4.0.0-rc6 dom0 2.6.33.1-xen0-amd64″ {
    set quiet=1
    insmod ext2
    insmod ext4
    set root=(hd0,9)
    search –no-floppy –fs-uuid –set b0d66caf-41fc-437a-bf92-fe2424de9017
    multiboot (hd0,9)/boot/xen-4.0.gz quiet
    module (hd0,9)/boot/vmlinuz-2.6.33.1-xen0-amd64 root=UUID=b0d66caf-41fc-437a-bf92-fe2424de9017 root=/dev/sda9 ro quiet splash all_generic_ide
    module (hd0,9)/boot/initrd.img-2.6.33.1-xen0-amd64
    }

    menuentry “Ubuntu-DUMP! DUMP!, Xen 4.0.0-rc6 dom0 2.6.32.10-xen1-amd64″ {
    set quiet=1
    insmod ext2
    insmod ext4
    set root=(hd0,9)
    search –no-floppy –fs-uuid –set b0d66caf-41fc-437a-bf92-fe2424de9017
    multiboot (hd0,9)/boot/xen-4.0.gz quiet crashkernel=128M@16M
    module (hd0,9)/boot/vmlinuz-2.6.32.10-xen1-amd64 root=UUID=b0d66caf-41fc-437a-bf92-fe2424de9017 root=/dev/sda9 ro quiet
    module (hd0,9)/boot/initrd.img-2.6.32.1-xen1-amd64
    }

    #You may have been right.

    #Okey, I apologize for not checking my posts the grub config it is set at:
    well you may notice the two new entries in there besides the original xen0-amd64

  13. jason
    March 25th, 2010 at 01:03 | #13

    now I have the debug kernel and the completely new compiled 2.32.10-xen1-amd64 kernel, that works thank heavens!

    so thats good news, I got the earlier 2.32.10 kernel to work with all the xen patches, :P so now I have tow things I can do, ether start work on debugging the 2.33.1 kernel. And I can start work compiling a DomU kernel.

    well the xen developer Jeremy had some notes earlier this month about not being ready to start the bleeding edge version of the release yet, and I didnt try to download the git remote /xen/next it gave me errors when I tried.

    The bad news… I cant access my wireless in the xen1-amd64, and I could swear that I gave user privileged access to hardware in the kernel! :S

    I had a privileged guest account im sure.. I may need to recompile?
    specific network problems include:

    the wlan0 giving me grief, Its telling me that theres things that are unsupported in the device?? when Im just connecting using the normal everyday terminal commands like ifconfig wlan0 down, dhclient -r wlan0, ifconfig wlan0 up, gives some errors around the dhclient, and then if i tried to continue connecting with iwconfig wlan0 essid “linksys” I get “not supported in module errors”?? any help here.

  14. jason
    March 25th, 2010 at 01:15 | #14

    hi brandon just read your posts quickly this morning was meaning to go over them earlyer for a reply, however as my previous two posts say Ive been trying the pvops compilations today, and with only moderate success, one of those pvops only booted up to a certain point then it “gave up on boredom or something like that trying to mount one of my filesystems.

    my file systems are one ext4 for the root = /
    And the rest are on separate partitions well… /home, /usr, /var, /tmp are on separate ones. and these are all ext3 fs.

    thanks for the grub mod line hint.

  15. jason
    March 25th, 2010 at 01:28 | #15

    I did get into the root shell however the bash system had some major errors with missing commands.. witch reminds me that in the linux-2.32.10-xen1-amd64 kernel that was giving me grief with the network.

    I was also noticing that the /prov and the sys folders were both populated with 0bit files and folders!??

    So I am guessing that it didn’t mount the fs correctly? or what..

    Should I boot into my working server vanilla kernel and manually create separate partitions for the sys and prov system folders then remount them in the fstab reboot to check once then reboot the linux-2.6.32.10-xen1-amd64 kern?

  16. Douglas Servellon
    March 25th, 2010 at 17:17 | #16

    hey brandon, one question…
    when i was in the grub, appears the option:

    Ubuntu, linux 2.6.31.8-xen0-amd64

    if i try to get in this options appears a error message like this:

    “error: invalid magic number”
    press any key to continue…

    and if i select this option in the grub:

    Ubuntu, Xen 3.4.2 dom0 2.6.31.8-xen0-amd64

    this error appears:

    error: no such device: 31d4873b-fed1-49d9-b37d-89d9f7a46566
    press any key to continue

    what do i do wrong with the configuration?
    what should i change to fix this problem??

    i hope you can help me, cause this is something like a test in my new job and i have to make Xen Run…

    ill appreciate your support..

    THXS again

  17. March 25th, 2010 at 22:52 | #17

    @jason
    It sounds like you are making some progress – just need to work out the kinks. You really shouldn’t have to touch fstab, or do anything differently to your file systems. The kernel you compiled should really be a drop in replacement for the stock Ubuntu kernel, except capable of running under Xen. And if your using a pvops kernel, it should be capable of running with or without Xen.

    I’d compare your new kernel .config file to the Ubuntu stock .config file. There will naturally be differences, but see if anything jumps out at you (regarding wifi, etc.) There really isn’t much you need to change on your system when using a new kernel. Go back and make sure you followed each step, maybe try the kernel I used (2.6.31.8) just to eliminate some variables (you can upgrade later). And try posting on the xen-users mailing list. There’s a much wider audience over there.

  18. March 25th, 2010 at 23:06 | #18

    @Douglas Servellon
    May I suggest trying Ubuntu 8.04 instead of 9.10. Ubuntu dropped support for Xen in 9.10, which is why this post describes how to install it manually. In 8.04 it’s as easy as using to aptitude to install any other package. There are some instructions here: https://help.ubuntu.com/community/Xen

    The errors you are currently seeing are because you are copying and pasting my config files without adjusting them to match your system. 31d4873b-fed1-49d9-b37d-89d9f7a46566 is the UUID for my root device, not yours. Your UUID is different – which is why Grub2 can’t find it.

  19. chenchao
    April 1st, 2010 at 00:46 | #19

    hello brandon
    I have one question.
    When I boot 2.6.33.1-xen0-amd64, appears the option:

    Gave up waiting for root device. Common problems:
    -Boot args (cat /proc/cmdline)
    -Check rootdelay = (did the system wait long enough?)
    -Check root = (did the system wait for the right device?)
    -Missing modules (cat /proc/modules; ls /dev)
    ALERT! does not exist. Dropping to a shell!

    What’s wrong? How can I do now? Please help me. Thank you very much.

  20. April 1st, 2010 at 14:30 | #20

    You may also need to install the following packages to get xen to compile.

    * zlib-bin
    * libcurl4-openssl-dev
    * xserver-xorg-dev
    * gettext

    Cheers,

    Duke.

  21. April 16th, 2010 at 18:41 | #21

    I ran into a nasty bug in the grub2 bootloader that causes the first parameter to be ignored. After tearing my hair out I came across this solution: add dummy=dummy or anything=anything as the first parameter. It will be ignored and it will then process the option for root properly. Hope this helps.

  22. Man
    April 21st, 2010 at 21:19 | #22

    Hello Brandon,

    This article is very useful but I don’t know why you know to created patch file for ubuntu. Which resources or document do you research and refer to?

    Please help me to show about resources and document.

    Thank you.

  23. frank
    April 21st, 2010 at 21:34 | #23

    Hi Brandon,
    Thanks for your nice guide! When I run the mkinitramfs command it showed as below:

    $ sudo mkinitramfs -o /boot/initrd.img-2.6.31.8-xen0-intel64 2.6.31.8-xen0-intel64
    W: Possible missing firmware /lib/firmware/2.6.31.8-xen0-intel64/e100/d102e_ucode.bin for module e100
    W: Possible missing firmware /lib/firmware/2.6.31.8-xen0-intel64/e100/d101s_ucode.bin for module e100
    W: Possible missing firmware /lib/firmware/2.6.31.8-xen0-intel64/e100/d101m_ucode.bin for module e100

    Could you please tell me what does the information mean? By the way I encountered the same problem as Akanksha & Dulcardo.

  24. April 22nd, 2010 at 08:33 | #24

    @frank
    Unless you use an e100 network card, I wouldn’t worry about those messages. Did you download the vanilla kernel from kernel.org? I’m pretty sure the firmware is included.

  25. frank
    April 22nd, 2010 at 12:28 | #25

    @Brandon
    Yeah I’ve downloaded the kernel from kernel.org. Before this command, everything works well on my machine. Does it matter at all?

  26. April 22nd, 2010 at 12:58 | #26

    @frank
    If your internet works when you boot into the Xenfied kernel, than I wouldn’t worry about it.

  27. Tommy
    May 12th, 2010 at 18:55 | #27

    Hi Brandon,
    Thanks for this useful guide.
    I also have a nvidia card. Could you give me some hints about how to make it work under xenified kernel?
    Thanks.

  28. Roman
    May 24th, 2010 at 13:52 | #28

    Hey. All!
    If have tis message
    “Gave up waiting for root device. Common problems:
    -Boot args (cat /proc/cmdline)
    -Check rootdelay = (did the system wait long enough?)
    -Check root = (did the system wait for the right device?)
    -Missing modules (cat /proc/modules; ls /dev)
    ALERT! does not exist. Dropping to a shell!”

    Fix it through the add ‘ in grub.cfg

    For example:
    root=’/dev/mapper/Lv1-Vl1′

  29. Brian
    May 27th, 2010 at 16:27 | #29

    I have a question as well. When I am applying the xen patches and I type in “for i in `ls ../xenpatches-v10_2.6.31.8/`; do patch -p1 < ../xenpatches-v10_2.6.31.8/"$i"; done" (without the quotes) it then comes to a prompt where it says "File to Patch: "

    Has anyone seen this and/or know what to do at this point? Any help would be beneficial.

    P.S. Thanks for the tutorial Brandon! Really helps out!

  30. May 27th, 2010 at 16:33 | #30

    @Brian
    Usually this that means that the patch command cannot find the file to patch and is asking you to find it. This shouldn’t happen. I get encounter that message often when trying to patch from the wrong directory. Did you change directory into the kernel directory before running the command?

    Are you using the vanilla kernel from kernel.org? Does the kernel version you are using match up with the xenpatches kernel version? If you followed my tutorial to the letter than the answer is “yes”, but sometimes people use the latest kernel. This should still work, but you want to make sure all the versions match up.

  31. Brian
    May 27th, 2010 at 16:44 | #31

    @Brandon
    yup, I have done everything up to that point exactly the same as pointed out in the tutorial. The only thing I changed was that I used the newest Xen release, 4.0.0. Other then that, everything thing else is the same. Hmmm… I really dont know what could be causing this. I know i’m typing in the correct filenames, because im hitting tab for autofill, and I’ve checked the command to make sure it’s the same as yours about 20 times :)
    Is there another way to do the for loop that will produce the same results?

  32. May 27th, 2010 at 17:02 | #32

    @Brian
    Hmm… Well all the for loop is doing is applying each patch one at a time in order. You could apply each patch by hand but that would be a pain. That may give you an indication of where it is failing however.

    You might check your version of patch patch --version. Mine is 2.6. I have no idea what version you need, but it’s at least worth checking.

    Try applying a single patch by itself:

    cd linux-2.6.31.8-xen0-amd64
    patch -p1 < ../xenpatches-v10_2.6.31.8/60000_add-console-use-vt.patch1

    Did that work? If it did not, from the current directory you are in can you:

    ls -l drivers/char/tty_io.c

  33. Brian
    May 27th, 2010 at 17:17 | #33

    @Brandon
    Wow, that actually worked (The patch -p1 line).
    The only thing I had to do was type sudo in front of it so I could carry out the process (I dont want to become root user… messed up to many things that way)
    So… I really don’t want to do all of these by hand… I noticed when I was doing the for loop before.. I skipped over some of the patches… and it went on and on and on…

    ————————————————————————
    So… hmm. Well when I type sudo in front of the entire for loop:

    sudo for i in `ls ../xenpatches-v10_2.6.31.8/`; do patch -p1 < ../xenpatches-v10_2.6.31.8/"$i"; done

    it says:

    bash: syntax error near unexpected token `do'

    So I removed the do, and I got a similar response as above, but with the `done'

    So again I removed that, but now it does the exact same thing as before.. where it says:

    File to Patch:
    ————————————————————————

    BTW, I checked my patch version, and its 2.5.9

    Should I upgrade my patch version? and how would I do that? I acquired the patch command from typing:

    sudo apt-get install patch

    I assumed that would've installed the latest release… I guess I was wrong.

    Thanks again for your help.

  34. May 27th, 2010 at 17:23 | #34

    @Brian
    I’m sure 2.5.9 is fine. I’m on Ubuntu 10.04 now, I bet it was 2.5.9 in 9.10.

    It sounds like your problem is related to root permissions. You should do everything as a normal user (not root) except when I prefix my command with sudo. This means you shouldn’t have used sudo to untar the files, etc. It sounds like you don’t have permission to modify the source files as an ordinary user when running patch. This would be the case if you used sudo to untar the source files.

    I’d suggest starting over in a directory inside your home directory, or /tmp, or somewhere else where your user has write access. Untar the files without sudo and try the patch command again.

    Hope that made sense :/

  35. Brian
    May 27th, 2010 at 17:26 | #35

    @Brandon
    Oh no don’t worry that totally makes sense. I just finished a Linux class in my college, so I’m fluent with what your talking about. Ok I will try that… because you were right.. I had to use sudo in front of 90% of the commands in the tutorial. Ok well I will try over and I’ll let you know how that goes!!

  36. Brian
    May 27th, 2010 at 18:07 | #36

    @Brandon
    Awesome! That did the trick! Now to keep going on the tutorial!!

    Thanks!!!

  37. Brian
    May 27th, 2010 at 18:39 | #37

    @Brandon
    Well, hit another snag. I’m at the point where I’m compiling and installing the kernel. I type in:
    export CONCURRENCY_LEVEL=3

    That works fine. But then I type:
    make

    And it gives me an error stating:
    awk: line 2: function gensub never defined
    scripts/Makefile.build:82: *** ‘Your awk program does not define gensub. Use gawk or another awk with gensub’. Stop.
    make: *** [scripts_basic] Error 2

    From what I read, I’m thinking I have a problem with awk. I checked the man pages for awk, but all I had was mawk.

    So I typed:
    sudo apt-get install awk

    That displayed a page where it asked for me to specify whether I wanted original-awk, gawk, or mawk. I told it original-awk. So it installed. I checked the man page for awk… and again only mawk displayed.

    So is it something else or is my awk being like… overwritten by mawk?

  38. jason rupright
    June 6th, 2010 at 09:38 | #38

    Hello, I had another question regarding xen, specifically on loading modules after build?

    You only typed a few Is there a list currently that you know of for all the modules available and their specified names or calls in this file?

    any time and help is appreciated

    If you compiled the Xen net, block and usb backend drivers as modules, you will probably want to load them by default by adding them to your /etc/modules file:
    view source
    print?
    1 # /etc/modules
    2 …
    3 # These modules are required for Xen DomUs to work
    4 netbk
    5 blkbk
    6 usbbk

Comment pages
  1. January 16th, 2010 at 16:22 | #1
  2. January 16th, 2010 at 21:29 | #2
  3. January 17th, 2010 at 13:57 | #3
  4. January 18th, 2010 at 22:11 | #4
  5. January 19th, 2010 at 20:53 | #5
  6. March 7th, 2010 at 07:37 | #6
  7. March 18th, 2010 at 13:32 | #7