Installing ubuntu 9.04 PV on Citrix Xenserver

By | October 8, 2009

Installing A Xenserver Ubuntu PV vm from scratch

Step 1

1

If installing a x64 os then select the Currently Selected template, if installing the 32bit version then select the one above,

 2

Enter a Vm Name

 3

In this case I selected the ubuntu iso from the storage repository, if you want to use a cd tick the radio button above, click next

 4

Select the amount of resources you want to allocate on the vm. When finished press next.

5 

If you want to change the hdd size of the vm, press edit and increase or decrease the image size,

when done press next.

Press next when finished with your changes

 7

Press Finish,

Now to Start the vm installation

 8

Press enter, this tutorial will be in English however If you want to select a different language, go ahead now.

 9

Press enter

 10

Press Enter, Again if you want to choose a different language you can do so.

 11

From this menu you can choose your country / timezone

 12

Press Enter
13
 Select your keyboard, then press enter

 14

Press enter once again after select the keyboard layout again
15
Set the hostname for the machine and select continue

 16

Select your timezone

 17

It is import to not use Lvm for the next instructions to work, select Use entire disk.
18
Select your hdd and press enter
19
Select yes and press enter, This might take a few minutes,
20

21
Type in a the full name of the user and press continue
22
Now enter the username required and press continue

Next you will be asked to enter a password, do so and press enter, then you will be asked to re-enter the password do so once again and press enter

 23

Select no and press enter

 24

If you use a proxy server to access the internet then type it in here, otherwise, just leave it blank and press continue

This will take a while as some packages will be updated,
25
I usually select no automatic updates, but you can select whichever you like.
26
Select the openssh package so that you can access the server via ssh, if you want to install any other packages select them from the list
When you press continue the ubuntu packages will be downloaded and installed, this will take a while,

27

The installation is complete press continue to reboot and access your vm.

Once the vm has booted you can login with your username and password
type in ifconfig to obtain your ip address and connect via ssh example putty,
Ssh should be installed as we selected it from the packages in the installation.

Now we must download the kernel for x64 bit installation download the following

wget http://ftp.nl.debian.org/debian/pool/main/l/linux-2.6/linux-modules-2.6.26-2-xen-amd64_2.6.26-19_amd64.deb
wget http://ftp.nl.debian.org/debian/pool/main/l/linux-2.6/linux-image-2.6.26-2-xen-amd64_2.6.26-19_amd64.deb

If the link doesn’t work, then select a different mirror for each from here
http://packages.debian.org/lenny/amd64/linux-image-2.6.26-2-xen-amd64/download
 http://packages.debian.org/lenny/amd64/linux-modules-2.6.26-2-xen-amd64/download

To install the 64bit kernels type in
dpkg –i linux-modules-2.6.26-2-xen-amd64_2.6.26-19_amd64.deb
dpkg –i linux-image-2.6.26-2-xen-amd64_2.6.26-19_amd64.deb

If you want a 32Bit installation then use the following
wget  http://ftp.nl.debian.org/debian/pool/main/l/linux-2.6/linux-modules-2.6.26-2-xen-686_2.6.26-19_i386.deb
wget http://ftp.nl.debian.org/debian/pool/main/l/linux-2.6/linux-image-2.6.26-2-xen-686_2.6.26-19_i386.deb

If the link doesn’t work, then select a different mirror for each from here
http://packages.debian.org/lenny/admin/linux-modules-2.6.26-2-xen-686
http://packages.debian.org/lenny/i386/linux-image-2.6.26-2-xen-686/download

To install the 32bit kernels type in
dpkg –i linux-modules-2.6.26-2-xen-686_2.6.26-19_i386.deb
dpkg –i linux-image-2.6.26-2-xen-686_2.6.26-19_i386.deb

Now we must edit grub.
Edit the file
vim /boot/grub/menu.lst

Add the following entry
title           Ubuntu 9.04, kernel 2.6.26-2-xen
uuid            be490daf-0ded-4347-9b76-bc98480edb9e
kernel          /boot/vmlinuz-2.6.26-2-xen-amd64 root=UUID=be490daf-0ded-4347-9b76-bc98480edb9e ro quiet splash
initrd          /boot/initrd.img-2.6.26-2-xen-amd64
quiet

