linux instead

Installing Xen 3.3.1 from source on Debian 5.0 (Lenny)

by Kev on Apr.07, 2009, under Xen virtualisation

This is how I built my Xen server.

First install Debian 5.0 (Lenny). This should also work on 4 (Etch) too.

Everything is done on the command line as root.

To build Xen from source you’ll need as fair number of dependencies. The easiest way to install them is by using the apt-get install command as below:
apt-get install bcc bin86 gawk bridge-utils iproute libcurl3 libcurl4-openssl-dev bzip2 module-init-tools transfig tgif texinfo pciutils-dev mercurial build-essential make gcc libc6-dev zlib1g-dev python python-dev python-twisted libncurses5-dev patch libvncserver-dev libsdl-dev libjpeg62-dev

If you installed the 64bit version of Debian then you’ll also need gcc-multilib for the compile to work:
apt-get install gcc-multilib

Next create a temporary folder and download the Xen source code:
mkdir xentemp
cd xentemp
wget http://bits.xensource.com/oss-xen/release/3.3.1/xen-3.3.1.tar.gz

Now extract the soucecode from the downloaded archive:
tar -xzf xen-3.3.1.tar.gz
cd xen-3.3.1

Right, now on with the compile (this will take a while…):
make world
Note, if you want USB and PCI passthrough to answer Y when prompted.

Assuming that the above compile went ok:
make dist

And now install the newly compiled kernel and tools into the system:
./install.sh

Ensure the xen deamon starts and stops with the rest of the system:
update-rc.d xend defaults 20 21
update-rc.d xendomains defaults 21 20

Create the module dependencies stuff:
depmod 2.6.18.8-xen

Update/create initramfs for the new kernel:
update-initramfs -c -k 2.6.18.8-xen

Add the new kernel to your grub boot menu:
update-grub

Reboot the system and hope that it works!
reboot

Now have a xen kernel:
uname-a
Should show a xen kernel at version 2.6.18

However on my gigabyte motherboard I was getting some boot time errors:
2.6.18 exception Emask 0×40 SAct 0×0 SErr 0×800 action 0×2

A quick google confirmed that this was due to the old kernel version, 2.6.18 and my motherboard.
So to fix the error I used synaptic to install latest xen kernel from lenny repositories…

uname -a
2.6.26-1-xen-amd64 #1 SMP Fri Mar 13 21:39:38 UTC 2009 x86_64 GNU/Linux
This resolved the error and still leaves me with xen 3.3.1

Type xm info to confirm xen version

And that’s it!

:, , , ,

21 Comments for this entry

  • Tyler

    Thank you very much for the information! Well laid out and easy to follow. You saved me a ton of time!

  • render

    works great but what about to install xen-tools ? i cant find the section how i can install the xen-tools.

    • Kev

      I haven’t built/installed xen-tools on my system. You don’t actually need them, you can just create the config files and use the xm command to manage your domus.
      I have another post which shows you how to do this for a paravirtual domu. I’ll be posting another one showing how to create a hvm (hardware virtualised) domu soon.

  • cougarmaster

    How did u install the 2.6.26-1-xen-amd64? Can u show the steps done? Cause after I followed this tutorial and install the new kernel it changes the xen to version 3.2 not 3.3.1.

    • Kev

      You can downloaded and install 2.6.26-1-xen-amd64 kernel from the standard repositories using synaptic or apt-get. It looks like you may have also installed xen from the repositories as thay are at 3.2.
      I think you might need to re run the make dist and install bit of the instructions to replace the xen version with the one you compiled.

  • cougarmaster

    Can u do one with 3.4? Hehehe and the newer kernels pls :)

  • Roger

    I tried that with xen 3.4, the system can\’t boot up.

  • thundercat600

    3.4 is really easy to do. Follow the steps above but when you get to download the xen source, choose 3.4 instead. I manually downloaded from the website, followed the above and it installed first time no probs.

    • cougarnaster

      I too cannot boot up with 2.6.26-2-xen-amd kernel. Anyway any1 know how to create a domu manually not using xen-tools?

      • admin

        Seems that the 2.6.26 debian kernel will only work with xen 3.3.1.
        If you compile xen 3.4 (using instructions as above), then you will have to use the 2.6.18 kernel that you compiled with it.

  • stantheman

    Hi, great explanation. Xen 3.2 has kernel 2.6.18? So this will not compile on my Debian 5 system with kernel 2.6.26-2 ?

    What would be the ‘Host OS’ requirements for Xen Source to compile? Same kernel version?
    Thanks

    • admin

      You should be able to compile 2.6.18 with the newer kernel running. You’ll then install and boot into the new (but older!) kernel.

  • freelsd

    It cannot save me.
    All was done witout errors, but in boot new kernel I have:
    Waiting for root system…. 5 minutes pause and that’s all.

    • admin

      Sounds like the kernel does not support your PC/motherboard. The original xen kernel as compiled is 2.6.18 which is quite old. The replacement pre-compiled debian one, which actually comes from suse might fair better…

  • frank

    My xen 3 does not see my eth nic card

    It does recognize the debian which same machine and the /etc/network/interfaces

    can please help solve this issue

  • hassan

    Great Article. Is it possible to build XEN SOURCE along with Vanilla kernel?

    Thanks.

  • Contrack

    Hi, thank you for the short effective tut! But how to answer all the questions during compiling, except for the pci passthrough? Can you give any advice, please?

  • Tapas

    It is a great Guide and great explaination

  • Alex

    Hi. I have Dibian Lenny 2.6.26-1 with Xen 3.3.1 installed by your manual. My server work about half year and one time in month stopped with clear logs.
    I have
    cat /etc/sysctl.conf | grep xen
    xen.independent_wallclock=1

    But in dmess a lot of
    kernel: [3107832.353155] clocksource/0: Time went backwards: ret=9a95e2414e2ec delta=-14077922 shadow=9a95e1e6c46ab offset=67f7231

    May be it is problem. I hope anybody answer me.

  • cougarmaster

    Any1 tried xen 4.0 with debian lenny? If have please show how? I am getting stuck after boot it just hangs. I followed the procedure here which should use the 2.6.31 kernel.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...