Save 15% on Instant Deploy Bare-Metal Servers in 26 Global Markets with Coupon Code: EdgeSave

Change the default kernel that boots from GRUB

The GRUB configuration file can be found in /boot/grub/.

[root@root /boot/grub]# ls -la grub.conf menu.lst
-rw——-    1 root     root         1037 Oct 28 11:41 grub.conf
lrwxr-xr-x    1 root     root           11 Jan  1  2003 menu.lst -> ./grub.conf
If grub.conf does not exist then simply edit menu.lst which should be a file instead of a symlink to grub.conf.

Here is an example configuration:

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/hda3
#          initrd /initrd-version.img
#boot=/dev/hda
default=0
timeout=10
splashimage=(hd0,0)/grub/splash.xpm.gz
title Red Hat Enterprise Linux ES (2.4.21-37.EL)
root (hd0,0)
kernel /vmlinuz-2.4.21-37.EL ro root=/dev/hda3
initrd /initrd-2.4.21-37.EL.img
title Red Hat Enterprise Linux ES (2.4.21-32.0.1.EL)
root (hd0,0)
kernel /vmlinuz-2.4.21-32.0.1.EL ro root=/dev/hda3
initrd /initrd-2.4.21-32.0.1.EL.img
title Red Hat Enterprise Linux ES (2.4.21-27.0.4.EL)
root (hd0,0)
kernel /vmlinuz-2.4.21-27.0.4.EL ro root=/dev/hda3
initrd /initrd-2.4.21-27.0.4.EL.img
title Red Hat Enterprise Linux ES (2.4.21-27.0.2.EL)
root (hd0,0)
kernel /vmlinuz-2.4.21-27.0.2.EL ro root=/dev/hda3
initrd /initrd-2.4.21-27.0.2.EL.img
The default line is the line we want to change. The first title is 0. So if I wanted title Red Hat Enterprise Linux ES (2.4.21-27.0.2.EL) to be the default kernel I would set defualt= to 4.
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/hda3
#          initrd /initrd-version.img
#boot=/dev/hda
default=4
timeout=10
splashimage=(hd0,0)/grub/splash.xpm.gz
title Red Hat Enterprise Linux ES (2.4.21-37.EL)
root (hd0,0)
kernel /vmlinuz-2.4.21-37.EL ro root=/dev/hda3
initrd /initrd-2.4.21-37.EL.img
title Red Hat Enterprise Linux ES (2.4.21-32.0.1.EL)
root (hd0,0)
kernel /vmlinuz-2.4.21-32.0.1.EL ro root=/dev/hda3
initrd /initrd-2.4.21-32.0.1.EL.img
title Red Hat Enterprise Linux ES (2.4.21-27.0.4.EL)
root (hd0,0)
kernel /vmlinuz-2.4.21-27.0.4.EL ro root=/dev/hda3
initrd /initrd-2.4.21-27.0.4.EL.img
title Red Hat Enterprise Linux ES (2.4.21-27.0.2.EL)
root (hd0,0)
kernel /vmlinuz-2.4.21-27.0.2.EL ro root=/dev/hda3
initrd /initrd-2.4.21-27.0.2.EL.img

Share on Twitter
Share on Facebook