Grub 2

grub2 has added support for Xen 32- and 64-bit paravirtualization.

Pre-Generated Distributions

The distributions available on /distros may have a config file available for grub2, but they have not been edited to be sane (for example, the search path for root includes a UUID.) You will need to regenerate the file using the tools for your distribution.

Changing bootloader

32-bit grub2 is available on the platforms that support it. On the ones that don’t, switching from pv-grub to grub2 will force 64-bit mode and switching from 64-bit to 32-bit mode will force pv-grub.

Log into the VPS console. Select option 9 to switch between pv-grub and grub2.

If 32-bit grub2 is not available and “i386” is the current bootloader, you will see:

9. swap pvgrub/grub2 bootloaders currently "pv-grub"
   This will also switch from i386 to amd64.

0. exit

If 32-bit grub2 is available and “i386” is the current bootloader, you will see:

9. swap pvgrub/grub2 bootloaders currently "grub2"

0. exit

Rescue Image

grub2 boots directly to your hard drive because the rescue image will not attempt to load any grub2 configuration files. To use the rescue image, either switch back to pv-grub or do the following at the grub2 prompt:

                  GNU GRUB  version 2.02~beta2-9ubuntu1+prgmr1

   Minimal BASH-like line editing is supported. For the first word, TAB   
   lists possible command completions. Anywhere else TAB lists possible   
   device or file completions. ESC at any time exits.                     

grub> set root='xen/xvde,msdos1'
grub> legacy_configfile /boot/grub/menu.lst

Compatible file systems

The following file systems have been tested:

With these file systems available without having been tested:

Config file search paths

The following configuration file is compiled into the grub2 image:

insmod part_msdos
insmod part_bsd
insmod part_gpt

for part in msdos1 gpt1 bsd1; do
    for maindir in boot/ /; do
        for subdir in grub grub2; do
            if [ -f "(xen/xvda,$part)/$maindir/$subdir/grub.cfg" ]; then
                set root=(xen/xvda,$part)
                configfile /$maindir/$subdir/grub.cfg

if [ -f "(xen/xvda,msdos1)/boot/grub/menu.lst" ] ; then
  set root=(xen/xvda,msdos1)
  legacy_configfile /boot/grub/menu.lst

set root=(xen/xvde,msdos1)
legacy_configfile /boot/grub/menu.lst

The nested for loop will search first in (xen/xvda,msdos1)/boot/grub/grub.conf, then (xen/xvda,msdos1)/boot/grub2/grub.conf, and so forth.

Development background

The base source code is pulled from Ubuntu Trusty. The following patches were applied:

To generate the executables:

$ grub-mkstandalone --compress=gz -O i386-xen -o grub2-x86_32.gz boot/grub/grub.cfg
$ grub-mkstandalone --compress=gz -O x86_64-xen -o grub2-x86_64.gz boot/grub/grub.cfg