Debian Sid gets Xen 3.0
Posted by Steve on Mon 8 May 2006 at 07:21
Now that the Xen 3.0 packages have made it to Debians unstable distribution installation has become much more straightforward. Here we'll take a look at installing and getting started with it upon a generic unstable machine.
To start with we'll need to update our machine, so as root run:
apt-get update
Once you've got the most recent packages lists we can begin the work of installing the software properly. We'll need to install several packages:
- This is the hypervisor which will be booted by your machine.
- This is the kernel that will be used for the Xen host, and guest domains.
- These are the user-space utilities which are used for starting, stopping, and working with Xen domains.
- This is a version of the C runtime libraries which doesn't suffer from the slowdown under Xen of the normal ibc.
Since the host I'm running upon has less than a gigabyte of memory I can use the normal Xen package. (Install xen-hypervisor-3.0-i386-pae if you need more memory.)
root@steve:~# apt-get install xen-hypervisor-3.0-i386 xen-utils-3.0
Once installed your next step depends on whether you're happy with the default kernel available in the Debian repository, or whether you'd like to install a kernel from scratch. I usually prefer using stock kernels, unless I need some specific hardware support that isn't available, so I'll just choose the default imag:
root@steve:~# apt-get install linux-image-2.6.16-1-xen-686Kernel Package Problem
The Xen kernel packages currently available in unstable don't create an initrd image when they are installed, so they fail to boot.
Create one by running the following command after installing the kernel:
mkinitrd -o /boot/initrd.img-2.6.16-1-xen-686 2.6.16-1-xen-686(Adjust the type from 686 if you're using a different flavour of the kernel such as k7)
Now that the kernel is installed and we have an initrd image we need to setup our bootloader to use it. Add something like the following to your /boot/grub/menu.lst file:
title Xen 3.0 / XenLinux 2.6 kernel /boot/xen-3.0-i386.gz noreboot module /boot/vmlinuz-2.6.16-1-xen-686 root=/dev/hda1 ro module /boot/initrd.img-2.6.16-1-xen-686
At this point you might wish to adjust the network settings that Xen will use. The xend daemon is configured via the file /etc/xen/xend-config.sxp, and this is commented pretty thoroughly.
For typical use the following are sufficient:
(network-script network-bridge) (vif-script vif-bridge)
Uncomment those lines and comment out any other settings for vif-script and network-script.
We should now be able to install the minor support tools and reboot into our new system. Get them by running:
root@steve:~# apt-get install bridge-utils iproute sysfsutils libc6-xen xen-tools
All being well a reboot now should succeed and allow you to boot into your Xen system. If you have problems consult any open bugs against the Debian packages, and if that doesn't give you joy please consider describing your problem upon the xen-users mailing list.
Assuming that you've got your new system booted correctly we can continue and create a new guest domain using the installed package xen-tools.
Create a directory to contain your guest files:
mkdir /home/xen
Now edit the file /etc/xen-tools/xen-tools.conf to match your setup:
# # /etc/xen-tools/xen-tools.conf # dir = /home/xen size = 2Gb memory = 128Mb swap = 128Mb fs = ext3 dist = sarge gateway = 192.168.1.1 netmask = 255.255.255.0 passwd = 1 initrd = /boot/initrd.img-2.6.16-1-xen-686 kernel = /boot/vmlinuz-2.6.16-1-xen-686 mirror = http://ftp.uk.debian.org/debian/
Here I've stripped out comments, but you should find sufficient explanation included in the file. The important things to setup are:
- The path to the kernel to boot, and the initrd image to use.
- Your network gateway + netmask setup.
- The size of the images + memory you wish to allocate to freshly created Xen instances.
Once this is done you can create a new Xen guest image by executing the following command:
xen-create-image --hostname=test --ip=192.168.1.222 --passwd
Once the installation has finished, and you've been prompted to enter the new root password for the guest you can start the image by running:
xm create test.cfg -c
Press 'Ctrl+]' to exit from the console of the new system, and connect to it via SSH using the password specified when the image was created.
If you receive errors booting you might need to specify a ramdisk to the xen instance. Do that by editing the Xen configuration file /etc/xen/test.cfg and adding a line:
ramdisk = '/boot/initrd.img-2.6.16-1-xen-686'
The 1.4 release of xen-tools will do this for you automatically, however this might not have moved to sid yet.
Note: you don't need to use the xen-tools software to create new guest Xen domains. You can use debootstrap manually if you wish, or any other tools.
Has the xen code made it into the debian kernel source package? But what if I want to build a xen kernel with firmwares and other stuff that Debian rips out?
--
Anonimouse
[ Parent | Reply to this comment ]
https://alioth.debian.org/projects/pkg-xen/
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
I get the error: "Error: Device 2049 (vbd) could not be connected. Backend device not found.
Solution :
I've set "use-ide = 1" in /etc/xen-tools/xen-tools.conf and recreated my images and it seems to work now.
I figure that an IDE server has problems trying to run a SCSI domU.
Just to confirm, changing use-ide = 1 and changing my /etc/init.d/ xend to read:
start)
modprobe loop max_loop=64
cd /dev && /dev/MAKEDEV loop
xend start
await_daemons_up
;;
fixed my problems. I now have three domU's working happily.
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
somebody help me please!!!
(escuse my bad english)
[ Parent | Reply to this comment ]
eth0 Link encap:Ethernet HWaddr 00:12:3F:0E:CF:ED
inet addr:169.254.10.17 Bcast:169.254.255.255 Mask:255.255.0.0
lo Link encap:Local Loopback
peth0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
vif0.0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
xenbr0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
but nothing in my guest kernel..
Do I have to setup a DHCP server? I put --dhcp in the xen-create-domain command
Do I have to activate ip forwarding in the host kernel?
Thank you
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
If you specify --dhcp then yes you'll need a DHCP server...
IP forwarding shouldn't matter so long as you editted the xend-config.sxp appropriately.
[ Parent | Reply to this comment ]
I actually got the same issue, all the setup is working fine but none of the hosts is actually getting an IP. I did follow the setup by the book and i did uncomment these two lines in /etc/xen/xend-config.sxp :
(network-script network-bridge)
(vif-script vif-bridge)
I also gave one in the configuration file, here's an example : vif = ['ip = "160.6.1.39", bridge=xenbr0']
But right now, to be able to access the hosts, i have to boot them up and assign an IP address to them. What am I missing ?
Steph
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
You still need to configure the IP address details of the new host in /etc/network/interfaces - did you do that?
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
ps. the example you gave isn't correct:
vif = ['ip = "160.6.1.39", bridge=xenbr0']
You should have:
vif = ['ip=160.6.1.39,bridge=xenbr0']
(The quoting is different. Also note that the IP must be on the same range as your host/bridge.)
[ Parent | Reply to this comment ]
My only remaining issue (minor one that is) is that every node i boot back up come with the main Xen hostname.
Steph
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
Edit /etc/hostname on each new node - although if you're using xen-tools that should be handled automatically for you...
[ Parent | Reply to this comment ]
Steph
[ Parent | Reply to this comment ]
update-initramfs -c -k 2.6.16-1-xen-686
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
--
Debian GNU/Linux on an IBM Thinkpad T43p
[ Parent | Reply to this comment ]
nvidia: Unknown symbol xen_tlb_flush
Any ideas on what can be causing it and/or how to avoid it?
--------
Felipe Sateler
[ Parent | Reply to this comment ]
You'll have to use the open-source drivers that don't have 3D acceleration. Sorry, but there's not much you can do about this
[ Parent | Reply to this comment ]
--------
Felipe Sateler
[ Parent | Reply to this comment ]
but some of the package name shown in this guide cannot be found.
what sid repository can u recommend for use? my location is Asia, Philippines.
thanks!
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
My sources.list file just contains:
# # /etc/apt/sources.list # # Unstable deb http://ftp.uk.debian.org/debian sid main contrib non-free deb-src http://ftp.uk.debian.org/debian sid main contrib non-free
If there are newer packages the names might have changed, eg.linux-image-2.6.16-1-xen-686 might be -2-xen-686 by now.
Running "apt-cache search [terms]" will probably help in that case.
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
root@steve:~# apt-get install bridge-utils iproute sysfsutils libc6-xen xen-tools
Should be:
root@steve:~# apt-get install bridge-utils iproute sysfsutils libc6-xen xen-tools-3.0
Steve, confirm or deny?
--
|/usr/games/fortune
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
Deny.
The xen-tools package is my software and the package is called simply xen-tools.
It doesn't conflict with anything either, so I'm not sure about the parent comment. (Unless it is xen-utils + xen-utils-3.0 conflict, in which case the solution is to unstall xen-utils-3.0.)
[ Parent | Reply to this comment ]
Jason
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
You are right the Debian "xen" package is for Xen 2.x, you don't want that.
Instead you want the xen-utils-3.0 + xen-hypervisor-3.0 packages as explained in this article.
I'm suprised you're seeing this problem with the xen-tools package though, since "Recommends" is only a suggestion, not a required package. Personally I use apt-get and ignore the recommended packages most of the time. Just don't install the recommended package and you'll be fine.
If you're using something else which automatically installs recommended packages I'd regard that as broken ..
(For what it is worth the version of Xen-tools in sid now recommends 'xen' or 'xen-hypervisor-3.0' - so this shouldn't be an issue anymore.)
[ Parent | Reply to this comment ]
Jason
[ Parent | Reply to this comment ]
title Xen 3.0 / XenLinux 2.6 kernel /xen-3.0-i386.gz noreboot module /vmlinuz-2.6.16-1-xen-686 root=/dev/hda1 ro module /initrd.img-2.6.16-1-xen-686Hope that saves someone some frustration!
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
This is your grub setup I think.
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 ]
Steph
[ Parent | Reply to this comment ]
You'll need to stop your xen domUs first, then uninstall the xen packages. Be sure not to uninstall the xen-python libraries until after everything else is gone.
Don't forget to un-install all the debianbase.de packages, they don't all conflict with the new stuff, but may cause trouble down the road.
Now install all the new Sid Xen 3.0.2 packages,
At the same time: You need to upgrade to a non-Xen 2.6.16 when you upgrade udev. If you don't the Xen-2.6.16 won't work. The dev filesystem will never get populated correctly.
Once you have a working 2.6.16, you need to build an initrd for 2.6.16-xen. Don't use mkinitrd, it will NOT work. Use mkinitramfs-tools (ie: mkinitrafs-updaet -c -k 2.6.16-2-xen-686 ).
Setup your grub menu.lst with the new xen, dom0 kernel, and initrd, boot into 2.6.16-xen, where previously it would complain that it can't find dev/console this time it should work.
Now if you try to boot a domU it will fail with:
Error: Device 0 (vif) could not be connected. Hotplug scripts not working.
You need to link the xen-backend.rules file in /etc/udev from /etc/udev/rules.d
cd /etc/udev/rules.d ; ln -s ../xen-backend.rules xen-backend.rules
This will make the vif error go away, now you'll be getting cannot mount fs errors, unknown block device. This is because the initrd is now required for your domU to boot, so add this to your domU config file(s):
ramdisk = "/boot/initrd.img-2.6.16-2-xen-686"
or whatever would be appropriate.
Now your domU should happily boot. Weeeeeee!
Leeman
[ Parent | Reply to this comment ]
After problems with source installation of Xen I tried this way and it seems much easier.
I'm now on debootstrapping my hopefully working first xen domain. I had some problem with xen-create-image which had trouble when starting xt-install-image, and I didnt get a long time that I have to give an installation method.
Couldn't get that of your HowTo (and also not from the script :). Maybe a hint to that in your text would be fine. maybe :
xen-create-image --hostname=test --ip=192.168.1.222 --passwd --debootstrap
thanks, this text helped a lot,
greetz Adi
[ Parent | Reply to this comment ]
I am not sure what the policy is on this web site, but it would be usefull if a couple of suggestions done in the comments would be propagated to the main article. I just used the article to set up xen and ran into a couple of issues. I figured them out, made notes and found them all covered in the comments. It would be easier if just the article were needed.
The specific issues were:
- --debootstrap option to xen-create-image
- update-initramfs vs. mkinitrd
- /boot in menu.lst.
Still, this kind of article is of great help!
Regards,
Ruben
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
Comments tend to keep growing for weeks/months after the time an article was originally written, and it would be an insane amount of work to update the text to cover every problem/mistake noted in the comments.
Especially when some of the articles describe software which has moved on, (eg. Apache 1.3 -> Apache 2.x). There might not be a sensible way of handling that short of rewriting the article from scratch!
In short: Comments correcting mistakes and offering additional tips are very useful, but updating the article text isn't likely to occur unless a very glaring mistake is noticed early on.
(I'll always update reported typos, or spelling errors though.)
Regarding your points:
- --debootstrap - Can be setup in the configuration file, /etc/xen-tools/xen-tools.conf.
- /boot - Depends on your partition layout.
- update-initramfs vs. mkinitrd - Good point, and I should have mentioned both.
[ Parent | Reply to this comment ]
Thanks
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
If they're not listed in the configuration file for xen-tools they aren't supported by it - I assume that is what you mean?
You should be able to just "install into a file" using whatever means that system uses, and then start it up. Assuming Xen supports it of course.
Perhaps check the archives of the xen-users mailing list?
[ Parent | Reply to this comment ]
I've been following it to install Xen as of 2006/08/08 and I am having trouble when starting up the virtual machine. These are the last lines of the log:
Using IPI Shortcut mode
Freeing unused kernel memory: 144k freed
usbcore: registered new driver usbfs
usbcore: registered new driver hub
USB Universal Host Controller Interface driver v2.3
usbcore: registered new driver usbkbd
drivers/usb/input/usbkbd.c: :USB HID Boot Protocol keyboard driver
usbcore: registered new driver hiddev
usbcore: registered new driver usbhid
drivers/usb/input/hid-core.c: v2.6:USB HID core driver
mice: PS/2 mouse device common for all mice
SCSI subsystem initialized
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx
register_blkdev: cannot get major 8 for sd
/bin/cat: /sys/block/sda/dev: No such file or directory
Waiting 1 seconds for /sys/block/sda/dev to show up
/bin/cat: /sys/block/sda/dev: No such file or directory
Waiting 2 seconds for /sys/block/sda/dev to show up
/bin/cat: /sys/block/sda/dev: No such file or directory
Waiting 4 seconds for /sys/block/sda/dev to show up
/bin/cat: /sys/block/sda/dev: No such file or directory
Waiting 8 seconds for /sys/block/sda/dev to show up
/bin/cat: /sys/block/sda/dev: No such file or directory
Waiting 16 seconds for /sys/block/sda/dev to show up
/bin/cat: /sys/block/sda/dev: No such file or directory
Device /sys/block/sda/dev seems to be down.
Debugging opportunity, type ^D to continue.
/bin/dash: can't access tty; job control turned off
I am running it on an up to date Debian Sid i386. Root partition has ReiserFS, /home partition has XFS. I am using the kernel that comes in the Debian packages (as I have not been able to compile one myself) and I am using initrd on Grub and ramdisk on /etc/xen/test.cfg.
Any hints? Thanks in advance.
--
Jaume Sabater
http://linuxsilo.net/
"Ubi sapientas ibi libertas"
[ Parent | Reply to this comment ]
I get the error: "Error: Device 2049 (vbd) could not be connected. Backend device not found.
I am trying to follow the instructions in comment #17:
http://www.debian-administration.org/articles/396#comment_17
I have two Serial ATA devices in this computer, so I guess it could be the same problem.
--
Jaume Sabater
http://linuxsilo.net/
"Ubi sapientas ibi libertas"
[ Parent | Reply to this comment ]
Please have a look at http://cyril.bouthors.org/blog/index/2006/08/17/16-xen-lilo for more information.
Thanks
[ Parent | Reply to this comment ]
1. I didn't get any xenbr or vif interfaces, only eth0 and lo.
2. xend won't start. The message in /var/log/xen/xend.log says "[2006-11-20 13:54:48 xend 4457] ERROR (__init__:1072) Exception starting xend ((
111, 'Connection refused'))"
Any ideas?
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
# iptables -L modprobe: Can't open dependencies file /lib/modules/2.6.18-2-xen-686/modules.dep (No such file or directory) iptables v1.2.11: can't initialize iptables table `filter': iptables who? (do you need to insmod?) Perhaps iptables or your kernel needs to be upgraded.
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
Make sure you've copied the modules belonging to the kernel into the domU.
This error appears to be saying that /lib/modules/xxx in the domU doesn't have anything in it. Copy from the dom0.
[ Parent | Reply to this comment ]
xen1-test:~# iptables -L modprobe: QM_MODULES: Function not implemented modprobe: QM_MODULES: Function not implemented modprobe: Can't locate module ip_tables iptables v1.2.11: can't initialize iptables table `filter': iptables who? (do you needto insmod?) Perhaps iptables or your kernel needs to be upgraded. xen1-test:~# depmod -a depmod: QM_MODULES: Function not implemented xen1-test:~# logout
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
The only time I've seen that was when mixing 64bit dom0 and 32bit domU - since in that cases the modules didn't match.
If that isn't what you're I'd suggest reporting it on the xen-users mailing list, or searching google to see if there are any other obvious causes..
[ Parent | Reply to this comment ]
Thanks for putting up with my dumb questions.
[ Parent | Reply to this comment ]
greetings LeoLinux.de
[ Parent | Reply to this comment ]
I'm using debian etch
So I try to install xen on it using xen-tools
kernel version is 2.6.18-4 / w/t xen support /
so I made disk, installation and swap via xen-create-image --hostname blabla --ip x.x.x.x ......
it created me blabla.cfg in /etc/xen directory
so now i'm trying to use
xm create blabla.cfg -c and xen returns me:
Using config file "blabla.cfg".
Error: Device 0 (vif) could not be connected. Hotplug scripts not working.
What dos it mean this error ? vif is vurtial interface, but as it see in ifconfig there is no vifx.x. interfaces ...
So what shall I do ?
Best Regards,
Georgi
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
You should look at the xen logs to see what the error is coming from, then report it upon the xen-users mailing list.
Most likely you've not changed /etc/xen/xend-config.sxp to be a bridge, or a routed setup..
[ Parent | Reply to this comment ]
I change it in xend-config.sxp
from bridge to route
now i receive another error :(
Using config file "blabla.cfg".
Error: Device 0 (vif) could not be connected. Hotplug scripts not working.
so I check in cfg file is it there ramdisk:
ramdisk = '/boot/initrd.img-2.6.18-4-xen-686'
and also i checked for link in /etc/udev/rules.d
z60_xen-backend.rules -> ../xen-backend.rules
so do you know other possible problem from this error ?
Best Wishes,
Georgi
[ Parent | Reply to this comment ]
[ Send Message | View Steve's Scratchpad | View Weblogs ]
I can't guess the reason for the error, no.
There are lots of things that could cause it. I'd suggest you look at /var/log/xen*.log - possibly after updating xend-config.sxp to increase the debug levels.
But here isn't the place to get Xen help. The xen-users mailing list is the correct place; people there will be much better able to help you.
[ Parent | Reply to this comment ]
[2007-06-28 13:02:48 xend.XendDomainInfo 10922] DEBUG (__init__:1072) XendDomainInfo.handleShutdownWatch
[2007-06-28 13:02:48 xend 10922] DEBUG (__init__:1072) Waiting for devices vif.
[2007-06-28 13:02:48 xend 10922] DEBUG (__init__:1072) Waiting for 0.
[2007-06-28 13:02:48 xend 10922] DEBUG (__init__:1072) hotplugStatusCallback /local/domain/0/backend/vif/21/0/hotplug-status.
[2007-06-28 13:04:28 xend.XendDomainInfo 10922] DEBUG (__init__:1072) XendDomainInfo.destroy: domid=21
[2007-06-28 13:04:28 xend.XendDomainInfo 10922] DEBUG (__init__:1072) XendDomainInfo.destroyDomain(21)
this is from xend.log
so in here there is no /local/domain/0/backend/vif/21/0/hotplug-status such file !!!
did you know what Xen looking for ?
BR,
Georgi
[ Parent | Reply to this comment ]
Thanks.
[ Parent | Reply to this comment ]