Xen from Backports on Debian Sarge
Posted by Aike on Fri 21 Jul 2006 at 15:38
There is a great howto about installing Xen on Debian Unstable. It is really easy to do and it runs fine. Nevertheless, on production servers, that's not an optimal solution. Debian Unstable has too many updates and things change too often. On production machines, a Xen host system should be stable, secure and should not need much attention. That is where Sarge comes in. If you pull the Xen packages from backports and install them on Debian stable you've got the best of both worlds. Let's do so!
Before you start with this howto, you need to find yourself some hardware and install Sarge the way you like it. I used a Sun Fire X2100 with 4GB of ram and 2 SATA disks in software raid1.
Add backports to your apt sources and set the right preferences.
# vi /etc/apt/sources.list deb http://www.backports.org/debian/ sarge-backports main
If /etc/apt/preferences does not exist, create it.
# vi /etc/apt/preferences Package: * Pin: release a=sarge-backports Pin-Priority: 200 Package: xen-3.0 Pin: release a=sarge-backports Pin-Priority: 999 Package: linux-2.6 Pin: release a=sarge-backports Pin-Priority: 999 Package: xen-tools Pin: release a=sarge-backports Pin-Priority: 999 Package: udev Pin: release a=sarge-backports Pin-Priority: 999 Package: lsb Pin: release a=sarge-backports Pin-Priority: 999 Package: module-init-tools Pin: release a=sarge-backports Pin-Priority: 999 Package: grub Pin: release a=sarge-backports Pin-Priority: 999
Now update your sources:
# apt-get update && apt-get dist-upgrade
If that works, you're ready to start installing packages. If it doesn't, there is more information about backports on their website: http://www.backports.org.
Since there are some dependency problems with grub and mdadm we pull them, and some other packages, from backports.
# apt-get install grub/sarge-backports # apt-get install makedev/sarge-backports # apt-get install lsb-base/sarge-backports # apt-get install mdadm/sarge-backports
The next things to install are the Xen-hypervisor and the xen-utils.
# apt-get install xen-hypervisor-3.0-i386 xen-utils-3.0
Pick the right kernel. A 686 for P4 and Xeon machines and K7 for Athlon and Opteron machines.
# apt-get install linux-image-2.6.16-2-xen-686
Remove hotplug because we're changing to udev!
# dpkg --purge hotplug # apt-get install bridge-utils xen-tools/sarge-backports sysfsutils # mv /lib/tls/ /lib/tls.disabled
You need a new initrd. mkinitramfs can do that trick for you.
# cd /boot # mkinitramfs -o /boot/initrd.img-2.6.16-2-xen-686 2.6.16-2-xen-686
For this machine, we need a k7 kernel:
# apt-get install linux-image-2.6.16-2-xen-k7 # cd /boot # mkinitramfs -o /boot/initrd.img-2.6.16-2-xen-k7 2.6.16-2-xen-k7
We need to setup our bootloader to use the new Xen kernel. Add something like the following to your /boot/grub/menu.lst file:
# vi /boot/grub/menu.lst title Xen 3.0 / XenLinux 2.6-686 kernel /boot/xen-3.0-i386.gz module /boot/vmlinuz-2.6.16-2-xen-686 root=/dev/md0 ro module /boot/initrd.img-2.6.16-2-xen-686
or the with k7 if you have an Athlon or Opteron machine:
title Xen 3.0 / XenLinux 2.6-k7 kernel /boot/xen-3.0-i386.gz module /boot/vmlinuz-2.6.16-2-xen-k7 root=/dev/md0 ro module /boot/initrd.img-2.6.16-2-xen-k7
The xen daemon needs some tweaks, open the config file and make sure that you enable (network-script network-bridge) (line 73), (vif-script vif-bridge) (line 104).
# vi /etc/xen/xend-config.sxp
Restart the Xen daemon to check if the new settings are accepted:
# invoke-rc.d xend restart # reboot
In most cases the bridge will work after a reboot, but it's easy to check. Peth0 and vif0.0 should be in the interfaces list. Peth0 is the physical network device and vif0.0
# brctl show
You are ready to setup and start your xens! Setting up xens has been covered many times all over the net. The easiest way is probably to use the xen-tools created by Steve. Although they are pretty straightforward, there is some documentation on how to use them at the end of this article: http://www.debian-administration.org/articles/396
There are a few things you need to pay attention to when setting up xens. The first is to copy the modules to the xen guest. For instance, you could mount your first xen on /mnt/xen1 and copy the modules:
# cp -a /lib/modules/2.6.16-2-xen-k7/ /mnt/xen1/lib/modules/
The config file is the second thing. The ramdisk option is turned off by default but required to start a xen! For example:
# vi /etc/xen/xen1.cfg kernel = '/boot/vmlinuz-2.6.16-2-xen-k7' memory = 128 name = 'xen1' disk = [ 'phy:/dev/mapper/xens-xen1,sda1,w' ] root = "/dev/sda1 ro" extra = '4' ramdisk = "/boot/initrd.img-2.6.16-2-xen-k7" vif = [ 'vifname=vif_xen1,bridge=xenbr0' ]
If you need to upgrade the Xen kernel, don't forget to update the configuration files for the guests, the initrds and the modules on the Xen guests!
There is a copy of this howto on my company's website: http://www.virtualconcepts.nl/xenbackports.php
Good luck!
Debian sid is indeed quite unstable for a production box. An other option is to use debian etch (Testing) packages on sarge with pinning (/apt/preferences).
[ Parent | Reply to this comment ]
a small correction: the entry about "Package: xen-3.0" appears twice.
And a question:
Shouldn't these entries also contain the names of the binary packages, like "Package: xen-hypervisor-3.0-i386"?
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
--
Roberto C. Sanchez
http://familiasanchez.net/~roberto
[ Parent | Reply to this comment ]
It worked from scratch.
Only exception was that the kernel did not boot up as my version of grub expects all images in / instead of /boot.
I simply changed the /boot/grub/menu.lst entry to:
title Xen 3.0 / XenLinux 2.6-686
root (hd0,0)
kernel /xen-3.0-i386.gz
module /vmlinuz-2.6.16-2-xen-686 root=/dev/hda3 ro
module /initrd.img-2.6.16-2-xen-686
And that was it. Thanks all for your good work!
Regards,
Torsten
[ Parent | Reply to this comment ]
> I'd guess that you have a seperate /boot partition?
> If so the images are relative to that - so the leading
> /boot isn't needed.
> If you have a single root, like I do, then you need it.
[ Parent | Reply to this comment ]
Funy! It shouldn't work, according to article #435. Or I missed something?
Actualy, it didn't work for me until I used vmlinuz-2.6.16-1-xen-686 instead of vmlinuz-2.6.16-2-xen-686.
Olivier
[ Parent | Reply to this comment ]
it worked from scratch:
xen01:~# ls -als /boot/vmlinuz-2.6.16-2-xen-686
1175 -rw-r--r-- 1 root root 1196230 Jul 16 10:16 /boot/vmlinuz-2.6.16-2-xen-686
I since run 5 domU_s parallel on that machine.
regards,
Torsten
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
I'd be curious to see the output of "uname -a" on that machine, since I've not managed to get any of the -2- revisions of the packages working.
[ Parent | Reply to this comment ]
Linux xen01 2.6.16-2-xen-686 #1 SMP Sun Jul 16 05:56:53 UTC 2006 i686 GNU/Linux
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
Very strange - my version of xen just dies with that revision of the kernel.
[ Parent | Reply to this comment ]
I followed strictly the article except for the boot partition.
Torsten
[ Parent | Reply to this comment ]
My conclusion is "if it doesn't work from scratch, try the -1- kernel."
Olivier
[ Parent | Reply to this comment ]
I seems that the September packet linux-image-2.6.16-2-xen-686 from backports differs from the August packet linux-image-2.6.16-2-xen-686.
On a different machine I installed Sarge from the Scratch and tried to get linux-image-2.6.16-2-xen-686 from backports to work. But again the kernel crashes. The same was true for a fresh Etch installation with linux-image-2.6.16-2-xen-686.
I am sure the kernel linux-image-2.6.16-2-xen-686 works on some hardware configurations but not on mine any more. I tried it on a PC with a P4 Processor and on a HP Proliant DL 380 with a single Xeon 3.0Gz Prozessor. Through the ILO Port of the server I could capture some output before the system crashes. The kernel initializes two CPUs when there is actually only one CPU mounted the it crashes. I am not shure how many cores the Xeon 3.0 Gz has. But I think only one. This could be the reason why the system crashes.
[ Parent | Reply to this comment ]
# vi /etc/apt/sources.list deb http://snapshot.debian.net/archive pool linux-2.6 deb-src http://snapshot.debian.net/archive pool linux-2.6 # apt-get update # apt-get install linux-headers-2.6.16-1-xen linux-image-2.6.16-1-xen-k7 linux-modules-2.6.16-1-xen-k7
[ Parent | Reply to this comment ]
just installed on another machine and got the same problem as everybody else here now: It just crashed. Seems they updated the software without changing the version number. Seems xen needs to be more community driven to have a chance to stay professional enough.
[ Parent | Reply to this comment ]
Bye.
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
I did have a problem with udev from backports. It failed to set up, until I created /dev/pts by mkdir /dev/pts. Not hard, since the package complained that /dev/pts was not there, but it took me a while to figure it out!
For me, this is the definitive way to run xen at the moment (Debian packages in etch and sid are broken according to someone on xen-devel). It took me three days to get here, trying the other approaches...
Now happy,
Johannes
[ Parent | Reply to this comment ]
One with a 3ware Raid where Xen runs without problems.
On a similar maschine without the 3ware Raid Controller. (normal SATA)
Debian runs but not with the Xen Kernel.
Xen dom0 is not starting.....
My system restarts all 5 seconds.
There seems to be a problem when Xend starts.
I found comments on other websides about the problem.
It seems to help when you recompile the kernel.
The Problem is, i have never done this before.
Has somebody an idea?
[ Parent | Reply to this comment ]
apt-get install xen-linux-system-2.6.17-2-xen-686
which installed xen-hypervisor-3.0-unstable-1-i386 and that seemed to work.
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
I wanted to know if the xen-kernel has the driver for Realtek 8169 gigabit ethernet support.
It worked realy nice until I have noticed there was no xenbr0. So I changed in /etc/xen/xend-config.sxp
(network-script network-bridge)
(vif-script vif-bridge)
After this I restartet xend and boom I have lost the connection to my server. On my testmachine all was going well. But the big problem is, that no kernel on my server is going to boot well. And yes I used the "old" xen-kernel.
Hope somebody can help me.
[ Parent | Reply to this comment ]
lsb-base
apt-get install lsb-base/sarge-backport
Reading Package Lists... Done
Building Dependency Tree... Done
E: Release 'sarge-backport' for 'lsb-base' was not found
mkinitramfs doesnt' seem to be anywhere, except on unstable.
It's a well written page, too bad we can't use it.
Thanks,
Jim.
[ Parent | Reply to this comment ]
Jim
[ Parent | Reply to this comment ]
Is the k7 kernel only for the newer Athlons that have the 64 bit extensions? Is there something else I can use?
[ Parent | Reply to this comment ]
Hi,
On my Dell Inspiron 6400 with 2GB RAM and Intel Core 2 Duo, I've installed first Debian etch amd64, and now Xen.
Given that there is now a xen-linux-system-2.6.18-4-xen package in etch's repositories, I installed that and also the xenman package and the bridge-utils package.
When I then rebooted (without my adding anything to the /boot/grup/menu.lst file) the top-most item on what I'll call the GRUB screen was
Xen 3.0.3-1-amd64 / Debian GNU/Linux, kernel 2.6.18-4-xen-amd64
Booting with that, all went well - except that I have no internet connection! And the ifconfig -a command reveals that anyway my eth0 is gone!
This is true after rebooting the machine with or without (network-script network-bridge) in the /etc/xen/xend-config.sxp file. (The (vif-script vif-bridge) line was already not commented out so I've left it so.)
Also worrying: the response from the brctl show command looks incomplete (ie, there's nothing in the interfaces column).
bridge name bridge id STP enabled interfaces xenbr0 8000.000000000000 no
Is that what it should be? If so, shouldn't I anyway still have an internet connection when running xen? (If not, how can I, for example, keep my packages up-to-date on my dom0?)
Thanks for any answers.
[ Parent | Reply to this comment ]
I was trying to get this working on my new AMD64 systems, and was having trouble getting a usable initrd.
You're instructions had the missing link.
[ Parent | Reply to this comment ]