Before this entry
title           Ubuntu 9.04, kernel 2.6.28-11-server
uuid            be490daf-0ded-4347-9b76-bc98480edb9e
kernel          /boot/vmlinuz-2.6.28-11-server root=UUID=be490daf-0ded-4347-9b76-bc98480edb9e ro quiet splash
initrd          /boot/initrd.img-2.6.28-11-server
quiet

Save and exit.
Now we must edit the fstab

vim /etc/fstab
# / was on /dev/sda1 during installation
UUID=be490daf-0ded-4347-9b76-bc98480edb9e /               ext3    relatime,errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
UUID=03e73498-eafd-4bfd-a62c-cbb243ee46bc none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto,exec,utf8 0       0

Your fstab should look something like this.
Now change it to look like this
# / was on /dev/sda1 during installation
#UUID=be490daf-0ded-4347-9b76-bc98480edb9e /               ext3    relatime,errors=remount-ro 0       1
/dev/xvda1 / ext3    relatime,errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
#UUID=03e73498-eafd-4bfd-a62c-cbb243ee46bc none            swap    sw              0       0
/dev/xvda5 none swap    sw 0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto,exec,utf8 0       0
Save and exit.

Now we have to install the xen tools,
From the xenCenter console, Select on the vm you are working on, and from the console select the dvd drive xs-tools.iso
Once this has been attached to the vm we can proceed,

from the vm type in

mount /dev/cdrom /mnt
you should see a message similar to this
mount: block device /dev/xvdd is write-protected, mounting read-only

type in
cd /mnt/Linux

If installing on 64bit
dpkg –i xe-guest-utilities_5.5.0-458_amd64.deb

If Installating on 32Bit
dpkg –i xe-guest-utilities_5.5.0-458_i386.deb

We are now done from configuring the vm.
you can now shut the vm down,
Now ssh into your Xenserver where the vm is hosted.
We have a few more steps before we are done.

Determine the UUID of the VM:

xe vm-list name-label=”Ubuntu x64 Test1” params=uuid –minimal 
this will display the UUID of the VM named “Ubuntu x64test1”. If your vm is called anything different then replace the text in the “” with the name of your vm, Copy the uuid and replace the <uuid> below

xe vm-param-set uuid=<uuid> HVM-boot-policy= 
this will remove the HVM boot mode from the VM.

xe vm-param-set uuid=<uuid> PV-bootloader=pygrub 
this will set the VM to use the pygrub bootloader which enables the guest to boot in PV mode.

vm vm-param-set uuid=<uuid> PV-args=”console=tty0 xencons=tty” 
this configures the kernel boot arguments to display the login console on the correct TTY, so that it shows up in the XenCenter console.
Next, we need to flag the root disk of the VM as bootable so that pygrub knows where to look for the PV kernel:
xe vm-disk-list uuid=<uuid> and look for the UUID of the VBD for the disk. VBD stands for “Virtual Block Device” and represents how to map the virtual disk into the virtual machine.
xe vbd-param-set uuid=<vbd uuid> bootable=true
will set the root disk VBD to be bootable.

All xen settings should be all set now! If you boot up the Ubuntu VM, it should start up in text-mode with the high-speed PV kernel. If it doesn’t work due to an incorrect grub configuration, you can use the xe-edit-bootloader script in the XenServer control domain to edit the grub.conf until the config works,
example xe-edit-bootloader -n “Ubuntu x64 Test1” -p 1

All is complete, now Start the vm and it should boot in pv mode.
If you don’t want to go trough all this, you can download a ready made image of this procedure from here

3 thoughts on “Installing ubuntu 9.04 PV on Citrix Xenserver

  1. Andre

    Hi,

    is it possible to Activate the Gui while running in PV Mode?

    Regards

  2. turitopa

    Looks interesting…can you help me do this with EFW 2.3 community?

    I have no idea when it comes to linux…

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.