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!
May 20th, 2009 on 5:22 am
Thank you very much for the information! Well laid out and easy to follow. You saved me a ton of time!
May 24th, 2009 on 5:47 pm
works great but what about to install xen-tools ? i cant find the section how i can install the xen-tools.
May 25th, 2009 on 6:45 pm
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.
May 24th, 2009 on 8:32 pm
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.
May 25th, 2009 on 6:39 pm
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.
May 25th, 2009 on 10:25 pm
Can u do one with 3.4? Hehehe and the newer kernels pls
May 28th, 2009 on 7:39 pm
I tried that with xen 3.4, the system can\’t boot up.
June 5th, 2009 on 4:18 pm
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.
June 14th, 2009 on 4:48 pm
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?
June 27th, 2009 on 5:02 pm
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.
August 18th, 2009 on 3:09 pm
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
November 21st, 2009 on 11:19 pm
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.
August 27th, 2009 on 9:58 am
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.
November 21st, 2009 on 11:16 pm
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…
October 16th, 2009 on 12:35 am
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
October 21st, 2009 on 9:03 pm
Great Article. Is it possible to build XEN SOURCE along with Vanilla kernel?
Thanks.
November 21st, 2009 on 3:57 pm
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?
November 21st, 2009 on 11:33 pm
You can usually just hit enter and go with the defaults. Kev.
November 24th, 2009 on 11:02 pm
It is a great Guide and great explaination
January 19th, 2010 on 6:43 pm
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.
April 16th, 2010 on 9:53 am
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.