Lomadee, uma nova espécie na web. A maior plataforma de afiliados da América Latina.

terça-feira, julho 13, 2010

Installing Ubuntu 10.04 as a guest for Citrix XenServer 5.5.0

Update 2011/07/15: This also applies to Ubuntu 10.10 and 11.04 releases

If you need to install an Ubuntu system as a guest for Citrix XenServer, you figured out that there is no support from Citrix templates out there, but this is not the end of the world. Modern GNU/Linux distros comes with kernels ready for para-virtualization and you just need to make additional steps to get it working.



First of all, get you Ubuntu 10.04 install media, create a VM that suits your needs and install it as you must already know how with a separeted boot partition as ext3 filesystem since pygrub don't support ext4 yet. After you get it installed, you will need to install additional packages, they are:
  • xe-guest-utilities (from XenTools)
  • linux-virtual (Ubuntu)
Don't care about running Linux/install.sh from XenTools, it will not work as Ubuntu is not supported yet by Citrix. Just install the apropriate xe-guest-utilities for you platform and the linux-virtual package that will take care of additional dependencies.

After that, fix the xe-linux-distribution startup and grub kernels list by running the commands bellow:
  • update-rc.d -f xe-linux-distribution remove
  • update-rc.d -f xe-linux-distribution defaults
  • update-grub
  • cp /usr/share/xe-guest-utilities/citrix.list /etc/apt/sources.list.d/
  • aptitude update
  • aptitude safe-upgrade
Copy you existing /etc/init/tty1.conf to /etc/init/hvc0.conf and adjust it changing every occurence of tty1 by hvc0. It will be used as console for this VM system.

Take note of you desired grub boot entry so you can tell Citrix XenServer how to boot up the new system, with special note to kernel and initrd filenames, root filesystem uuid and additional params passed to kernel, since Citrix XenServer don't know how to handle grub2 used by Ubuntu. For now, I will be using the following kernel and initrd image files:
  • /vmlinuz-2.6.32-23-server
  • /initrd.img-2.6.32-23-server
Shut you VM system down so you can adjust some params to make it clear to Citrix XenServer that you are running a para-virtualized guest. Make sure to set DVD/CD driver as empty for this VM. To continue, you must know the uuid of the VM in question.
  • xe vm-param-clear uuid='vm uuid' param-name=HVM-boot-policy
  • xe vm-param-set uuid="vm uuid' PV-bootloader=pygrub
Now you need to set the this VM root disk as bootable, so pygrub knows where to look for kernels. To do this, you need to know the uuid for the disk (VBD) and VM, and then we set which kernel to boot on and what params pass to it.
  • xe vbd-param-set uuid='vbd uuid' bootable=true
  • xe vm-param-set uuid='vm uuid' PV-bootloader-args="--kernel=/vmlinuz-2.6.32-23-server --ramdisk=/initrd.img-2.6.32-23-server"
  • xe vm-param-set uuid='vm uuid' PV-args="root=UUID='root filesystem uuid' ro quiet console=hvc0 xencons=hvc0"
Now you have a para-virtualized instance of Ubuntu 10.04 runing. If something goes wrong and you VM can't boot, don't worry, just run the command bellow and everything will back to old HVM behavior.
  • xe vm-param-set uuid='vm uuid' HVM-boot-policy="BIOS order"
That all folk's

2 comentários:

MauNose disse...

Hi,

Thank you for sharing this, it helped me a lot!
Unfortunately after doing like it's described, I can't type anything on the console, but I can see it, any though on what could be the problem?

Thank you.

Alexandre Alencar disse...

MauNose,

When it happens, it comes back by itself for me, but you can try this link CTX120969