Xen Paravirtualized Guest – Invalid Kernel

linux-kernelubuntu-12.04xen

I have set up xen on ubuntu server 12.04 LTS.
I have tried installing a guest to an lvm I created called xen-lvm

The virt-install script:

sudo virt-install \
--name client2-ubuntu-server \
--ram 512 \
--location http://www.mirrorservice.org/sites/archive.ubuntu.com/ubuntu/dists/precise/main/installer-i386/ \
--accelerate \
--disk path=/dev/dev-server/xen-lvm \
--boot kernel=/boot/vmlinuz-3.2.0-35-virtual,initrd=/boot/initrd.img-3.2.0-35-virtual \
--force

I had first tried installing without the –boot option which had the exact same error when I try to start the vm (xm create client1-ubuntu-server):

Error: (2, 'Invalid kernel', 'elf_xen_note_check: ERROR: Will only load images built for the generic loader or Linux images')

Does anybody know what I need to do? Running 32 bit and hardware virtualization is out of the question (has to be paravirtualized).

Perhaps I am not supposed to install the master grub boot loader in the guest but alter the one for my host OS?


Update

I have managed to use xm create instead of virt-install in order to get to the point where I startup with a bootloader before the error as seen here:
enter image description here
I think the issue is because I don't have an pygrub option to select a 'virtual' kernel instead.
I have failed to discover how to add the virtual kernel to the domU (preferably at the install stage). I would have thought that the xen netboot image would have installed with this but I guess not.

My xm create script is as such:

name = 'client1-ubuntu-32'
memory = 512
disk = ['phy:/dev/ubu-32/xen-lvm,xvda,w']
vif = [' ']

# Comment this out if uncommenting the next section (installing)
#bootloader="/usr/bin/pygrub"

# This section is for installing ubuntu
kernel = "/var/lib/xen/images/ubuntu-netboot/vmlinuz"
ramdisk = "/var/lib/xen/images/ubuntu-netboot/initrd.gz"
extra = "debian-installer/exit/always_halt=true -- console=hvc0"

Best Answer

It turns out you can install grub to the PV guest with the use of pygrub.

The trick in the end was to use the 'manual package selection' at the apt/task menu in order to remove the generic kernels and install the virtual one instead. (You have to use shift-+ to add a package and shift-minus to remove them when highlighted). I have only tested this with using the xm create command with pygrub as one of the parameters. As the virtual kernel was selected by default I'm guessing this fix may also work with using virt-install (but not tested)

You also have to ensure that you change the default partitioning from using ext4 to using ext3 for this to work. I don't know if it's a pygrub specific issue or not.

This manual package selection is pain. Worth looking into a way to use the minimal virtual install mentioned here: