Comments

04/18/07: Xen on Debian Etch

Well, it looks like I may have jumped the gun with that Xen on Debian Sarge post. I guess I didn't realize that "Etch" had already gone stable. But hey...this is good news!
Now, with Etch, we have all the xen goodies we need right in the Debian repositories, and apt-getable (or aptitudeable, if you prefer). This will certainly make for a much more easily maintainable system, and it proved to be much easier to set up as well.

Most of what I did came from one of the howto's that were previously referenced in Xen on Debian Sarge, namely, The Perfect Xen 3.0.3 Setup For Debian Sarge, with a little from Xen from Backports on Debian Sarge. Just for the record, my system has a single NIC, and is set up to use the network-bridge method. This is probably the easiest way to get xen up and running initially, until you determine whether or not you need either of the other methods.

First, the installation of Debian Etch. I downloaded the "netinst" image from http://cdimage.debian.org/debian-cd/4.0_r0/i386/iso-cd/. I mainly accepted defaults for the most part, but I chose to set up my partitions manually as follows (from The Perfect Xen 3.0.3 Setup):

  • boot 100 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)

  • / 2GB (Logical) (Location for the new partition: Beginning) (ext3)

  • /vserver the rest (Logical) (Location for the new partition: Beginning) (ext3)


...with one exception. Instead of /vserver, I set up the rest of the disk as a LVM physical volume, and created a volume group named vserver.

Next came package selection. The default selections are Desktop Environment and Standard System. I unselected Desktop Environment and continued, and before long, the base system was installed.

First thing after the reboot, keeping in line with The Perfect Xen 3.0.3 Setup, I set up my static IP address in /etc/network/interfaces, like so:

iface eth0 inet static
address 192.168.1.254
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.2


Then the hostname:

# echo host.domain > /etc/hostname
# /bin/hostname -F /etc/hostname


I then ran the following commands, as indicated in The Perfect Xen 3.0.3 Setup:

# apt-get remove exim4 exim4-base lpr nfs-common portmap pidentd pcmcia-cs pppoe pppoeconf ppp pppconfig
# apt-get install iproute bridge-utils python-twisted gcc-3.3 binutils make zlib1g-dev python-dev transfig bzip2 screen ssh debootstrap libcurl3-dev libncurses5-dev x-dev


...and this is where I departed from The Perfect Xen 3.0.3 Setup. With Etch, this becomes possible:

# apt-get install xen-linux-system-2.6.18-4-xen-686 xen-tools


...which installs all necessary files for running xen and creating images.
When the installation was finished, I had to make a couple of changes to the default /etc/xen/xend-config.sxp file (This from Xen from Backports on Debian Sarge):

uncomment (network-script network-bridge)
comment (network-script network-dummy)
and
(vif-script vif-bridge) should already be uncommented.


Then, reboot.

To create images, I first had to edit the /etc/xen-tools/xen-tools.conf file. I uncommented lvm = and entered vserver to match my lvm volume group, uncommented debootstrap = 1, changed the default distribution to etch, and changed some of the default size and memory components.

After this, a new xen image can be created with a single command:

# xen-create-image --hostname=newimage.domain --ip=192.168.1.200


One last thing. This bugged the hell out of me until I went searching for the answer. The xendomains init script is supposed to save the virtual machines when shutting down the server, but for some reason, it wasn't working.
I found the answer here. Apparently, when xendomains is parsing the virtual machine hostnames, it was only set to read 17 characters, so with my fully qualified domain names being longer than 17 characters, it was messing everything up.
Hats off to Petter Reinholdtsen for coming up with this patch:

--- /etc/init.d/xendomains.orig 2007-03-10 14:40:09.000000000 +0100
+++ /etc/init.d/xendomains 2007-03-10 14:40:21.000000000 +0100
@@ -128,9 +128,9 @@

parseln()
{
- name=`echo "$1" | cut -c0-17`
+ name=`echo "$1" | cut -c0-25`
name=${name%% *}
- rest=`echo "$1" | cut -c18- `
+ rest=`echo "$1" | cut -c26- `
read id mem cpu vcpu state tm < <(echo "$rest")
}

After these 2 changes, everything is happy. My most painless xen install to date :)

Comments made

No comments yet

Add comment

:

:
: