Unbreakable Xen

Un article de Bulles.

This article summarizes the major steps to install Unbreakable Linux as DomU using a Debian Etch / Xen 3.1.0 Dom0 as described in this Xen article.

Sommaire

Foreword

I wanted to install an Unbreakable Linux virtual machine on top of my Xen 3.1.0 hypervisor with a Debian Etch Dom0.

I am unfamiliar with Unbreakable Linux, and I could not find a clear guidance on how to proceed.

Most of the articles available on the web are describing homogeneous environments where the Dom0 and the DomU machines are running the same Linux flavour.

The rpm-based distributions are using the Virtual Machine Manager but it is not available under Debian; on the other hand, the Xen-tools are rpm-aware, but they are based on rpmstrap: there is support for Unbreakable Linux or RedHat...

It remains the manual option, which is really easy, but not very well documented; so hopefully this article will help some other lost souls...

I describe an Unbreakable Linux - Enterprise Linux 5 installation, but obviously it applies to Red Hat Enterprise Linux 5 and CentOS 5 as well.

About the installer

Although it is not related to Xen, it is important to understand how the install process works.
There are roughly 2 major steps:

  1. The kernel boots with its initial ramdisk. It will asks for the basic information: language, keyboard, source for packages and network configuration.
    This part of the install always uses a Text User Interface (TUI).
    This dialog can be completely bypassed by specifying the right information on the boot command line.
  2. The anaconda installer is then started to perform the actual installation (partitioning, packages selection, ...).
    Depending on your (virtual) hardware capabilities, anaconda will run either the TUI or the Graphical User Interface (GUI).
    If your hardware does not support a graphical installation, anaconda can spawn a VNC server so graphical installation is still possible!

This gives us 3 possibilities to install Unbreakable Linux on Xen:

  1. Text mode (TUI) from the Xen console. Probably not eye candy, but works fine.
  2. Graphical installation (GUI) from the Xen SDL/VNC console. anaconda will use the frame buffer driver and run the GUI.
    There are 2 things to consider though:
    • you must have the virtual frame buffer (vfb) compiled in Xen, and this is not the case if you use the XenSource binaries (see re-compile Xen article should you decide to recompile);
    • the mouse pointer management in the Xen/VNC server is not the best thing in the world as the local and the remote pointer easily get out of synch...
  3. Graphical installation (GUI) from the anaconda VNC server. This is my favorite: nice interface, no need to re-compile Xen and no hassle with the mouse pointer!
Attention: If you want to run anaconda in graphical mode, you need to configure enough memory for your virtual machine.

This is actually an odd behaviour: if you give 128MB to your virtual machine, you will get the message:

You do not have enough RAM to use the graphical installer.  Starting text mode.

But if you configure 256MB, the only thing you will see is:

Graphical installation not available...  Starting text mode.

I am not sure what the bare minimum is for a graphical install, but 320MB will give you the full monty.

Package repository

There is no way to install directly from the CD-ROM or ISO in para-virtualized mode (PVM), so you have to copy the files somewhere.
The installer can get its packages in several way, but the easiest in my view is via the web. So we copy the content of the 5 distribution CDs (or the DVD) on a web server. It can be done on the Dom0 system, but it does not really matter.
So we assume that the full distribution is available via http://<server>/unbreakable/

Kernel

To boot our virtual machine, we need a xenified installation kernel. This kernel is available on the Enterprise-R5-GA-Server-i386-disc1.iso CD or, more easily, on our new repository!

Code: shell
mkdir /boot/unbreakable-xen
cd /boot/unbreakable-xen
wget http://<server>/unbreakable/images/xen/vmlinuz
wget http://<server>/unbreakable/images/xen/initrd.img

Disk allocation

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

Code: shell
lvcreate  -L 20480 -n unbreakable vgDomU 

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/unbreakable.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 = 2048

# A name for your domain. All domains must have different names.
name = "unbreakable"

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

#----------------------------------------------------------------------------
# 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/unbreakable,xvda,w' ]

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

