Xen for Ubuntu Intrepid 8.10

I was in the process of figuring out and documenting the process ofΒ  compiling and installing an Xen enabled kernel on Ubuntu Intrepid 8.10. This was for a specific project that’s not going to come to fruition. I’m not going to bother as I also don’t feel like having my laptop burn a gaping hole through my lap as I wait for the kernel to compile, and well you know I still have some use for the 2 lads downstairs. And after years of compiling kernels, I really can think of more productive uses of my time.

The quickest way is to grab a Debian Xen enabled kernel, this isn’t recommended by Ubuntu and if your not comfortable hacking your system and having to compile modules (drivers in Windows speak) for hardware or proprietary hardware that Debian doesn’t include support for, then don’t even think of doing this and just use KVM.

Here’s how Chris did it for a system running a AMD64 processor, if you’ve an Intel processor you’ll need to use a different kernel:


If you want a later kernel (2.6.27 or 2.6.28) poke around:


That’s the approach I’m going to use, as I know that if I’ve problems or issues I’ll be able to figure it out. Anyways, the start of the orignal draft is below, preceded by a minor rant. When I get around to getting Xen on Ubuntu to work with a Debian kernel I’ll add a new post here.I recently got a new laptop with a dual-core “Intel(R) Core(TM)2 Duo CPU P8600” that supports virtualisation. I wanted to retry Xen, and test my new super-duper processors with virtualisation support! πŸ˜‰ I had tried Xen years ago when it was first released, and was pushing it where I worked at the time, but as when I was pushing Linux, people didn’t think it would be viable nor that it would be any good, nor that it could be a competitor to VMWare. I think a lot of this attitude within business is that they don’t really “get” Open Source, and still think that proprietary software processes are always the best.

Within a year of the first big Xen announcement Xen was being pushed and supported by many of the major Linux vendors, but by that time the company had already invested heavily in VMWare and associated tooling and infrastructure and training. Once you do all that, it’s hard to transition to something else, and people become “loyal” to the product their using and resistant to change is high. Don’t get me wrong, VMWare created a great tool, are great people, provide good support (or did last time I talked to them a few years ago), and some have some really smart heads, plus they basically created this “market segment”. But, I’m an Open Source proponent and feel that in many cases Open Source it can save one money, and if an Open Source project is popular and has many interested developers, oftentimes it can be better than it’s equivalent closed-source proprietary brethren. I won’t go into why it’s better in this posting, but a quick Google search will provide you with the pros/cons. Also in my opinion if you use a lot of Open Source you need to hire smart people, who can get things done, instead of hiring drones, and paying someone else a lot of money to do the work for you.

OK, back to the important stuff! I want Xen on Ubuntu Intrepid 8.10, but Ubuntu has discontinued Xen support for versions of Ubuntu after 8.04. They and Red Hat are now moving to a KVM based solution, and Red Hat recently purchased Qumranet; the company that created and supports KVM. Ubuntu still includes the Xen tools with Ubuntu 8.10, which means we only have to compile and install Xen enabled kernels, and simply use Ubuntu package manager to install the tools. If your running Debian Lenny, you can simply use apt-get/aptitude to install Xen kernels and tools. What I aim to do is create Xen kernels, and bundled these as DEB packages which I can then install/remove using Ubuntu’s package management tools.

1. Add yourself to the “src” group:

sudo adduser $USER src

Or replace $USER with the user name of the user you want to have access to kernel source code that is stored in /usr/src . By default kernel source code is stored in /usr/src . If your in the “user” group you can build/compile/modify the code without having to use sudo or “su -“.

2. Install necessary packages to compile, build, and then create a DEB package.

This isn’t a complete list:

sudo apt-get install build-essential libgtk2.0-dev libglib2.0-dev libglade2-dev build-essential libncurses5-dev gawk

3. Get kernel source code.
There are 4 ways to do this:
a. Download kernel source from kernel.org and patch it with Xen patch
b. Download Ubuntu’s kernel source tree and patch it with Xen patch
c. Download Xen’s Kernel source tree that’s already patched with Xen
d. Download Debian’s Kernel source tree that’s already patched with Xen

