Xen Debian Installer

Un article de Bulles.
Aller à : navigation, rechercher

If, for whatever reason you want to install a Debian EtchDomU using a Debian Etch / Xen 3.1.0 Dom0 using the Debian Installer instead of the xen-tools, this article may help you...

Foreword

This articles describes how to install a Debian Etch DomU using the Debian Installer

We have here a Debian EtchDom0, but this could easily be extended to any Dom0, as we do not use the usual xen-tools

About the installer

The Debian installer does not know anything about Xen...

But the NetInstall CD Image just contains a kernel and an initrd, which in turn contains all the install procedure.

So basically we will run a standard xenified kernel with the netinstall initrd


Note: We are doing a 64-Bits install here, the kernel used is the vanilla Xen kernel, and the initrd is extracted from the mini.iso installer image


Disk allocation

We use a logical volume to allocate disk space for the virtual machine:

Code: shell
lvcreate  -L 10240 -n sixty-four vgXen 

It will be used as Disk Image (xvd) by the virtual machine. This gives more flexibility to the guest than individual partitions (hd), and makes the boot process easier (see below).

Xen DomU Configuration file

This is the minimal configuration file that we will use for this installation:

Fichier: /etc/xen/sixty-four.cfg

#  -*- mode: python; -*-
#============================================================================
# Python configuration setup for 'xm create'.
# This script sets the parameters used when a domain is created using 'xm create'.
# You use a separate script for each domain you want to create, or
# you can set the parameters for the domain on the xm command line.
#============================================================================

#----------------------------------------------------------------------------
# Kernel image file.
bootloader="/usr/bin/pygrub"

# Initial memory allocation (in megabytes) for the new domain.
memory = 512

# A name for your domain. All domains must have different names.
name = "sixty-four"

#----------------------------------------------------------------------------
# Define network interfaces.
vif = [ 'ip=xxx.xxx.xxx.xxx,mac=yy:yy:yy:yy:yy:yy,bridge=xenloc0' ]

#----------------------------------------------------------------------------
# Define the disk devices you want the domain to have access to, and
# what you want them accessible as.
# Each disk entry is of the form phy:UNAME,DEV,MODE
# where UNAME is the device, DEV is the device name the domain will see,
# and MODE is r for read-only, w for read-write.
disk = [ 'phy:/dev/vgDomU/sixty-four,xvda,w' ]

#----------------------------------------------------------------------------
# Define frame buffer device.
# vfb = ["type=vnc,vncunused=1"]
keymap = 'fr-be'

#----------------------------------------------------------------------------
# Configure the behaviour when a domain exits.  There are three 'reasons'
# for a domain to stop: poweroff, reboot, and crash.
on_poweroff = 'destroy'
on_reboot   = 'restart'
on_crash    = 'restart'

#============================================================================

The interresting aspect of using pygrub as bootloader instead of specifying a kernel and a ramdisk is that the linux kernel will be taken from the DomU virtual machine and not from the Dom0 host. Obviously we will have to override that during the installation.

Installation

Booting

To avoid the text-mode-in-console, we use the Xen Virtual Frame Buffre (vfb), so we need to tell the kernel:

Code: shell

LinuxRC="xencons=ttyS0 video=xenfb"

We also override the bootloader directive and specify the installation kernel.
We also need to ask for a destroy at reboot time, otherwise the virtual machine would re-enter the installation procedure when done!

Code: shell

XmCreate="bootloader= \
            kernel=/boot/debian-etch-amd64/vmlinuz-2.6.18-xen \
            ramdisk=/boot/debian-etch-amd64/initrd-netinst.gz \
            on_reboot=destroy"

We start the installation with the following incantation:

Code: shell

xm create /etc/xen/sixty-four.cfg \
          ${XmCreate} \
          vfb='type=vnc,vncunused=1' \
          extra="${LinuxRC}"

We start xvncviewer to access the install console -- e.g.:

Code: shell

xvncviewer -via <Dom0> :1

Installing

We are now in the (text-mode / graphical) installer.
We will be asked for the language, timezone...

The machine will find the packages and proceed with the installation just like on a bare metal system.

Attention: There are a couple of things we need to know:
  1. The vanilla Xen kernel does not have ext3 built-in, so we need to create ext2 filesystems
  2. Etch Debian Grub does not like xvd as device name, so you will not be able to install Grub without recompiling the package.
    There is no issue with Debian Lenny
  3. No Xen kernel is installed by default, so at the end of the installation, ask a shell, chroot the installed system and install the xen kernel.

Reboot

At the end of the installation, the system reboots and you are back at the command prompt of your Dom0 host.

Since we specified the on_reboot=destroy parameter, we need to restart the virtual machine, using this time only the parameters from the configuration file:

Code: shell
xm create /etc/xen/sixty-four.cfg  *** TBD*** 

After the pygrub boot screen the system will start, ask a couple of post-install questions and we are done!

Post Install

ToDo