Elite software development.

Using Xen With Debian Lenny on 64-bit AMD To Emulate (Paravirtually) 32-bit IA32, Part 1

This is an elided log of my installation of Xen in which I omit mentioning the many wrong paths that I took.

Started with functioning Debian 5.0.2 stable installed on a box with AMD Athlon X2 Dual Core 64-bit processor with virtualization technology.

Installed

Invoked:

; apt-get install xen-linux-system-2.6.26-1-xen-amd64

This command did a lot of work. It installed a Xen 3.2 kernel, installed many dependent packages, and automatically updated Grub's menu.

Rebooted the box. Saw that Grub indeed had menu items added to it, including the option to boot a Xen kernel. Chose that. After booting, 'uname -r' returned '2.6.26-1-xen-amd64'. Other apps, specifically 'sshd', appeared to work.

Tweaked

Opened '/etc/modules' and appended 'max_loop=64' to the 'loop' line; saved.

Made changes to '/etc/xen/xend-config.sxp'. The following line was commented out:

(network-script network-dummy)

The following line was uncommented.

# (network-script network-bridge)

So, those lines then appeared as:

(network-script network-bridge)
#(network-script network-dummy)

Rebooted.

Created Images With Xen-Tools

Installed xen-tools with:

; apt-get install xen-tools

Issued:

; mkdir /home/xen

First Image, dom1

Made the following changes to '/etc/xen-tools/xen-tools.conf'.

...
dir = /home/xen
...
dist = lenny     # Default distribution to install.
...
dhcp = 1
...
passwd = 1
...
arch = amd64
...

Created the '/etc/xen/dom1.cfg' file with:

xen-create-image --hostname=dom1 --role=udev

The output of the above was:

General Information
--------------------
Hostname       :  dom1
Distribution   :  lenny
Partitions     :  swap            1Gb   (swap)
                  /               20Gb  (ext3)
Image type     :  sparse
Memory size    :  512Mb
Kernel path    :  /boot/vmlinuz-2.6.26-1-xen-amd64
Initrd path    :  /boot/initrd.img-2.6.26-1-xen-amd64

Networking Information
----------------------
IP Address     : DHCP [MAC: 00:16:3E:14:C2:E8]


Creating partition image: /home/xen/domains/dom1/swap.img
Done

Creating swap on /home/xen/domains/dom1/swap.img
Done

Creating partition image: /home/xen/domains/dom1/disk.img
Done

Creating ext3 filesystem on /home/xen/domains/dom1/disk.img
Done
Installation method: debootstrap
Done

Running hooks
Done

Role: udev
	File: /etc/xen-tools/role.d/udev
Role script completed.

Creating Xen configuration file
Done
Setting up root password
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
All done


Logfile produced at:
	 /var/log/xen-tools/dom1.log

The file '/etc/xen/dom1.cfg' had the following contents:

#
# Configuration file for the Xen instance dom1, created
# by xen-tools 3.9 on Fri Jul 17 23:02:46 2009.
#

#
#  Kernel + memory size
#
kernel      = '/boot/vmlinuz-2.6.26-1-xen-amd64'
ramdisk     = '/boot/initrd.img-2.6.26-1-xen-amd64'
memory      = '512'

#
#  Disk device(s).
#
root        = '/dev/sda2 ro'
disk        = [
                  'file:/home/xen/domains/dom1/swap.img,sda1,w',
                  'file:/home/xen/domains/dom1/disk.img,sda2,w',
              ]


#
#  Hostname
#
name        = 'dom1'

#
#  Networking
#
dhcp        = 'dhcp'
vif         = [ 'mac=00:16:3E:14:C2:E8' ]

#
#  Behaviour
#
on_poweroff = 'destroy'
on_reboot   = 'restart'
on_crash    = 'restart'


Started the image:

; xm create /etc/xen/dom1.cfg 
Using config file "/etc/xen/dom1.cfg".
Started domain dom1

Issued 'xm list' and obtained:

Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0  1359     2     r-----    274.2
dom1                                         4   512     1     -b----      2.8

I was able to 'ssh root@10.0.1.5' and log in to 'dom1'.

Now, see Part II of this article.

References