Ubuntu 10.04 Template Running on Citrix Xenserver 5.5

By | May 3, 2010

It’s been a while since i updated the Templates, here comes our new friend Ubuntu 10.04 and it’s running in Pv mode on Xenserver Yep 🙂

As usual there are a few tweaks that had to be done to the vm for it to work, however this time it is easier then 9.10
If you download my template you do not need to do any changes. however if you update the kernel once your vm is running, then you must tell Xenserver where to find this kernel,
since the new ubuntu uses grub2, xen does not know how to handle this, so instead of pygrub reading the grub.cfg file, we need to specify the kernel and ramdisk manually.

This is how it can be done.
Log in to your xenserver via ssh
find out the UUID of your vm

Ex

xe vm-list
uuid ( RO)           : 7022730c-67c1-224e-481e-501e9930e03a
name-label ( RW): Db Srv
power-state ( RO): running
uuid ( RO)           : b752d5f8-d102-3057-4487-a60bec1d0e12
name-label ( RW): FileSrv
power-state ( RO): halted
uuid ( RO)           : c74a6236-4a5a-9245-ffe6-b719b6f28ee2
name-label ( RW): Ubuntu10
power-state ( RO): halted

Copy the uuid of your ubuntu10 vm, if in xen you renamed it, then under name-label you need to look for whatever you called it.

xe vm-param-set uuid=c74a6236-4a5a-9245-ffe6-b719b6f28ee2 PV-bootloader-args=”–kernel=/boot/vmlinuz-2.6.32-21-server –ramdisk=/boot/initrd.img-2.6.32-21-server”
you need to update the kernel and ramdisk entries above with the ones in your grub.cfg after the update

Also Note that you no longer need a Xen kernel in order to Pv the vm, as this is all added in the generic kernel, so once you do an apt update and there is a kernel update, just get the details and run
the command above.

And that should be it 🙂

Username: root
password: password

You can download the template from here

