etch or 4.0 is an obsolete Debian release that doesn't have security or any other kind of support. Use newer releases!
This information is preserved only for completeness
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 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).
The xen-linux-system packages of interest are (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.
Serial console access
To get output from grub, XEN, the kernel and getty (login prompt) via both vga and serial console to work, here's an example of the right settings when using etch kernels and Xen 3.0.3:
In /boot/grub/menu.lst:
serial --unit=0 --speed=9600 --word=8 --parity=no --stop=1 terminal --timeout=5 serial console [...] title Xen 3.0.3-1-i386-pae / Debian GNU/Linux, kernel 2.6.18-6-xen-686 root (hd0,0) kernel /boot/xen-3.0.3-1-i386-pae.gz com1=9600,8n1 console=com1,vga module /boot/vmlinuz-2.6.18-6-xen-686 root=/dev/md0 ro console=tty0 console=ttyS0,9600n8 module /boot/initrd.img-2.6.18-6-xen-686
In /etc/inittab you need at least these lines:
1:2345:respawn:/sbin/getty 38400 tty1 T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
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, you could use this alternative guide, to setup the system using debootstrap.
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.
On i386, make sure you install libc6-xen.
If you install lenny domU on etch dom0, make sure you read this entry on XenFaq when you see messages on the console like 4gb seg fixup, process klogd (pid 2075), cs:ip 73:b7e25870. After applying the echo 'hwcap 0 nosegneg' > /etc/ld.so.conf.d/libc6-xen.conf && ldconfig, in the dom0 system, reboot, or, if you don't like rebooting (which requires you to stop domU's), restart all processes mentioned in the log messages (e.g. /etc/init.d/ssh restart, init q, etc..)
Notes on kernel version compatibility
In general:
- dom0 works on kernels 2.6.18 from Etch, but not with kernel 2.6.24 from Etch-n-half!
- domU should work with both kernels 2.6.18 and 2.6.24
- an Etch dom0 with 2.6.18-*-xen can only run 32-bit domU when it's i386 itself
- a 64-bit Etch dom0 using the amd64 kernel can run a 64-bits domU
a 64-bit Etch dom0 can also run a 32-bit domU, but only when using the amd64-kernel and a 32-bit userland!
For those who want to test the 2.6.32 kernel domU on an earlier dom0, you have to make sure that the xen-blkfront domU driver is loaded, and can find the root and other disk partitions. This is no longer the case if you still use the deprecated hda* or sda* device names in domU .cfg files. Switch to xvda* devices, which also work with 2.6.18 and 2.6.26 dom0 kernels.
There are also the backward-looking options:
Use DebianLenny's 2.6.26, which has forward-ported Xen 2.6.18 dom0 kernel code
Use custom 2.6.30 kernels with forward-ported Xen 2.6.18 dom0 kernel code, see
http://lists.alioth.debian.org/pipermail/pkg-xen-devel/2009-July/002356.html