Sunday, October 18, 2009

Xen-tools and ubuntu Dom0

Installing Xen as described here does not install the xen-tools properly. Even if the hypervisor and Dom0 are up perfectly, there is nothing more that can be done without xen-tools.

$ sudo xm list

Traceback (most recent call last):
File "/usr/sbin/xm", line 5, in
from xen.xm import main
ImportError: No module named xen.xm

Thanks to Shriniket and Hormazd for reproducing the error :-)

As described here, the solution to this problem involves editing the
Config.mk file.

The Config.mk file is in the source root directory.

The following lines (line no. 38 and 39) have to be changed from :

PYTHON      ?= python
PYTHON_PREFIX_ARG ?= --prefix="$(PREFIX)"

to :

PYTHON = python
PYTHON_PREFIX_ARG =

Save the changes. Then,

# make clean

# make install-xen

# make install-tools

# make install-stubdom


Doing
# make clean and # make install-tools might be sufficient.
Haven't tried it.


Everything should be working fine now.

Tuning Config.mk results Xen packages to be placed
into /usr/local/lib/python2.6/dist-packages due to
Changeset 19594 in xen-3.4-testing.hg.
Otherwise, Xen packages would go to
/usr/lib/python2.6/site-packages,
which is not default location for python 2.6 on Ubuntu 9.04
( as opposed to Fedora 11 ).
Thus you won’t be able to start xend in Dom0.

Cheers !

Monday, October 5, 2009

Problems with getting Xen working ...

IF you are looking for how to install Xen, you can find it here.

Trying to get Xen working , ran into some problems ...

1. There is this peculiar problem that I faced with all the kernels that I tried as Dom0.

Gave up waiting for root device. Common problems:
-Boot args (cat /proc/cmdline)
-Check root delay = (did the system wait long enough?)
-Check root=(did the system wait for the right device?)
-Missing modules (cat /proc/modules; ls /dev)
ALERT! /dev/disk/by-uuid/xxxxx-xxxx-xxxxxxxxxxxx does not exist. Dropping to shell!

Busybox v1.10.2 (Ubuntu 1:1.10.2-2ubuntu7) built-in shell (ash)
Enter 'help' for a list of built-in commands.


The hypervisor was booting fine, but the Dom0 refused to recognise my root device and would drop me into busybox.

The solution to this problem is to pass an extra parameter to the kernel, indicating that it should wait longer for the root device. (SCSI disks have this problem).
So now, you need to edit your /boot/grub/menu.lst. The parameter to be passed is "rootdelay". rootdelay=90 has worked for me. You may experiment with lower/higer values.

$sudo gedit /boot/grub/menu.lst


#######Snippet - menu.lst ###########

title Xen 3.4.0 / Ubuntu 9.04, kernel 2.6.18.8
uuid fe8adb1a-7b82-40c4-b7d9-e35921c1155f
kernel /boot/xen-3.4.0.gz
module /boot/vmlinuz-2.6.26-2-xen-686 root=LABEL=root ro console=tty0 rootdelay=90
module /boot/initrd.img-2.6.26-2-xen-686



2. The second problem that I faced was with the 2.6.18 xenified kernel. The kernel boots into busybox and the keyboard becomes totally unusable. None of the keys works.
Although I did notice that the quickplay buttons do generate an interrupt ( it shows a message on the screen when I press a quickplay button), the rest of the keys are useless.

Could not fix this :-(

3. The 3rd problem that I faced was with the 2.6.26 Debian xenified kernel, along with the first one.

ata1.00: qc timeout (cmd 0xec)
ata1.00: failed to IDENTIFY (i/o error, err_mask= 0x4)


A little googling led me to think this was an ACPI problem. So I tried passing acpi=off in the kernel cmdline, but did not work out.
Some more googling led me in various directions. Tried atleast 5 different parameters.

The one parameter that finally worked was pci=nomsi . Found it here, and oddly enough as a solution to a different problem !

Apparently this is occurs due to problem of the Debian kernel on some motherboards and is consistently reproducable.

So, the final kernel command line that works perfectly is :

/boot/vmlinuz-2.6.26-2-xen-686 root=LABEL=root ro console=tty0 rootdelay=90 pci=nomsi


Hope this helps !

Cheers ! :-)

Sunday, October 4, 2009

Installing Xen 3.4.1

Recently, there was need to install Xen on my laptop for project work.

Xen 3.3 is present in the ubuntu repositories and installation is very straight forward.

If you plan to use Xen 3.3, then the task is extremly easy.

Steps :

1.Installing the Xen hypervisor.

sudo apt-get install ubuntu-xen-desktop

2. Installing a Dom0 kernel. There are various options available.
i) You can either use the 2.6.18.8 xenified kernel available on the official website. Get it here.
ii) You can download Debian xenified kernel from here and the modules for the kernel from here.
iii) You can use download a vanilla kernel from here and patch it to work as a Dom0. You can get the patches here. Patches for version 2.6.29-6 are stable.
iv) You can download a vanilla kernel and configure it as a Dom0 using PVOPS. (There are still quite a few issues with this.)

3. Done.

Installing Xen 3.4.1 :

Detailed steps :

I am describing how to install Xen 3.4.1 from source and using the Debian xenified kernel (2.6.26) as Dom0. I compiled the 2.6.18.8 xenified kernel, but my keyboard would become unusable. I also tried patching the vanilla kernel, but ran into some problems. So I settled for the Debian xenified kernel.

Step 1: Satisfying the dependencies.

Special thanks to Furquan Shaikh, my senior, for providing me a comprehensive list of all the dependencies.

$ sudo apt-get install gcc make binutils zlib1g-dev pyhton-dev python2.6-dev python-opnessl libncurses5-dev libssl-dev xorg-dev bridge-utils iproute udev tetex-base tetex-bin latex-make texi2html texinfo texlive texlive-base gawk gettext-kde


Alternatively, you can automate the process using :
$ sudo apt-get build-dep package-anme


For more info on this, click here and here
Thanks to CDK :-)

will install all the required dependencies.



Step 2 : Downloading the latest Xen source. You can download the source from here.

Step 3 : Extract the source into a suitable directory. Then
i) # make install-xen
ii) # make install-tools
iii)# make install-stubdom

If all the dependencies were satisfied, step 3 should not give any problems at all.

Step 4 : The packages for Dom0 Debian kernel can be obtained from here and here.

Once downloaded, install the kernel using :

$ sudo dpkg -i linux-image-2.6.26-2-xen-686_2.6.26-19_i386.deb linux-modules-2.6.26-2-xen-686_2.6.26-19_i386.deb

This installs the Dom0 kernel and also updates the grub entries.

This completes installation of the hypervisor and the Dom0. Since the Dom0 kernel is 2.6.26, make sure that your root partition is not ext4. ext4 support was included since kernel 2.6.28.

Now, reboot your computer, you should boot into the Dom0 kernel if everything went right. :-)

I ran into some problems while booting the Dom0 kernel. I am posting them here.