Home > Support > HOWTO List > pv-grub

pv-grub

pv-grub allows a Xen VPS (domU) to boot a kernel that is stored inside the domU filesystem. This means that the kernel supplied by the distribution can be used, and allows the use of kernel modules.

By default we setup VPSs with an external kernel (one that is stored on the host).  RimuHosting builds and tests the external kernels before making them available via our kernel change tool. The external kernels we provide do not allow kernel modules.

When to use pv-grub

Use pv-grub if you want to compile/use custom kernel modules (e.g. to include code from outside the kernel.org tree).

Use pv-grub if you want to use a standard kernel module we have not enabled in our kernels (but also please email us and let us know what that module is, so we can include it by default if it is useful for others).

Use pv-grub if you want to be responsible for upgrading kernel versions (e.g. to use the kernel version provided by your distro).

If your VPS is already configured for pv-grub (pv-grub will be selected in our kernel change tool) you should leave it as-is.

Use the external (RimuHosting-provided) kernel if you want your VPS to run tried-and-tested kernels.  Every now and then we find that a kernel.org kernel does not work that well on Xen domU servers (though most new ones seem pretty good as at April 2012).

Use the RimuHosting-provided kernel if you want us to update the kernel if we find stability or security issues so that your server uses it on its next reboot.

Enabling pv-grub

Before enabling pv-grub you will need to install a kernel and setup GRUB inside your VPS.

Enabling pv-grub varies by distribution. The kernel you use will need to have Xen domU support. Most modern distributions provide domU kernels out of the box. We have instructions below for all of our current distributions. Once the kernel is installed and GRUB is configured simply select pv-grub from our kernel change tool here: https://rimuhosting.com/cp/vps/kernel.jsp

If you hit any issues with pv-grub you can use our kernel change tool to revert back to the 'default' kernel listed there. You do not need to do anything else to revert - our scripts will take care of it as part of the kernel change process. You may want to then remove any additional packages you installed (e.g. the kernel and GRUB packages).

Debian

For 32bit systems:

apt-get install grub-legacy linux-image-686-pae

For 64bit systems:

apt-get install grub-legacy linux-image-amd64

Then update the root devices in grub.conf:

mkdir -p /boot/grub
echo 0 > /boot/grub/default
update-grub
sed s@'# kopt=.*'@'# kopt=root=/dev/xvda1 console=hvc0 ro'@g --in-place /boot/grub/menu.lst
sed s@'# groot=.*'@'# groot=(hd0)'@g --in-place /boot/grub/menu.lst
update-grub
ln -sf /boot/grub/menu.lst /boot/grub/grub.conf

For "Squeeze: and older, same as above, but the kernel package to use is "linux-image-xen-amd64" for 64 bit, or "linux-image-xen-686-pae" for 32 bit systems.

CentOS

Install a kernel:

yum install kernel

Create /boot/grub/grub.conf manually, adding a default entry e.g.:

default=0
timeout=5

title CentOS (2.6.32-220.4.2.el6.x86_64)
root (hd0)
kernel /boot/vmlinuz-2.6.32-220.4.2.el6.x86_64 root=/dev/xvda1 console=hvc0 ro
initrd /boot/initramfs-2.6.32-220.4.2.el6.x86_64.img

For 'grubby' to work (sets up grub entries automatically) you may also need these:

ln -sf /boot/grub/grub.conf /boot/grub/menu.lst
ln -sf /boot/grub/grub.conf /etc/grub.conf 

Running 'grubby --default-kernel' should hopefully work without any errors. And if so future kernels installed with yum or RPM should be added to grub.conf.

Ubuntu

Install the grub-legacy-ec2 package and kernel. Then remove grub2:

apt-get install grub-legacy-ec2 linux-image-virtual
apt-get remove --purge grub2 
ln -sf /boot/grub/menu.lst /boot/grub/grub.conf 

You may need to properly fix the root parameter in the /boot/grub/menu.lst file, to point to the correct device, This will do the trick:

rm -f /boot/grub/menu.lst
update-grub-legacy-ec2 -y
sed s@'# kopt=.*'@'# kopt=root=/dev/xvda1 console=hvc0 ro'@g --in-place /boot/grub/menu.lst
update-grub-legacy-ec2