42 thoughts on “Ubuntu 10.04 Template Running on Citrix Xenserver 5.5

  1. Pål

    I manually installed Lucid as a guest on my 5.5-host, and was wondering if you could give any insight on how to enable the XS tools?

    I tried doing the “dpkg-reconfigure dash”-trick, but it didn’t stick. The installation worked, but XenCenter doesn’t see the tools on the guest.

    Pål

  2. Isaac Zarb Post author

    I seem to have issues with the tools also, it seems that the first time they are installed they work, however after a reboot they dont function, im looking into this will let you know once i figure it out

  3. Peter

    I got the same issue with xs tools..

  4. Glauco

    Thanks for the template! the password is password

  5. Con

    I got a bit further with the xe-tools.

    When you start xe-linux-distribution from the command-line it starts working. So I suspect the xe-guest-utilities installer breaks during the update-rc.d. It is creating a S script in rcS.d, and K scripts in rc0, rc1 and rc6. I’ve tried running it manually and it displays similar errors as the installer.

    So my quick and dirty manual fix is to:

    rm /etc/rc?.d/[SK]??xe-linux-distribution

    ln -s /etc/init.d/xe-linux-distribution /etc/rc2.d/S99-xe-linux-distribution

    You might want to play with the runlevel it sits in, or even create a kill script, but it does what I need (for now).

    Thanks for the template Isaac. Great work.

  6. Con

    This also works:
    update-rc.d -f xe-linux-distribution remove
    update-rc.d xe-linux-distribution defaults

  7. Adrian

    Thanks for the template! Very very useful. How do I increase the drive space for the template tho? Thanks again!

  8. blankman

    For me, the fix for the xen tools issue was simply to start it 🙂 It looks like for some reason there was no rc init start in the all but the rcS.d … which if memory serves is for single user mode that the OS itself uses. So, all I did was put the right symlink in … by hand cause when I ran update-rc.d it didn’t work. Here is what I tried and its response:
    # update-rc.d xe-linux-distribution defaults
    System start/stop links for /etc/init.d/xe-linux-distribution already exist.

    So, I just went into the /etc/rc2.d [this is the default runlevel] directory and did it myself. One thing to note. It looks like it was only the start that didn’t get made. The Kill (rc0 and rc6) where in there.

    The command I used was:
    ln -s ../init.d/xe-linux-distribution S37xe-linux-distribution

    Anyhow, that worked for me for both poweroff and reboot …

  9. Gerards

    I wonder if there is anybody out there who has a complete procedure on how to create my own template based an a recent Ubuntu distri. Including working xentools?
    If so can you please post it (and drop me an email where it’s posted).

    Regards
    Gerards

  10. Justin

    I can’t get this working, I did exactly as instructed above but it still seems very slow and the console is painful. Installed xen tools using ‘dpkg -i xe-etc-etc_amd64.deb’ but it doesn’t seem to have worked.

    How would I know whether or not Ubuntu is running in PV mode?

    The template provided would be more useful using LVM. I need an 80GB system partition and can’t expand the 8GB one provided.

  11. Marco Giorgetti

    Anybody knows if it is possible to installa Ubuntu 10.04 Desktop version instead of server?

  12. d0nk3y

    Hello Issac! Thank you for your template.

    I have used it to create a new Ubuntu 10.04 Xenserver VM. I’ve since upgraded the root partition to ext4 but now it won’t boot – I get a “Error from bootloader: Return code:1” error when starting the VM.

    I have run the above xe vm-param-set command but that has not helped.

    If I detach the Vdisk from this vm and connect it to another non-template VM, it boots fine.

    Seems to be a problem with getting grub or the boot options rejigged but I have not been able to figure it out yet. Can you offer any pointers please?

  13. Gustavo

    Thanks for the great work you are doing here.

    I tried your template and worked flawlessly.. until y tried an apt-get dist-upgrade which updated the kernel. I did the xe vm-param-set thing pointing to the new files of kernel and ramdisk but now the VM wont boot and its showing the error: “The bootloader for this VM returned an error did the VM installation succeded?”

    Im looking at the logs but cant find anything. Do you have a clue of what can be happening?

  14. tmc0727

    Is this template only for the 64-bit version? If so, do you have one for the 32-bit version?

  15. grafke

    In the post above one sentence was replaced with :
    means: xe vm-param-set uuid=c74a6236-4a5a-9245-ffe6-b719b6f28ee2 PV-bootloader-args=”–kernel=/boot/vmlinuz-2.6.32-21-server –ramdisk=/boot/initrd.img-2.6.32-21-server”

  16. LedHed

    Marco Giorgetti,

    You can make this template into Ubuntu Desktop but running:

    sudo apt-get install ubuntu-desktop

  17. Pål

    If you need to use Ubuntu 10.04 (without grub, as the image provided) as a template, you will need to make some modifications as follows;

    1. On the host:
    xe vm-param-set uuid= PV-bootloader-args=”–kernel=/vmlinuz –ramdisk=/initrd.img”

    Notice the lack of versioning. Pointing the bootloader directly to the “current kernel” symlinks will enable you to upgrade the kernel WITHOUT making the adjustments described in the original blog post. Lets say you have a hosting environment where customers can upgrade their kernel by them selfs — this will enable them to do so flawlessly.

    2. On the guest:
    e2label /dev/xvda1 PRIMARY_ROOT

    We set a static label for the main disk, preventing the need to adress it with UUID.

    3. On the host:
    xe vm-param-set uuid= PV-args=”root=LABEL=PRIMARY_ROOT ro”

    We now reference the staticly named disk. We do this because guests created from templates get a newly provisioned disk, and it gets a new unique ID — thus invalidating PV-args when it references UUID. This does only happen when we create from template, and not when we copy a guest.

  18. Pål

    It seems like I’ve mistaken how the disk uuid is assigned. Using a template does not give the disk a new disk UUID, so step 2 and 3 in the post above is not needed.

    It is however semantically good to have the disk with a recognizable naming scheme. If you have several templates and need to programatically set things up, its nice to be able to use the same commands on all templates.

  19. grafke

    Thanks for your help, but this is not what helps me:) My problem is:
    Xenserver can’t boot PV VM from /dev/hda device. Device label must be /dev/xvda (a/b/c/d/..).
    In my XenServer5.5 I have Ubuntu 10.04 running on ext4 with grub2, and running in BIOS order mode. I have already made all necessary steps to make the VM paravirtualised, nevertheless still the vm’s boot device is /dev/hda, and I can’t figure out how to convert/rename/etc it to /dev/xvda

    Any help would be appreciated.

  20. Pål

    You can’t use Grub 2 with XenServer without patching the host. I’ve failed to find a patch that works for 5.5. User named FWD in a post above links to a page describing how to use such a patch for 5.6

    Furthermore, the partition /boot is on must be Ext3

  21. David

    xe vm-param-set commands above are incorrect you should use “–kernel=” and “–ramdisk=” (double hyphens).
    Here is an example that worked for me after a kernel upgrade:
    [root@officexen1 etc]# xe vm-param-set uuid=f1de73e6-5277-2f3b-178e-12aea839c489 PV-bootloader-args=”-kernel=/boot/vmlinuz2.6.21-22-server -ramdisk=/boot/initrd.img-2.6.32-22-server”
    [root@officexen1 etc]# xe vm-list
    uuid ( RO) : f1de73e6-5277-2f3b-178e-12aea839c489
    name-label ( RW): test 10.04 LTS
    power-state ( RO): halted

    [root@officexen1 etc]# xe vm-param-set uuid=f1de73e6-5277-2f3b-178e-12aea839c489 PV-bootloader-args=”–kernel=/boot/vmlinuz-2.6.32-22-server –ramdisk=/boot/initrd.img-2.6.32-22-server”

  22. David

    RE: above comment.. in all the examples it appears that this web page removes double hyphens and replaces them with a single hyphen.
    –kernel= –ramdisk=

  23. grf

    As I see from template produced here, there is not ext3 partition. And grub2 is perfectly working with xen5.5. Question is: how to make similar template without downloading from here. Keeping in mind problems mentioned above.

  24. grafke

    If you look at the template, produced by Isaac, you should notice, that there is no ext3 partition – and OS uses grub2. So I wonder what step in the Ubuntu 10.04 PV installation on xenserver 5.5 process have I missed.
    My steps and problems can be found in the posts above.

  25. ccm

    Thanks for providing the image. I added the following changes:

    $ rm /bin/sh
    $ ln -s /bin/bash /bin/sh

    Install xen-tools by mounting the iso and installing the amd64.deb with dpkg

    $ update-rc.d -f xe-linux-distribution remove
    $ update-rc.d xe-linux-distribution defaults

    As “grub-pc” complains about errors and is not needed I reverted back to grub by

    $ aptitude install grub

    After a kernel upgrade you can use the information provided above to activate, though you don’t have to as long as you don’t remove the currently used kernel image.

    The only pity for me is the ext3 file system as I’d heavily support ext4 instead due to performance reasons.

  26. Pål

    RE: ccm

    In all fairness, you could create a template from scratch with EXT4 as long as you use EXT3 on /boot as a seperate partition. All the info you need to create one yourself should be in this blog post and its comments

  27. Francisco Maia

    RE: ccm

    Hi,

    I followed your advice and installed grub.
    After an aptitude safe-upgrade, the system removed the kernel 2.6.32-21 and installed the 2.6.32-22.

    I followed the steps in the article to update the xen configuration and entered in the xenserver:
    xe vm-param-set uuid=4e499518-c0b2-3561-b024-3c911647b96d PV-bootloader-args=”–kernel=/boot/vmlinuz-2.6.32-22-server –ramdisk=/boot/initrd.img-2.6.32-22-server”

    After the reboot, the VM does not boot, giving the following error in the log of the xenserver:
    Error: Starting VM ‘gateway’ – The bootloader for this VM returned an error — did the VM installation succeed? Error from bootloader: Return code: 1; Log = Usage: /usr/bin/pygrub [-q|–quiet] [-i|–interactive] [-n|–not-really] [–output=] [–kernel=] [–ramdisk=] [–args=] [–entry=] [–default_args=] [–extra_args=]

    What is wrong in this picture? How can I make the VM bootable again?

  28. Sigurður Jónsson

    Hi,
    Can anyone help me install this template? Have xensource 5.0.0 on linux. Downloaded the template and extracted it, but cant find any good instructions to import to a template or a vm.

    Best regards,
    Siggi

  29. Sigurður Jónsson

    Hi Isaac,
    Is there any chance you could provide instructions on how to build a xenserver template like ubuntu 10.04 Have xenserver 5.0.0 and it wont be upgraded anytime soon according to administration. I’m sure we could accomodate you for the work with a donation. Tried to import the xs5.5 ubuntu lucid template, and it gives a error regarding a incompatible version. Not the right platform for it.

    Best regards,
    Sigurdur Jonsson
    Basis
    Iceland

  30. David

    How do you view the boot messages through the console? It appears that the console is not activated until after boot. I would like to see all the boot up message for diagnostic reasons. Is this possible?

  31. Sigurður Jónsson

    You have to change mingetty for tty1 in /etc/inittab on Centos/Redhat or /etc/event.d/tty1 on Debian/Ubuntu to xvc0. Then close XenCenter and start it for the changes to commit.

  32. Kons

    Template runs nicely, but how do i connect via vnc to a gui? step-by-step help would be really nice.

  33. Sayane

    Why not remove grub-pc and install grub, and then just setup pygrub?

  34. Chris

    I decided to use LVM with XenServer, which seems to work well. Although, when I needed to expand it, I ran into some issues. For instance, fdisk results in:

    Disk /dev/xvda: 64.4 GB, 64424509440 bytes
    255 heads, 63 sectors/track, 7832 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00036e12

    Device Boot Start End Blocks Id System
    /dev/xvda1 1 32 248832 83 Linux
    Partition 1 does not end on cylinder boundary.
    /dev/xvda2 32 6527 52176897 5 Extended
    /dev/xvda5 32 6527 52176896 8e Linux LVM

    And “df -hk” shows:

    Filesystem 1K-blocks Used Available Use% Mounted on
    /dev/mapper/ubuntu-root
    49875684 916712 46425392 2% /
    none 239276 136 239140 1% /dev
    none 252444 0 252444 0% /dev/shm
    none 252444 36 252408 1% /var/run
    none 252444 0 252444 0% /var/lock
    none 252444 0 252444 0% /lib/init/rw
    /dev/xvda1 233191 17167 203583 8% /boot

    Are there any ways to partition the disks to accept the new storage? It is visible, but each time I try to repartition it fails on boot. Thankfully I have a snapshot. Any ideas are appreciated.

    Chris

  35. Akeem McLennon

    Xenserver 5.6 can read the new grub2 configuration files just fine. Therefore, it is no longer necessary to manually specify the kernel image. I suggest running:

    xe vm-param-set uuid=[uuid] PV-bootloader-args=””

    After running this command, XenServer will automatically boot into the default kernel in grub (usually the latest).

  36. Akeem McLennon

    If you’re doing a lot of disk reads / writes with large files, irqbalanced may crash your VM under the current template. You may want to disable it by editing /etc/defaults/irqbalance

  37. Sig

    I can’t import your template, it gives an error that its not compatible with the version i’m using.

  38. Prashant Ramhit

    So as NOT to upgrade grup-py,when doing apt-get upgade, hold the packages by:

    command: echo ‘grub-py hold’| dpkg –set-selections
    check:
    root@prashant:~# dpkg –get-selections | grep grub
    grub-common install
    grub-py hold
    root@prashant:~#

  39. james

    It was very easy to import the VM and get it running. But, the xvda1 partition is only approximately 6GB. I attempted to resize it according to XenServer’s instructions, but that appears to be only for LVM partitions and this one appears not to be one of those.

    Is there a way to increase the partitions of your ubuntu images?

  40. Pingback: Margaret Wilson

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.