Differences between revisions 46 and 47
Revision 46 as of 2008-06-17 10:58:34
Size: 8467
Editor: TzafrirCohen
Comment: Answer an FAQ about Xen in Lenny. Someone please fill in the details :-(
Revision 47 as of 2008-07-17 00:03:13
Size: 7554
Editor: ?BenFirshman
Comment: up to date xen information
Deletions are marked like this. Additions are marked like this.
Line 25: Line 25:
Debian 4.0 (etch) was released with the `-2.6.18-4` packages.

You can get a list of all `xen-linux-system` packages with a command such as `apt-cache -n search xen-linux-system`, or by consulting DebPkg:xen-linux-system. The following packages are currently available:

|| xen-linux-system-2.6.18-4-xen-686 || etch (stable) || i386 ||
|| xen-linux-system-2.6.18-4-xen-vserver-686 || etch (stable) || i386 ||
|| xen-linux-system-2.6.18-4-xen-amd64 || etch (stable) || amd64 ||
|| xen-linux-system-2.6.18-4-xen-vserver-amd64 || etch (stable) || amd64 ||
|| xen-linux-system-2.6.18-5-xen-686 || testing/unstable || i386 ||
|| xen-linux-system-2.6.18-5-xen-vserver-686 || testing/unstable || i386 ||
|| xen-linux-system-2.6.18-5-xen-amd64 || testing/unstable || amd64 ||
|| xen-linux-system-2.6.18-5-xen-vserver-amd64 || testing/unstable || amd64 ||
The two xen-linux-system packages of interest are DebPkg:xen-linux-system-2.6.18-6-xen-686 and DebPkg:xen-linux-system-2.6.18-6-xen-amd64. Install the correct one for your architecture.
Line 41: Line 30:
 * The easiest way to get this done is to use DebPkg:xen-tools (and, if this doesn't do what you need, Steve Kemp is keen and fast in implementing useful suggestions).
 * The next well tested and working way is to create a domU filesystem from a dom0 by following
''Installing Debian GNU/Linux from a Unix/Linux System'' ( [http://www.debian.org/releases/stable/i386/apds03.html] ) ; - and adding some tweaks which are necessary to get a Xen guest run properly - mainly adjusting inittab and installing libc6-xen, and probably the kernel modules needed by the kernel you want to run for the domU.
The easiest way to create a domU is to use DebPkg:xen-tools (and, if this doesn't do what you need, Steve Kemp is keen and fast in implementing useful suggestions).
Line 45: Line 32:
When not using xen-tools (which takes some decisions out of your hand, by giving you a in some ways very flexible, but in some others not easily changeable installation path), you have to decide some things: If you do not wish to use xen-tools, follow [http://www.debian.org/releases/stable/i386/apds03.html this alternative guide].
Line 47: Line 34:
 * If you want to use pygrub (a grub clone written in python and running on the Dom0): install a Xen kernel. Get a list with `apt-cache -n search linux-image-xen`.
 * If you want to use a kernel image in the Dom0: install the matching modules. Get a list with `apt-cache -n search linux-modules`.
 * On i386, install DebPkg:libc6-xen.
 * If you want a not ported operating system (Windows..), you go for the so-called HVM mode, and you will have to install `xen-ioemu-3.0.3-1`
Xen boots domUs using kernels stored on dom0, so you only need to install the corresponding linux-modules package in the domU. Alternatively, you can use pygrub to boot kernels on the domU filesystem (is there documentation for this?).
Line 52: Line 36:
= Installation on sid/testing = On i386, make sure you install DebPkg:libc6-xen.
Line 54: Line 38:
Need to explain the procedure, since there ain't the same set of packages ATM with kernel 2.6.21 = Installation on lenny =
== Dom0 (host) ==
Critically, there are no dom0 kernels included in lenny. You can either use etch as dom0 and run lenny domUs, or use the xen-hypervisor packages included in lenny (DebPkg:xen-hypervisor-3.2-1-i386 and DebPkg:xen-hypervisor-3.2-1-amd64) along with an the etch [http://packages.debian.org/etch/linux-image-xen-686 linux-image package].
Line 56: Line 42:
== Lenny ==
Lenny kernels do not have XEN Dom0 support. At the moment it seems unlikely there will be any in time for Lenny's freeze.
== DomU (guest) ==
The instructions for etch also apply for lenny: xen-tools can create a lenny domU.

The default lenny kernel is the newer paravirt_ops version (currently 2.6.25), which does not function as a dom0. It will also not support PCI passthrough in a domU. For PCI passthrough, you have to run the 2.6.18 etch kernel as both dom0 and domU.

?TableOfContents(2)

Xen Overview

Modern computers are sufficiently powerful to use virtualization to present the illusion of many smaller virtual machines (VMs), each running a separate operating system instance. Successful partitioning of a machine to support the concurrent execution of multiple operating systems poses several challenges. Firstly, virtual machines must be isolated from one another: it is not acceptable for the execution of one to adversely affect the performance of another. This is particularly true when virtual machines are owned by mutually untrusting users. Secondly, it is necessary to support a variety of different operating systems to accommodate the heterogeneity of popular applications. Thirdly, the performance overhead introduced by virtualization should be small.

Xen is a virtual machine monitor for x86 that supports execution of multiple guest operating systems with unprecedented levels of performance and resource isolation. Xen is Open Source software, released under the terms of the GNU General Public License. We have a fully functional ports of Linux 2.6 running over Xen, and regularly use it for running demanding applications like MySQL, Apache and PostgreSQL. Any Linux distribution (RedHat, SuSE, Debian, Mandrake) should run unmodified over the ported OS.

In addition to Linux, members of Xen's user community have contributed or are working on ports to other operating systems such as NetBSD (Christian Limpach), FreeBSD (Kip Macy) and Plan 9 (Ron Minnich).

It is also possible to run some other, not ported, operating systems if your CPU has hardware virtualization support (VT or Pacifica).

Installation on etch

Upstream documentation can be found in the xen-docs-3.0 package (in /usr/share/doc/xen-docs-3.0/user.pdf.gz). It's also available [http://www.cl.cam.ac.uk/research/srg/netos/xen/readmes/user/user.html online].

Dom0 (host)

  • Choose and install a xen-linux-system-KERNELVERSION package. This installs the kernel, a hypervisor and matching utilities.

  • On i386, install libc6-xen. This means that you don't have to delete /lib/tls or move it out of the way, as suggested by most Xen guides.

  • Use Grub as bootloader (since Lilo and Xen don't play well with one another)
  • You probably want to configure /etc/xen/xend-config.sxp (especially the network-script scheme).
  • You may find the xen-tools package helpful. It is a set of scripts to manage guest Xen domains that run Debian/Ubuntu/CentOS. More information and examples at http://xen-tools.org/software/xen-tools/.

The two xen-linux-system packages of interest are xen-linux-system-2.6.18-6-xen-686 and xen-linux-system-2.6.18-6-xen-amd64. Install the correct one for your architecture.

If you need to apply some modifications to the kernel with the xen patch, then one way to do it is described ?DebianKernelCustomCompilation.

DomU (guests)

The easiest way to create a domU is to use xen-tools (and, if this doesn't do what you need, Steve Kemp is keen and fast in implementing useful suggestions).

If you do not wish to use xen-tools, follow [http://www.debian.org/releases/stable/i386/apds03.html this alternative guide].

Xen boots domUs using kernels stored on dom0, so you only need to install the corresponding linux-modules package in the domU. Alternatively, you can use pygrub to boot kernels on the domU filesystem (is there documentation for this?).

On i386, make sure you install libc6-xen.

Installation on lenny

Dom0 (host)

Critically, there are no dom0 kernels included in lenny. You can either use etch as dom0 and run lenny domUs, or use the xen-hypervisor packages included in lenny (xen-hypervisor-3.2-1-i386 and xen-hypervisor-3.2-1-amd64) along with an the etch [http://packages.debian.org/etch/linux-image-xen-686 linux-image package].

DomU (guest)

The instructions for etch also apply for lenny: xen-tools can create a lenny domU.

The default lenny kernel is the newer paravirt_ops version (currently 2.6.25), which does not function as a dom0. It will also not support PCI passthrough in a domU. For PCI passthrough, you have to run the 2.6.18 etch kernel as both dom0 and domU.

Installation on sarge (oldstable)

Most of the above packages seem to be present on http://backports.org/, so use them!

libc6-xen is not present. [http://saintaardvarkthecarpeted.com/blog/?p=182 Allegedly], creating the file /etc/ld.so.nohwcap will cause libraries in /lib/tls to be ignored, thus making it unnecessary to move the directory out of the way. Can anyone confirm this?

  • {i} This is a Debian-specific feature. Other guest operating systems will still require /lib/tls to be removed/renamed.

Using Debian-Installer

The page ["DebianInstaller/Xen"] contains instructions on how to install Xen Dom0 and DomU with ["DebianInstaller"].

Package maintenance

Debian's Xen packages are maintained by the [http://alioth.debian.org/projects/pkg-xen/ pkg-xen] project. ([http://lists.alioth.debian.org/mailman/listinfo/pkg-xen-devel developpers' mailing list])

The [http://qa.debian.org/developer.php?login=pkg-xen-devel@lists.alioth.debian.org Debian Developer's Package Overview] page lists source packages that are maintained by the team.

Common Errors

dom0 automatic reboots

  • {i} Note: if Xen is crashing and reboot automatically, you may want to use noreboot xen option, to prevent it from rebooting automatically. Grub example :

    title           Xen 3.1-1-i386 / Debian GNU/Linux, kernel 2.6.18-5-xen-686
    root            (hd0,0)
    kernel          /xen-3.1-1-i386.gz noreboot
    module          /vmlinuz-2.6.18-5-xen-686 root=/dev/foo ro console=tty0
    module          /initrd.img-2.6.18-5-xen-686

error : CDROM boot failure

You get the error :

  • CDROM boot failure code 0002
    or CDROM boot failure code 0003
    Boot from cd-Rom failed
    Fatal: Could not read the boot disk.

That's because Xen can't boot from a cdrom iso image at the moment. i.e you can't have tap:aio:/path/to/mycd.iso,hdc:cdrom,r or file:/path/to/mycd.iso,hdc:cdrom,r.

Workaround: use losetup to create a loopback device for the cdrom ISO image, then use it in Xen configuration file. for example :

  • #First, check which loop device is free
    $losetup -f
    /dev/loop9
    
    #Then create a loopback device
    $losetup -f /path/to/mycd.iso
    
    losetup /dev/loop9
    /dev/loop9: [fe04]:3096598 (/path/to/mycd.iso)

Now you can use /dev/loop9 in xen configuration file (/etc/xen/foobar.cfg) :

  • ...
    disk = [ 'phy:/dev/vg1/xpsp3,ioemu:hda,w', 'phy:/dev/loop/0,ioemu:hdc:cdrom,r' ]
    ...

then boot/install the guest OS.

note: yo should switch back to the tap:aio:/path/to/mycd.iso,hdc:cdrom,r syntax after installation, since loop back have to be recreated after you reboot the host system.

Resources