Using PV-GRUB on Jessie to boot a domU kernel

By using PV-GRUB from grub2, each domU can boot with its own kernel instead of using the dom0 kernel, which makes life easier for updates and multi distribution Xen installs. You need to have first a working domU. The domU /boot FileSystem can be anything that grub2 supports.

The idea is to put a PV-GRUB binary in dom0's /boot, which you can use as a kernel to boot domUs instead of a linux kernel. PV-GRUB will thus run inside the domU, and access the domU filesystem to get grub.cfg, and then the kernel installed in the domU filesystem, and boot it from inside the domU.

This PV-GRUB is completely independent from the way you boot dom0 itself.

On the dom0

For 64bit domUs, use grub-x86_64-xen.bin, and for 32bit domUs, use grub-i386-xen.bin.

Config snippet:

kernel          = /usr/lib/grub-xen/grub-x86_64-xen.bin
extra           = '(hd1)/boot/grub/grub.cfg'
root            = ''
disk        = [
                  'phy:/dev/vg05/test2.openforce.com-swap,xvda1,w',
                  'phy:/dev/vg05/test2.openforce.com-disk,xvda2,w',
              ]

On the domU

mkdir /boot/grub
apt-get install linux-image-amd64

And you are done

Shutdown your domU completely, re-create it, it should boot grub2 and pick up your domU's grub.cfg to show the menu. Kernels upgrades can now be done from inside the domU by just upgrading the kernel and rebooting, without even having to destroy the domain.

grub1

It is also possible to use a grub1 version of pv-grub, although the support is not maintained so much, so there is no reason to use it instead of grub2, unless your domU really has no way to generate a grub2-like grub.cfg

On the dom0

You need to build xen from source, the pv-grub1 binaries will be available in xen/stubdom/mini-os-x86_32-grub/mini-os.gz and xen/stubdom/mini-os-x86_64-grub/mini-os.gz , which you can copy into /boot/pv-grub1-32.gz and /boot/pv-grub1-64.gz for instance. The configuration file is then grub1-style:

Config snippet:

kernel          = /boot/pv-grub1-64.gz
extra           = '(hd1)/boot/grub/menu.lst'
root            = ''
disk        = [
                  'phy:/dev/vg05/test2.openforce.com-swap,xvda1,w',
                  'phy:/dev/vg05/test2.openforce.com-disk,xvda2,w',
              ]

On the domU

mkdir /boot/grub
apt-get install linux-image-amd64

And you are done

Shutdown your domU completely, re-create it, it should boot grub1 and pick up your domU's menu.lst to show the menu. Kernels upgrades can now be done from inside the domU by just upgrading the kernel and rebooting, without even having to destroy the domain.