SiteHost

Changing Linux Kernel

PV-Grub allows you to boot your VPS with a locally installed kernel that supports pv_ops (stable in kernels 2.6.24 and greater). The flexibility of using a custom kernel can allow you to keep up-to-date with your distributions latest security patches, to test the latest kernels from kernel.org, and can help in situations where resources are limited or custom functionality is required.

How does PV-Grub work?

Your VPS will first boot a custom "Mini-OS" kernel based on the Grub Bootloader. This will search the "/boot/grub/" directory for a "menu.lst" file, which defines where your installed kernels are located. The specified kernel is then loaded into memory and "kexec" is used to boot the specified kernel.

Switching to PV-Grub can result in a non-bootable VPS if it is not configured correctly. If your VPS does not boot then please switch the VPS back to the default recommended kernel.

Requirements

  • Installed kernel with pv_ops.
  • Grub Legacy boot menu.

The following guides are for Ubuntu Precise, Debian Squeeze and CentOS 6.3. These procedures may be applicable to other versions of these distributions.

If the VPS has recently been provisioned and the file '/boot/grub/menu.lst' exists, the VPS is already configured to use PV-Grub with the default kernel.

Ubuntu Precise (12.04) with default kernel

To use PV-Grub, Grub 2 should be removed if it is installed:
root@host:~# apt-get purge grub2 grub-pc

Confirm that you want to remove Grub2 and the associated files.

Install Grub legacy and the virtual kernel metapackage:
root@host:~# apt-get install linux-virtual grub-legacy-ec2

  • grub-legacy-ec2 provides a way to keep /boot/grub/menu.1st up to date, providing update-grub-legacy-ec2.

The Package configuration will ask to create a grub menu file and will also ask for the drive(s) to install grub on - do not select any devices.

Edit /boot/grub/menu.lst, and change the groot to (hd1):
# groot=(hd1)

(Re)generate the Grub menu:
root@host:~# update-grub-legacy-ec2

Debian Squeeze (6.0) with default kernel

Create the grub directory:
root@host:~# mkdir -p /boot/grub
root@host:~# echo 0 > /boot/grub/default

Install Grub legacy and the kernel package:
root@host:~# apt-get install grub-legacy linux-image-xen-amd64

  • Change your architecture as required.

Update the grub menu:

root@host:~# sed s@'# kopt=.*'@'# kopt=root=/dev/xvda2 console=hvc0 ro'@g --in-place /boot/grub/menu.lst  
root@host:~# sed s@'# groot=.*'@'# groot=(hd1)'@g --in-place /boot/grub/menu.lst  
root@host:~# update-grub

CentOS 6.3 with default kernel

Install the latest EL Kernel: [root@host ~]# yum install kernel.x86_64

(Re)create the grub menu /boot/grub/menu.lst:

default=0  
timeout=5  

title PV Grub Kernel  
   root (hd1)  
   kernel /boot/vmlinuz-xxx.el6.x86_64 ro console=hvc0 root=/dev/xvda2  
   initrd /boot/initramfs-xxx.el6.x86_64.img

Enabling PV-Grub

From the control panel locate your VPS and enable PV-GRUB.