#----------------------------------------------------------------------------
# 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.

Note that Enterprise Linux keeps track of the network interface MAC address, and you will get warnings when it changes. So do not forget to specify a MAC address in the vif parameter to avoid the default one which is random.

Installation

This paragraph shows the different installations options: text based or graphical, Xen virtual frame buffer or Installer's VNC, or any combination of these.
The last option(#The easy way) is what I recommend.

Text Mode

To start the installation, we create the virtual machine:

Code: shell

xm create -c /etc/xen/unbreakable.cfg \
          bootloader= kernel=/boot/unbreakable/vmlinuz ramdisk=/boot/unbreakable/initrd.img \
          on_reboot=destroy

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

The system will boot, and when asked for the Installation Method, choose HTTP.
You will have to enter the network configuration (IP, ...) as well as the location of the package repository.

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

As we will use pygrub later on, we need to configure grub (just accept all defaults).

Note that the installer is smart enough to see it is running under Xen, and will select the appropriate kernel.

Be patient and after a while (depending the number of packages you choosed!), you will get:

Congratulations, your Enterprise Linux installation is complete.

Xen Virtual Frame Buffer

This is very similar to the text mode, we just have to enable the vfb:

Code: shell

xm create /etc/xen/unbreakable.cfg \
          vfb='type=vnc,vncunused=1' \
          bootloader= kernel=/boot/unbreakable/vmlinuz ramdisk=/boot/unbreakable/initrd.img \
          on_reboot=destroy

and start xvncviewer -- e.g.:

Code: shell

xvncviewer -via <Dom0> :1

We can now proceed as above. When the first part is completed, anaconda will switch in Graphical mode.

Installer's VNC

Just pass the vnc parameter to the installer:

Code: shell

xm create -c /etc/xen/unbreakable.cfg \
          bootloader= kernel=/boot/unbreakable/vmlinuz ramdisk=/boot/unbreakable/initrd.img \
          on_reboot=destroy \
          extra=vnc

The first part of the installer will be done in text mode, and when anaconda starts you will see:

The VNC server is now running.
Please connect to <DomU>:1 to begin the install...

Note that this time, we connect directly to the virtual machine and no more to the Dom0:

Code: shell

xvncviewer <DomU>:1

And proceed as above.

If you have the vfb available, you could run the first part in the Xen/VNC console:

Code: shell

xm create /etc/xen/unbreakable.cfg \
          vfb='type=vnc,vncunused=1' \
          bootloader= kernel=/boot/unbreakable/vmlinuz ramdisk=/boot/unbreakable/initrd.img
          on_reboot=destroy \
          extra=vnc

You will have to start 2 instances of xvncviewer though...

The easy way

Putting it all together, in my view the easiest is to

  • bypass the first part fo the installation by using command line parameters;
  • use the VNC server provided by the installer.

So we create the virtual machine with the text-mode console:

Code: shell

xm create -c /etc/xen/unbreakable.cfg \
          bootloader= kernel=/boot/unbreakable/vmlinuz ramdisk=/boot/unbreakable/initrd.img \
          on_reboot=destroy \
          extra='vnc lang=en_US keymap=be 
          method=http://<server>/unbreakable 
          ip=xxx.xxx.xxx.xxx netmask=xxx.xxx.xxx.xxx gateway=xxx.xxx.xxx.xxx dns=xxx.xxx.xxx.xxx'

After a while we will see on the console:

The VNC server is now running.
Please connect to <DomU>:1 to begin the install...

Start xvncviewer:

Code: shell

xvncviewer <DomU>:1

And proceed with the installation!

Agrandir
Agrandir
Agrandir

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 -c /etc/xen/unbreakable.cfg 

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

Enterprise Linux Enterprise Linux Server release 5 (Carthage)
Kernel 2.6.18-8.el5xen on an i686

unbreakable login:

Post Install

Agrandir
Agrandir

You can now connect to your new system using ssh.

Should you need a GUI, you can always start a VNC server; the necessary steps are described in these articles: