Run a Distribution-Supplied Kernel with PV-GRUB
Updated by James Stewart Written by Linode
DeprecatedThis guide has been deprecated and is no longer being maintained.
CautionThis guide is for legacy Xen Linodes. For newer Linodes, consult our guide on how to Run a Distribution-Supplied Kernel.
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 you’d prefer to handle kernel upgrades directly.
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.
Before you get started, make sure you follow the steps outlined in our Getting Started guide. Your Linode needs to be in a functional state. These steps should be performed as root
on your Linode, via an SSH session.
Ubuntu 13.04 (Raring)
Update your package repositories and upgrade your installed packages by issuing the following commands:
apt-get update apt-get upgrade --show-upgraded
Issue the following commands to install the default kernel for Ubuntu 13.04, uninstall
grub2
, and installgrub
:apt-get install linux-image-virtual apt-get purge grub2 grub-pc apt-get install grub mkdir /boot/grub update-grub
When you are asked which devices you would like to install
grub
on, leave all listed devices unchecked and selectOk
to continue. When you are asked whether you would like to continue without installing GRUB, answeryes
. When you are asked to confirm removal of GRUB 2 from/boot/grub
, answeryes
. When you are asked whether you would like amenu.lst
file generated for you, answeryes
.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:- /boot/grub/menu.lst
-
1
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.
- /boot/grub/menu.lst
-
1
timeout 10
Next, locate the line containing
kopt
that resembles the following excerpt:- /boot/grub/menu.lst
-
1
# kopt=root=UUID=de400b9f-2578-488e-8664-250a8455a6fc ro
Change it to match the following excerpt:
- /boot/grub/menu.lst
-
1
# kopt=root=/dev/xvda console=hvc0 ro quiet
Next, locate the line containing
groot
that resembles the following excerpt:- /boot/grub/menu.lst
-
1
# groot=(hd0,0)
Change it to match the following excerpt:
- /boot/grub/menu.lst
-
1
# groot=(hd0)
Issue the following command to update
grub
:update-grub
Next, open the file
/etc/init/hvc0.conf
and verify that it matches the following excerpt:- /etc/init/hvc0.conf
-
1 2 3 4 5 6 7 8 9 10
# 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 Distro Helper option.
Save your changes by clicking Save Profile at the bottom of the page.
Reboot your Linode from the Dashboard tab.
Once your Linode has rebooted, log in via SSH and issue the following command:
uname -a
You should see output similar to the following, indicating that you’re running the native kernel:
Linux li63-119 3.8.0-29-generic #42-Ubuntu SMP Tue Aug 13 19:40:39 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
Ubuntu 12.04 (Precise)
Update your package repositories and upgrade your installed packages by issuing the following commands:
apt-get update apt-get upgrade --show-upgraded
Issue the following commands to install the default kernel for Ubuntu 12.04, uninstall
grub2
, and installgrub
:apt-get install linux-virtual apt-get purge grub2 grub-pc apt-get install grub update-grub
When you are asked which devices you would like to install
grub
on, leave all listed devices unchecked and selectOk
to continue. When you are asked whether you would like to continue without installing GRUB, answeryes
. When you are asked to confirm removal of GRUB 2 from/boot/grub
, answeryes
. When you are asked whether you would like amenu.lst
file generated for you, answeryes
.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:- /boot/grub/menu.lst
-
1
timeout 3
Edit the file 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.
- /boot/grub/menu.lst
-
1
timeout 10
Next, locate the line containing
kopt
that resembles the following excerpt:- /boot/grub/menu.lst
-
1
# kopt=root=UUID=de400b9f-2578-488e-8664-250a8455a6fc ro
Edit it to match the following excerpt:
- /boot/grub/menu.lst
-
1
kopt=root=/dev/xvda console=hvc0 ro quiet
Next, locate the line containing “groot” that resembles the following excerpt:
- /boot/grub/menu.lst
-
1
# groot=(hd0,0)
Change it to match the following excerpt:
- /boot/grub/menu.lst
-
1
# groot=(hd0)
Issue the following command to update
grub
:update-grub
Next, open the file “/etc/init/hvc0.conf” and verify that it matches the following excerpt:
- /etc/init/hvc0.conf
-
1 2 3 4 5 6 7 8 9 10
# 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 Distro Helper option.
Save your changes by clicking Save Profile at the bottom of the page.
Reboot your Linode from the Dashboard tab.
Once your Linode has rebooted, log in via SSH and issue the following command:
uname -a
You should see output similar to the following, indicating you’re running the native kernel:
Linux localhost 3.2.0-52-virtual #78-Ubuntu SMP Fri Jul 26 16:45:00 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
Ubuntu 10.04 LTS (Lucid)
Update your package repositories and upgrade your installed packages 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 installgrub
:apt-get install linux-virtual apt-get purge grub2 grub-pc rm -f /boot/grub/* apt-get install grub update-grub
When you are asked whether you would like to continue without installing GRUB, answer
yes
. When you are asked to confirm removal of GRUB 2 from/boot/grub
, answeryes
. When you are asked whether you would like amenu.lst
file generated for you, answeryes.
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:- /boot/grub/menu.lst
-
1
timeout 3
Edit this line 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.
- /boot/grub/menu.lst
-
1
timeout 10
Next, locate the line containing
kopt
that resembles the following excerpt:- /boot/grub/menu.lst
-
1
# kopt=root=UUID=de400b9f-2578-488e-8664-250a8455a6fc ro
Change it to match the following excerpt:
- /boot/grub/menu.lst
-
1
# kopt=root=/dev/xvda console=hvc0 ro quiet
Next, locate the line containing
groot
that resembles the following excerpt:- /boot/grub/menu.lst
-
1
# groot=de400b9f-2578-488e-8664-250a8455a6fc
Change it to match the following excerpt:
- /boot/grub/menu.lst
-
1
# groot=(hd0)
Issue the following command to update
grub
:update-grub
Create the file
/etc/init/hvc0.conf
with the following contents:- /etc/init/hvc0.conf
-
1 2 3 4 5 6 7 8 9 10
# 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 Distro Helper option.
Save your changes by clicking Save Profile at the bottom of the page.
Reboot your Linode from the Dashboard tab.
Once your Linode has rebooted, log in via SSH and issue the following 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
Debian 7 (Wheezy) / Debian 8 (Jessie)
Update your package repositories and upgrade your installed packages by issuing the following commands:
apt-get update apt-get upgrade --show-upgraded
Issue the following commands to install the default kernel for Debian 7, along with the
grub
bootloader package:32-bit Debian: :
apt-get install linux-image-686-pae mkdir /boot/grub apt-get install grub-legacy
64-bit Debian: :
apt-get install linux-image-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:- /boot/grub/menu.lst
-
1
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.
- /boot/grub/menu.lst
-
1
timeout 10
Next, locate the line containing
kopt
that resembles the following excerpt:- /boot/grub/menu.lst
-
1
# kopt=root=UUID=de400b9f-2578-488e-8664-250a8455a6fc ro
Change it to match the following excerpt:
- /boot/grub/menu.lst
-
1
# kopt=root=/dev/xvda console=hvc0 ro quiet
Next, locate the line containing
groot=
and verify that it matches the following excerpt:- /boot/grub/menu.lst
-
1
# 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 Debian 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 Distro Helper option.
Save your changes by clicking Save Profile at the bottom of the page.
Reboot your Linode from the Dashboard tab.
Once your Linode has rebooted, log in via SSH and issue the following 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
Debian 6 (Squeeze)
Update your package repositories and upgrade your installed packages 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:- /boot/grub/menu.lst
-
1
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:
- /boot/grub/menu.lst
-
1
timeout 10
Next, locate the line containing
kopt
that resembles the following excerpt:- /boot/grub/menu.lst
-
1
# kopt=root=UUID=de400b9f-2578-488e-8664-250a8455a6fc ro
Change it to match the following excerpt:
- /boot/grub/menu.lst
-
1
# kopt=root=/dev/xvda console=hvc0 ro quiet
Next, locate the line containing
groot=
and verify that it matches the following excerpt:- /boot/grub/menu.lst
-
1
# 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 Debian 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 Distro Helper option.
Save your changes by clicking Save Profile at the bottom of the page.
Reboot your Linode from the Dashboard tab.
Once your Linode has rebooted, log in via SSH and issue the following 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
CentOS 6 and Newer
Make sure your package repositories and installed packages are up to date by issuing the following command:
yum update
Run the following command to identify the kernel your CentOS system has provided:
uname -a
This command should provide output similar to that shown below:
Linux li63-119 2.6.32-358.14.1.el6.x86_64 #1 SMP Tue Jul 16 23:51:20 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
Make a note of the kernel you’re currently using (
2.6.32-358.14.1.el6.x86_64
in our example). You will be replacing it with the kernel shown in the configuration below.Issue the following command to install the default kernel for CentOS6:
32-bit CentOS: :
yum install kernel-PAE.i686
64-bit CentOS: :
yum install kernel.x86_64
Create a file named
/boot/grub/menu.lst
with the following contents. Adjust thetitle
,kernel
, andinitrd
lines to reflect the actual file names found in the/boot/
directory.- /boot/grub/menu.lst
-
1 2 3 4 5
timeout 5 title CentOS (2.6.32-431.23.3.el6.x86_64) root (hd0) kernel /boot/vmlinuz-2.6.32-431.23.3.el6.x86_64 root=/dev/xvda initrd /boot/initramfs-2.6.32-431.23.3.el6.x86_64.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 CentOS 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.
Reboot your Linode from the Dashboard tab.
Once your Linode has rebooted, log in via SSH and issue the following command:
uname -a
You should see output similar to the following, indicating you’re running the native kernel:
Linux li63-119 2.6.32-358.14.1.el6.x86_64 #1 SMP Tue Jul 16 23:51:20 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
CentOS 5
Warren Togami was kind enough to provide a script to automate getting a native CentOS 5 kernel up and running, including with SELinux support. We will use this script in the following instructions.
Issue the following commands as
root
to retrieve and run the script:wget -O selinux.sh http://www.linode.com/docs/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 Distro Helper and Automount devtmpfs options to No.
Click the Save Changes button.
Reboot your Linode from the Dashboard tab.
Once your Linode has rebooted, log in via SSH 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 following command:
uname -a
You should see output similar to the following:
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
Fedora 17
Make sure your package repositories and installed packages are up to date by issuing the following command:
yum update
Issue the following command 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 thetitle
,kernel
, andinitrd
lines to reflect the actual file names found in the/boot/
directory.- /boot/grub/menu.lst
-
1 2 3
timeout 5 title Fedora 17, kernel 3.9.10-100.fc17.x86\_64 root (hd0) kernel /boot/vmlinuz-3.9.10-100.fc17.x86\_64 root=/dev/xvda ro quiet initrd /boot/initramfs-3.9.10-100.fc17.x86\_64.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.
Reboot your Linode from the Dashboard tab.
Once your Linode has rebooted, log in via SSH and issue the following command:
uname -a
You should see output similar to the following, indicating you’re running the native kernel:
Linux li63-119 3.9.10-100.fc17.x86_64 #1 SMP Sun Jul 14 01:31:27 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
Note that if you later 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.
Join our Community
Find answers, ask questions, and help others.
This guide is published under a CC BY-ND 4.0 license.