I’m going with “d”. This will save me from having to patch (and debug) the kernel source tree myself, and then be potentially stuck with unusual bugs, or problems.. This source will have some minimal testing that will at least ensures that it works, and if there are problems I can check Debian’s bug page for their kernel tree.

The easiest way to get the source is to get access to a Debian system and install the source. The source I’m using is 2.6.28, you may end up using a later version:

sudo apt-get install linux-source-2.6.28

This will install the source as /usr/src/linux-source-2.6.28.tar.bz2 . Copy this to your Ubuntu system.

Alternatively download it directly and extract it

Do not install the .deb file on your Ubuntu system as it’s possible that it might overlapse with a future Ubuntu package and cause problems. You can extract the .deb file using the -x flag of the dpkg command:

mkdir /tmp/kernel-src; cd /tmp/kernel-src; dpkg -x <filename>.deb .

Then look in the resultant directory structure for the .bz2 file.

Copy this to /usr/src .

Extract the file:

tar -jxvf linux-source-2.6.28.tar.bz2

Note: If your using pristine Linux sources from kernel.org, don’t extract, until you move or remove the symbolic link named linux.

Rename the resulting directory and bzip file:

mv linux-source-2.6.28 linux-source-2.6.28-debian-xen; mv  linux-source-2.6.28.tar.bz2  linux-source-debian-xen-2.6.28.tar.bz2

I’m using a name that will remind me in the future what I’d used this source code for.

Compile the source code:

To ensure that this works as closely to what Ubuntu uses, I reuse the Ubuntu configuration and enable Xen support. I do this by copying the .config file included with the header files of the kernel version I’m currently running. In this case it’s from a 2.6.27.-13:

cd /usr/src/linux-source-debian-xen-2.6.28;Β  cp ../linux-headers-2.6.27-13-generic/.config .cd /usr/src/linux-headers-2.6.27-13-generic; fakeroot make-kpkg kernel_image --append-to-version=.custom-xen

Enable 64bit support, enable Xen, enable any additional modules that you want that weren’t in the 2.6.27 kernel and away ye go. The “–append-to-version” is to allow me to ID my kernel, and to prevent any accidental overlaps with future stockΒ  Ubuntu kernels.

If this succeeds, you’ll have a Debian package of the kernel in the parent directory (/usr/src). And that’s where this draft ends and you’ll need to look put the rest of the pieces together yourself! Make sure you have a boot disk, in case grub or lilo get’s borked. And don’t remove your existing kernel until you are sure that your customised kernel works. Best of luck to ye. πŸ™‚ U can pick up most of the rest of the steps here.

An alternative approach is to install the Debian Packages directly onto Ubuntu:

Useful links:
How to create a custom kernel and package it as a .deb package:
How to install a Xen Kernel:
Building DEB packages from Kernel sources:

3 thoughts on “Xen for Ubuntu Intrepid 8.10”

  1. I’ve been using virtualbox (http://www.virtualbox.org/), since I found ubuntu support for Xen was lacking. I’ve even managed to get it working so I can forward USB ports to it, enabling me to sync and update the missus’ iphone – I don’t think there is any other way to do that from Linux.

    I fired it up again last night to try the latest kubuntu beta, which worked very nicely. It is a shame it isn’t completely open source – some advanced features are not in the GPL edition.

    However, they do provide a debian/ubuntu repository, making getting it running easy.

  2. I’ll have to remember that if I get some dodgy USB devices.

    At the moment I’m trying to figure out what virtualisation option would be good for a low-cost, easy to use, enterprise like option, that also provides good performance! πŸ™‚ I’d like to virtualise 3 or 4 existing servers to save on new hardware, and to save costs, but I’m not sure at the moment which of what options to go with. I think much Googleing and reading of documents awaits me. πŸ™‚

  3. I’ll have to remember that if I get some dodgy USB devices.

    At the moment I’m trying to figure out what virtualisation option would be good for a low-cost, easy to use, enterprise like option, that also provides good performance! πŸ™‚ I’d like to virtualise 3 or 4 existing servers to save on new hardware, and to save costs, but I’m not sure at the moment which of what options to go with. I think much Googleing and reading of documents awaits me. πŸ™‚

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.