Installing XenServer Tools on Ubuntu 10.04

XenServer supports a lot of Linux and Windows operating systems out of the box, but Ubuntu isn’t one of them. This means that running Ubuntu is slower, because it uses HVM (hardware-assisted virtualisation) instead of PV (paravirtualization). This article will explain how to create a paravirtualized Ubuntu 10.04 VM with the XenServer Tools installed. Many thanks go to the author of the article Ubuntu 10.04 LTS paravirtualised on Citrix XenServer.

We start with creating and installing a VM with HVM.

  • Create a VM from the Other install media template
  • Attach the Ubuntu 10.04 ISO to the DVD drive of the VM
  • Start the VM
  • At the disk partitioning stage make sure to replace Ext4 with Ext3, or create a specific boot partition with Ext3
  • Select at least the OpenSSH server package to be able to log in to the VM remotely
  • Finish installation and boot the VM

We now create a new console and edit the boot settings.

  • Connect to the VM using SSH
  • Create a new console for Xen
sudo cp /etc/init/tty1.conf /etc/init/hvc0.conf
sudo vi /etc/init/hvc0.conf
  • Replace all occurrences of tty1 with hvc0
  • Read /boot/grub/grub.cfg
sudo vi /boot/grub/grub.cfg
  • Copy the contents of menuentry near the bottom to a temporary text file, to be used as input for the makepv.sh script that we will use later on
menuentry 'Ubuntu, with Linux 2.6.32-21-server' --class ubuntu --class gnu-linux --class gnu --class os {
        recordfail
        insmod ext2
        set root='(hd0,1)'
        search --no-floppy --fs-uuid --set 02899ea9-1876-4e7b-8ef8-2b09b598cedb
        linux   /boot/vmlinuz-2.6.32-21-server root=UUID=02899ea9-1876-4e7b-8ef8-2b09b598cedb ro quiet
        initrd  /boot/initrd.img-2.6.32-21-server
}
  • Make special note of /boot/vmlinuz…, root=UUID=… and /boot/initrd.img
  • Shutdown the VM

We now convert the VM to PV.

  • Connect to the XenServer host with SSH
  • Copy the makepv.sh script (download from here) to the XenServer host and make it executable
chmod +x makepv.sh
  • Run the makepv.sh script, replacing my-vm-name with the actual name of your VM
makepv.sh my-vm-name

Finally we install the XenServer tools.

  • Boot the VM and log in with SSH
  • In XenCenter, attach xs-tools.iso to the DVD drive of the VM
  • Mount xs-tools.iso, install the correct XenServer Tools package (replace amd64 with i386 if necessary) and unmount xs-tools.iso
sudo mount /dev/cdrom1 /mnt
sudo dpkg -i /mnt/Linux/xe-guest-utilities_5.5.0-466_amd64.deb
sudo umount /mnt
  • In XenCenter, detach xs-tools.iso from the DVD drive of the VM (this ensures that XenServer does not complain about too many bootable devices)
  • Reboot the VM and log in with SSH
  • Make sure the services run at boot time
sudo update-rc.d -f xe-linux-distribution remove
sudo update-rc.d xe-linux-distribution defaults
  • Reboot the VM for the last time
  • Restart XenCenter to be able to log in to the console of the VM

20 Responses

