PV-GRUB makes it possible to run your own kernel on your Linode, instead of using a host-supplied kernel. This is useful in cases where you'd like to enable specific kernel features, or for cases where you'd prefer handling kernel upgrades directly.
This guide assumes you have already followed the steps outlined in our getting started guide, and that your Linode is in a functional state. These steps should be performed as root on your Linode via an SSH session.
If you'd like to run a custom distro on your Linode in combination with PV-GRUB, please follow our custom distro guide before taking these steps.
Contents
Make sure your package repositories and installed packages are up to date by issuing the following commands.
apt-get update apt-get upgrade --show-upgraded
Issue the following commands to install the default kernel for Ubuntu 11.04, uninstall grub2, and install grub. When you are asked which devices you would like to install grub on, leave all listed devices unchecked and select "Ok" to continue. When you are asked whether you would like to continue without installing GRUB, and "yes." When you are asked to confirm removal of GRUB 2 from /boot/grub, answer "yes." When you are asked whether you would like a menu.lst file generated for you, answer "yes."
apt-get install linux-virtual apt-get purge grub2 grub-pc apt-get install grub mkdir /boot/grub update-grub
Edit the /boot/grub/menu.lst file as follows. As noted in the file, please do not "uncomment" entries that begin with the "#" character. First, locate the following excerpt.
File excerpt:/boot/grub/menu.lst
timeout 3
Change it to match the following excerpt. This will give you a bit of additional time at boot to select your desired kernel, in case you feel the need to go back to an older one in the future.
File excerpt:/boot/grub/menu.lst
timeout 10
Next, locate the line containing "kopt" that resembles the following excerpt.
File excerpt:/boot/grub/menu.lst
# kopt=root=UUID=de400b9f-2578-488e-8664-250a8455a6fc ro
Change it to match the following excerpt.
File excerpt:/boot/grub/menu.lst
# kopt=root=/dev/xvda console=hvc0 ro quiet
Next, locate the line containing "groot" that resembles the following excerpt.
File excerpt:/boot/grub/menu.lst
# groot=de400b9f-2578-488e-8664-250a8455a6fc
Change it to match the following excerpt.
File excerpt:/boot/grub/menu.lst
# groot=(hd0)
Issue the following command to update grub.
update-grub
Create the file /etc/init/hvc0.conf with the following contents.
File:/etc/init/hvc0.conf
# hvc0 - getty
#
# This service maintains a getty on hvc0 from the point the system is
# started until it is shut down again.
start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]
respawn
exec /sbin/getty -8 38400 hvc0
In the Linode Manager, edit your Linode's configuration profile to use either pv-grub-x86_32 or pv-grub-x86_64 as the kernel, depending on the version of Ubuntu you have deployed (32-bit or 64-bit). Make sure the root device is specified as xvda. In the "Filesystem/Boot Helpers" section, disable the "Xenify distro" option. Save your changes by clicking "Save Profile" at the bottom of the page, and reboot your Linode from the "Dashboard" tab.
Once your Linode has rebooted, log back into it and issue the command "uname -a". You should see output similar to the following, indicating you're running the native kernel:
Linux li263-140 2.6.38-8-virtual #42-Ubuntu SMP Mon Apr 11 07:04:38 UTC 2011 i686 i686 i386 GNU/Linux
Make sure your package repositories and installed packages are up to date by issuing the following commands.
apt-get update apt-get upgrade --show-upgraded
Issue the following commands to install the default kernel for Ubuntu 10.04 LTS, uninstall grub2, and install grub. When you are asked whether you would like to continue without installing GRUB, and "yes." When you are asked to confirm removal of GRUB 2 from /boot/grub, answer "yes." When you are asked whether you would like a menu.lst file generated for you, answer "yes."
apt-get install linux-virtual apt-get purge grub2 grub-pc rm -f /boot/grub/* apt-get install grub update-grub
Edit the /boot/grub/menu.lst file as follows. As noted in the file, please do not "uncomment" entries that begin with the "#" character. First, locate the following excerpt.
File excerpt:/boot/grub/menu.lst
timeout 3
Change it to match the following excerpt. This will give you a bit of additional time at boot to select your desired kernel, in case you feel the need to go back to an older one in the future.
File excerpt:/boot/grub/menu.lst
timeout 10
Next, locate the line containing "kopt" that resembles the following excerpt.
File excerpt:/boot/grub/menu.lst
# kopt=root=UUID=de400b9f-2578-488e-8664-250a8455a6fc ro
Change it to match the following excerpt.
File excerpt:/boot/grub/menu.lst
# kopt=root=/dev/xvda console=hvc0 ro quiet
Next, locate the line containing "groot" that resembles the following excerpt.
File excerpt:/boot/grub/menu.lst
# groot=de400b9f-2578-488e-8664-250a8455a6fc
Change it to match the following excerpt.
File excerpt:/boot/grub/menu.lst
# groot=(hd0)
Issue the following command to update grub.
update-grub
Create the file /etc/init/hvc0.conf with the following contents.
File:/etc/init/hvc0.conf
# hvc0 - getty
#
# This service maintains a getty on hvc0 from the point the system is
# started until it is shut down again.
start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]
respawn
exec /sbin/getty -8 38400 hvc0
In the Linode Manager, edit your Linode's configuration profile to use either pv-grub-x86_32 or pv-grub-x86_64 as the kernel, depending on the version of Ubuntu you have deployed (32-bit or 64-bit). Make sure the root device is specified as xvda. In the "Filesystem/Boot Helpers" section, disable the "Xenify distro" option. Save your changes by clicking "Save Profile" at the bottom of the page, and reboot your Linode from the "Dashboard" tab.
Once your Linode has rebooted, log back into it and issue the command "uname -a". You should see output similar to the following, indicating you're running the native kernel:
Linux li263-140 2.6.32-31-generic-pae #61-Ubuntu SMP Fri Apr 8 20:00:13 UTC 2011 i686 GNU/Linux
Make sure your package repositories and installed packages are up to date by issuing the following commands.
apt-get update apt-get upgrade --show-upgraded
Issue the following commands to install the default kernel for Debian 6, along with the grub bootloader package.
32-bit Debian:
apt-get install linux-image-xen-686 mkdir /boot/grub apt-get install grub-legacy
64-bit Debian:
apt-get install linux-image-xen-amd64 mkdir /boot/grub apt-get install grub-legacy
Issue the following commands to generate an initial /boot/grub/menu.lst file.
grub-set-default 1 update-grub
Edit the /boot/grub/menu.lst file as follows. As noted in the file, please do not "uncomment" entries that begin with the "#" character. First, locate the following excerpt.
File excerpt:/boot/grub/menu.lst
timeout 5
Change it to match the following excerpt. This will give you a bit of additional time at boot to select your desired kernel, in case you feel the need to go back to an older one in the future.
File excerpt:/boot/grub/menu.lst
timeout 10
Next, locate the line containing "kopt" that resembles the following excerpt.
File excerpt:/boot/grub/menu.lst
# kopt=root=UUID=de400b9f-2578-488e-8664-250a8455a6fc ro
Change it to match the following excerpt.
File excerpt:/boot/grub/menu.lst
# kopt=root=/dev/xvda console=hvc0 ro quiet
Next, locate the line containing "groot=" and verify that it matches the following excerpt.
File excerpt:/boot/grub/menu.lst
# groot=(hd0)
Issue the following command to update grub.
update-grub
In the Linode Manager, edit your Linode's configuration profile to use either pv-grub-x86_32 or pv-grub-x86_64 as the kernel, depending on the version of Ubuntu you have deployed (32-bit or 64-bit). Make sure the root device is specified as xvda. In the "Filesystem/Boot Helpers" section, disable the "Xenify distro" option. Save your changes by clicking "Save Profile" at the bottom of the page, and reboot your Linode from the "Dashboard" tab.
Once your Linode has rebooted, log back into it and issue the command "uname -a". You should see output similar to the following, indicating you're running the native kernel.
Linux li263-140 2.6.32-5-xen-686 #1 SMP Wed May 18 09:43:15 UTC 2011 i686 GNU/Linux
Before proceeding, make sure your package repositories and installed packages are up to date by issuing the following commands:
apt-get update apt-get upgrade --show-upgraded
Issue the following commands to install the default kernel for Debian 5 (Lenny) and create a directory for your menu.lst file.
32-bit Debian:
apt-get install linux-image-xen-686 mkdir /boot/grub
64-bit Debian:
apt-get install linux-image-xen-amd64 mkdir /boot/grub
Create a file named /boot/grub/menu.lst with the following contents. Adjust the "title", "kernel", and "initrd" lines to reflect the actual filenames found in the /boot directory.
File:/boot/grub/menu.lst
timeout 5
title Debian GNU/Linux, kernel 2.6.26-2-xen-686
root (hd0)
kernel /boot/vmlinuz-2.6.26-2-xen-686 root=/dev/xvda ro quiet
initrd /boot/initrd.img-2.6.26-2-xen-686
In the Linode Manager, edit your Linode's configuration profile to use either pv-grub-x86_32 or pv-grub-x86_64 as the "Kernel", depending on the version of Debian you have deployed (32-bit or 64-bit). Make sure the root device is specified as xvda. Save your changes by clicking "Save Profile" at the bottom of the page, and reboot your Linode from the "Dashboard" tab.
Once your Linode has rebooted, log back into it and issue the command "uname -a". You should see output similar to the following, indicating you're running the native kernel:
Linux li175-165 2.6.26-2-xen-686 #1 SMP Mon Jun 21 10:37:05 UTC 2010 i686 GNU/Linux
Note that if you install an updated kernel, you'll need to add an entry for it to your menu.lst file. By default, the first kernel in the list will be booted.
Warren Togami was kind enough to provide a script to automate the work of getting a native CentOS 5 kernel up and running, including SELinux support. Issue the following commands as root to retrieve and run the script:
wget -O selinux.sh http://library.linode.com/assets/542-centos5-native-kernel-selinux-enforcing.sh chmod +x selinux.sh ./selinux.sh
Once the script has finished, edit your Linode's configuration profile. Change the "Kernel" to pv-grub-x86_32 or pv-grub-x86_64, depending on which version of CentOS (32-bit or 64-bit) you're running. Set the "Xenify Distro" and "Automount devtmpfs" options to "No." Click the "Save Changes" button, and reboot your Linode from the "Dashboard" tab.
Once your Linode has rebooted, log back into it as root and issue the following command:
restorecon -Rv /
Your Linode should now be running a native CentOS 5 kernel. You can verify this by issuing the command "uname -a". You should see output similar to the following:
[root@li181-194 ~]# uname -a Linux li181-194 2.6.18-194.26.1.el5xen #1 SMP Tue Nov 9 14:13:46 EST 2010 i686 i686 i386 GNU/Linux
Before proceeding, make sure your package repositories and installed packages are up to date by issuing the following command:
yum update
Edit the file /boot/grub/grub.conf to resemble the following example, changing the title, kernel, and initrd lines to reflect the actual entries found in the /boot directory.
File:/boot/grub/grub.conf
# boot=/dev/xvda
# kopt=root=/dev/xvda console=tty0 console=hvc0 ro quiet
# groot=(hd0)
default=0
timeout=5
title Fedora (2.6.38.7-30.fc15.i686.PAE)
root (hd0)
kernel /boot/vmlinuz-2.6.38.7-30.fc15.i686.PAE root=/dev/xvda console=tty0 console=hvc0 ro quiet
initrd /boot/initramfs-2.6.38.7-30.fc15.i686.PAE.img
title Fedora (2.6.38.6-27.fc15.i686.PAE)
root (hd0)
kernel /boot/vmlinuz-2.6.38.6-27.fc15.i686.PAE root=/dev/xvda console=tty0 console=hvc0 ro quiet
initrd /boot/initramfs-2.6.38.6-27.fc15.i686.PAE.img
In the Linode Manager, edit your Linode's configuration profile to use either pv-grub-x86_32 or pv-grub-x86_64 as the "Kernel", depending on the version of Fedora you have deployed (32-bit or 64-bit). Make sure the root device is specified as xvda. Save your changes by clicking "Save Profile" at the bottom of the page, and reboot your Linode from the "Dashboard" tab.
Once your Linode has rebooted, log back into it and issue the command "uname -a". You should see output similar to the following, indicating you're running the native kernel.
Linux li263-140 2.6.38.7-30.fc15.i686.PAE #1 SMP Fri May 27 05:44:56 UTC 2011 i686 i686 i386 GNU/Linux
Before proceeding, make sure your package repositories and installed packages are up to date by issuing the following command:
yum update
Issue the following commands to install the default kernel for Fedora 13:
32-bit Fedora:
yum install kernel-PAE.i686
64-bit Fedora:
yum install kernel.x86_64
Create a file named /boot/grub/menu.lst with the following contents. Adjust the "title", "kernel", and "initrd" lines to reflect the actual filenames found in the /boot/ directory.
File:/boot/grub/menu.lst
timeout 5
title Fedora 13, kernel 2.6.33.6-147.fc13.i686.PAE
root (hd0)
kernel /boot/vmlinuz-2.6.33.6-147.fc13.i686.PAE root=/dev/xvda ro quiet
initrd /boot/initramfs-2.6.33.6-147.fc13.i686.PAE.img
In the Linode Manager, edit your Linode's configuration profile to use either pv-grub-x86_32 or pv-grub-x86_64 as the "Kernel", depending on the version of Fedora you have deployed (32-bit or 64-bit). Make sure the root device is specified as xvda. Save your changes by clicking "Save Profile" at the bottom of the page, and reboot your Linode from the "Dashboard" tab.
Once your Linode has rebooted, log back into it and issue the command "uname -a". You should see output similar to the following, indicating you're running the native kernel:
Linux li175-165 2.6.33.6-147.fc13.i686.PAE #1 SMP Tue Jul 6 22:24:44 UTC 2010 i686 i686 i386 GNU/Linux
Note that if you install an updated kernel, you'll need to add an entry for it to your menu.lst file. By default, the first kernel in the list will be booted.
This guide is licensed under a Creative Commons Attribution-NoDerivs 3.0 United States License.
Last edited by Phil Paradis on Monday, June 13th, 2011 (r2230).