The Perfect Xen 3.1.0 Setup For Debian Etch (i386)

Version 1.0
Author: Falko Timme
Last edited 05/30/2007

This tutorial provides step-by-step instructions on how to install Xen (version 3.1.0) on a Debian Etch (4.0) system (i386).

Xen lets you create guest operating systems (*nix operating systems like Linux and FreeBSD), so called "virtual machines" or domUs, under a host operating system (dom0). Using Xen you can separate your applications into different virtual machines that are totally independent from each other (e.g. a virtual machine for a mail server, a virtual machine for a high-traffic web site, another virtual machine that serves your customers' web sites, a virtual machine for DNS, etc.), but still use the same hardware. This saves money, and what is even more important, it's more secure. If the virtual machine of your DNS server gets hacked, it has no effect on your other virtual machines. Plus, you can move virtual machines from one Xen server to the next one.

I will use Debian Etch (i386) for both the host OS (dom0) and the guest OS (domU). I will describe how to install Xen from the binary package in chapter 5 and from the sources (chapter 5). In an additional section at the end of chapters 4 and 5 I will also show how to create a virtual local network with virtual machines, with dom0 being the router. Chapters 4 and 5 are mutually exclusive.

This howto is meant as a practical guide; it does not cover the theoretical backgrounds. They are treated in a lot of other documents in the web.

This document comes without warranty of any kind! I want to say that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!

A note on x86_64 systems: I tried to install Xen 3.1.0 on Debian Etch AMD64 as well, but regardless of the method (Xen source install vs. Xen x86_64 binary install), the Xen kernel didn't boot (no error messages, but the boot process was incredibly slow and never finished...).


1 Install The Debian Etch Host System (dom0)

You can overall follow these instructions, but with a few changes:

dom0's FQDN in this example will be, so I specify server1 as Hostname and as Domain name.'s IP address will be in this tutorial.

When it comes to the partitioning, I select Manual. I create the following partitions:

  • /boot 150 MB (Primary) (Location for the new partition: Beginning) (ext3) (Bootable flag: on <-- important, otherwise your system will not boot!)
  • swap 1GB (Logical) (Location for the new partition: Beginning)
  • / 3GB (Logical) (Location for the new partition: Beginning) (ext3)
  • /vserver the rest (Logical) (Location for the new partition: Beginning) (ext3)

When the Debian installer prompts Choose software to install: I make no selection and go on (dom0 should run as few software as possible in order not to be vulnerable to attacks. To the outside world it will be accessible only over SSH.).


2 Preparation Of The Host System

After the base system has been installed and you have removed the installation CD and booted the base system, you should run

apt-get install ssh openssh-server vim-full

to install an SSH server so that you can connect to the system with an SSH client such as PuTTY. The vim-full package makes sure that the vi text editor behaves as expected (without vim-full, you might experience some strange behaviour in the vi text editor).

Because the Debian Etch installer has configured our system to get its network settings via DHCP, we have to change that now because a server should have a static IP address. Edit /etc/network/interfaces and adjust it to your needs (in this example setup I will use the IP address

vi /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
#allow-hotplug eth0
#iface eth0 inet dhcp
auto eth0
iface eth0 inet static

Then restart your network:

/etc/init.d/networking restart

Then edit /etc/hosts. Make it look like this:

vi /etc/hosts       localhost.localdomain   localhost     server1

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

Edit /etc/resolv.conf and add some nameservers:

vi /etc/resolv.conf


Now run

echo > /etc/hostname

and reboot the system:

shutdown -r now

Afterwards, run

hostname -f

Both should show

From now on you can use an SSH client such as PuTTY and connect from your workstation to your Debian Etch server and follow the remaining steps from this tutorial.

Edit /etc/apt/sources.list. Comment out the CD. It should look like this:

vi /etc/apt/sources.list

# deb cdrom:[Debian GNU/Linux 4.0 r0 _Etch_ - Official i386 NETINST Binary-1 20070407-11:29]/ etch contrib main

#deb cdrom:[Debian GNU/Linux 4.0 r0 _Etch_ - Official i386 NETINST Binary-1 20070407-11:29]/ etch contrib main

deb etch main
deb-src etch main

deb etch/updates main contrib
deb-src etch/updates main contrib

Then run

apt-get update

to update the apt package database and

apt-get upgrade

to install the latest updates (if there are any).


3 Install Xen

There are two ways to install Xen: install the binary package from the Xen website, or compile Xen and the Xen kernels from the sources.

The first way is easier. In my past Xen tutorials I always recommended to compile Xen from the sources because some features such as quota or iptables were missing in the binary package. This has changed now, so you will most likely find all needed features in the binary package, so I recommend to install the binary package. If you want to be in full control of what features are in the Xen kernel or if you need a special feature that's not in the binary package, you should compile Xen from the sources.

In chapter 4 I describe how to install the Xen binary package which might be easier for beginners. In chapter 5 I describe how to compile and install Xen from the sources. Chapters 4 and 5 are mutually exclusive. Follow either chapter 4 or 5, but not both of them!

Share this page:

7 Comment(s)

Add comment


From: at: 2007-11-19 07:26:51

I installed xen from binary package in Debian Lenny (amd64) according your notes and everything is fine.

The only problem was initrd, where my Raid partitions were not recognized on the boot and therefore the boot failed. The solution was using:

mkinitramfs -o /boot/initrd.img-2.6.18-xen 2.6.18-xen

instead of

mkinitrd.yaird -o /boot/initrd.img-2.6.18-xen 2.6.18-xen

From: at: 2007-09-07 19:32:07

Dear Author

please add the bcc package to your requirements. The hvmloader won´t be compiled without it. It took me an hour or so to discover the missing package.

Best Regards an thx for the Howto



From: at: 2007-10-26 22:33:58

 You say:

> Please make sure that you comment out the initrd line!

When I did this my LVM-based VM's wouldn't boot.

From: at: 2007-11-14 22:14:38


 I think there isa newer version of xen utils neccessary, because the XEN-3.1.0 Binary version seems to be to new ...

It also asked a lots of questions about replacing scripts when I installed xen utils via aptitude - and after rebooting it a secound time my xen bridge settings got lost and I wheren't able to start any virtual machine again.

There might be an update of the Howto neccessary ...



J. K. S.

From: at: 2007-06-21 10:00:34

some hints for compiling Xen 3.1:

if you wan't the VNC/SDL feature with HVM you need the following packages:

 libjpeg62-dev, libvncserver-dev,  libsdl1.2-dev

and you need to set the following var:

export XENFB_TOOLS=y

and maybe you miss hvmloader: you need the package bcc or it will just not compile.

To check build dependecies there is a nice script:

cd tools/check

./chk build

- Thomas 

PS: see also: 

From: at: 2007-07-17 16:31:24

If your root partition is on LVM you need to create an initrd for xen0 kernel as well, run: mkinitramfs -o /boot/initrd.img-2.6.18-xen0 2.6.18-xen0 before update-grub

From: at: 2007-11-01 05:16:08

It seems that the default bnx2 drivers in the Debian Etch kernel are malfunctioning with the network-bridge script in Xen 3.1.

For anyone having issues with the network-bridge and you are using broadcom nics (Dell PowerEdge, etc.) you should install the drivers found here:

Also check out this thread for some talk on the problem: