Changing The Default Kernel With Grubby

Grubby tool can be used to read information and make changed to the grub.cfg file.

Listing the default kernel:

grubby --default-kernel
/boot/vmlinuz-4.14.12-1.el7.elrepo.x86_64

To find out what the index number of the default enter the following

# grubby --default-index
0

To view all the kernels enter the following command:

grubby --info=ALL

# grubby --info=ALL
index=0
kernel=/boot/vmlinuz-4.14.12-1.el7.elrepo.x86_64
args="ro crashkernel=auto rd.lvm.lv=cl/root rhgb quiet LANG=en_US.UTF-8"
root=/dev/mapper/cl-root
initrd=/boot/initramfs-4.14.12-1.el7.elrepo.x86_64.img
title=CentOS Linux (4.14.12-1.el7.elrepo.x86_64) 7 (Core)
index=1
kernel=/boot/vmlinuz-3.10.0-693.11.6.el7.x86_64
args="ro crashkernel=auto rd.lvm.lv=cl/root rhgb quiet LANG=en_US.UTF-8"
root=/dev/mapper/cl-root
initrd=/boot/initramfs-3.10.0-693.11.6.el7.x86_64.img
title=CentOS Linux (3.10.0-693.11.6.el7.x86_64) 7 (Core)
index=2
kernel=/boot/vmlinuz-3.10.0-693.11.1.el7.x86_64
args="ro crashkernel=auto rd.lvm.lv=cl/root rhgb quiet LANG=en_US.UTF-8"
root=/dev/mapper/cl-root
initrd=/boot/initramfs-3.10.0-693.11.1.el7.x86_64.img
title=CentOS Linux (3.10.0-693.11.1.el7.x86_64) 7 (Core)
index=3
kernel=/boot/vmlinuz-3.10.0-514.el7.x86_64
args="ro crashkernel=auto rd.lvm.lv=cl/root rhgb quiet LANG=en_US.UTF-8"
root=/dev/mapper/cl-root
initrd=/boot/initramfs-3.10.0-514.el7.x86_64.img
title=CentOS Linux (3.10.0-514.el7.x86_64) 7 (Core)
index=4
kernel=/boot/vmlinuz-0-rescue-51ec8c545ba045e2a0f287692cba31a3
args="ro crashkernel=auto rd.lvm.lv=cl/root rhgb quiet"
root=/dev/mapper/cl-root
initrd=/boot/initramfs-0-rescue-51ec8c545ba045e2a0f287692cba31a3.img
title=CentOS Linux (0-rescue-51ec8c545ba045e2a0f287692cba31a3) 7 (Core)
index=5
non linux entry

If you want to change the default kernel on your system, enter this:

grubby --set-default /boot/<kernel-version-goes-here>

Example:

 grubby --set-default /boot/vmlinuz-4.14.12-1.el7.elrepo.x86_64
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s