Write a Comment»
  1. The makepv.sh script can’t handle VM names with spaces. This is because the lines 15, 20 and 32 don’t wrap the variables with double quotes. Change the lines as follows and it will work with spaces:

    Line 15: if [ -z "$1" ]
    Line 20: VM=”$1″
    Line 32: UUID=$(xe vm-list name-label=”$VM” params=uuid –minimal)

  2. Thanks for the tutorial!

    I think there is another problem with the makepv.sh script regarding special characters:
    # ./makepv.sh my-vm-name (Ubuntu 10.04)
    -bash: syntax error near unexpected token `(‘

  3. Thanks for the great tutorial. Everythings works fine with XenServer 5.6 and Ubuntu 10.04!

    In the XenCenter now I see the “Virtualization state” is set to “Optimized (version 5.6 installed)”. Nevertheless I have the problem, that the guest console in the XenCenter is not working anymore. I see a login prompt that says:

    Ubuntu 10.04 LTS my-vm-name hvc0
    my-vm-name login:

    My keyboard input is not accepted (nothing happens); so I’m not able to login to the system using the guest console. Is there something wrong with the hvc0 console? I copied the file /etc/init/tty1.conf and made the replacements (tty1 -> hvc0).

    Maybe this is not a big problem as long as I could login using ssh, but if the ssh service is down there is no way to login.

  4. Sorry, me again :) .
    I found http://forums.citrix.com/message.jspa?messageID=1462797 that solved the “keyboard input problem”. Maybe this is a bug in XenCenter 5.6. As written in the post I was also able to paste text with the middle mouse click and in result restarting XenCenter fixed the problem… Sometimes the easiest things are not the best :)

    One comment about the tutorial:
    The last steps could fail if you mount the xs-tools.iso before starting the VM with an error like “too many bootable devices”. Of course, mounting the iso after booting the VM works as accepted.

    Anyway, thanks for the instructions!

  5. Should be: “Sometimes the easiest things are the best” :)

  6. After installing the apache2 web server the system requires the package “grub-pc”, but unfortunately the installation failed:

    Setting up grub-pc (1.98-1ubuntu6) …
    dpkg: error processing grub-pc (–configure):
    subprocess installed post-installation script returned error exit status 1
    Errors were encountered while processing:
    grub-pc
    E: Sub-process /usr/bin/dpkg returned an error code (1)

    Does this problem result from the modified boot options?

  7. hi,
    has this Apache issue been solved ??

    We want to create a virtual webserver and obviously, if we can not install Apache, this is problematic.

    thanks,
    dGo

  8. hi,

    I managed to install Apache2, MySQL and PHP without any trouble…

    But, I did wonder about something else though…
    When we run makepv.sh on the XenServer, we hard code kernel data
    Should we rerun makepv.sh after a Kernel update ?

    Thanks,

  9. Thanks

  10. Great article!!
    I’m working with Ubuntu 9.04 and everything worked great to get it going in Paravirt mode. (MUCH MUCH faster, however, I was unable to get the “Tools not installed” message to disappear from the XenCenter console. Any other suggestions on where I can look?

    I’ve started the service by hand and tried removing/readding the server to the startup, all of which appears to work and I see xen processes with ps -ef but XenCenter is showing me no love with the “Tools not installed” error.

    Thanks!!
    David

  11. Me again,
    the problem was not caused directly by apache (the installation of apache2 ran without any problems). The error was caused by the grub-pc package which (I think) is a dependency of apache2 package even if the package is not needed to run the webserver. I think the cause of the problem is that the grub-pc package does not know how to handle the virtual disks (/dev/xvdX). I found this bug https://bugs.launchpad.net/ubuntu/+bug/524434. After applying the patch attached in the bug report, I was able to install grub-pc.

  12. Hi,

    Can’t get this one to work.

    When i run the makepv.sh and boot the VM i get the following:

    fsck from util-linux-ng 2.17.2
    fsck from util-linux-ng 2.17.2
    /dev/mapper/webserver–01-root: Superblock last mount time (Wed Jul 14 18:00:48 2010,
    now = Mon May 3 09:28:25 2010) is in the future.

    /dev/mapper/webserver–01-root: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
    (i.e., without -a or -p options)
    /dev/xvdb1: Superblock last mount time (Wed Jul 14 18:00:50 2010,
    now = Mon May 3 09:28:25 2010) is in the future.

    /dev/xvdb1: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
    (i.e., without -a or -p options)
    mountall: fsck / [235] terminated with status 4
    mountall: Filesystem has errors: /
    mountall: fsck /boot [234] terminated with status 4
    mountall: Filesystem has errors: /boot

    This is in my grub.cfg:

    menuentry ‘Ubuntu, with Linux 2.6.32-21-server’ –class ubuntu –class gnu-linux –class gnu –class os {
    recordfail
    insmod ext2
    set root=’(hd0,1)’
    search –no-floppy –fs-uuid –set 8cef9119-81c1-498d-aaa6-8b1a21780a04
    linux /vmlinuz-2.6.32-21-server root=/dev/mapper/webserver–01-root ro quiet
    initrd /initrd.img-2.6.32-21-server
    }

    Cheers,

    Andy

  13. When I follow all instructions (no error messages) I get the following error when I try to boot the ubuntu VM:

    Starting VM ‘webserver’ – The bootloader for this VM returned an error — did the VM installation succeed? Error from bootloader: too many bootable disks (2 disks)

    Anyone have an idea what could be wrong?

  14. You should first detach xentools.iso before booting the VM. It now sees two possible boot devices: the hard disk and the xentools “dvd player”.

  15. Why ext3? I plan to try this, but my Ubuntu virt is already installed with Ext4. Is this merely a preference or would I need to reinstall the virt?

  16. You could always try with ext4 and see what happens, but I’m pretty sure it won’t work. The sources I’ve used to put together this article point out that it is necessary to use ext3.

  17. [...] Installing XenServer Tools on Ubuntu 10.04 If you have problems to install grub-pc in the Ubuntu guest system, take a look at the following bug reports: [...]

  18. [...] dem ich lange probiert habe, habe ich dann auf dieser Seite http://www.jansipke.nl/installing-xenserver-tools-on-ubuntu-10-04 die richtigen Antworten gefunden. Das Template was irgendwo Angeboten wurde, war ok und [...]

  19. Great instructions! I too had the problem with the console stuck where I couldn’t type anything. Closing XenCenter and re-opening it fixed it for me though.

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>