Linux Fundamentals - Set default kernel using grubby
by
Jeremy Canfield |
Updated: November 29 2023
| Linux Fundamentals articles
grubby can be used to list the default kernel that will be used when a system is booting up, and to also set the default kernel.
The grubby --default-kernel and grubby --default-index and grubby --default-title commands can be used to display the default kernel that will be used on boot.
~]# grubby --default-kernel
/boot/vmlinuz-5.14.0-284.30.1.el9_2.x86_64
~]# grubby --default-index
0
~]# grubby --default-title
Red Hat Enterprise Linux (5.14.0-284.30.1.el9_2.x86_64) 9.2 (Plow)
The grubby --info=ALL command can be used to list the installed kernels.
]# grubby --info=ALL
index=0
kernel="/boot/vmlinuz-5.14.0-284.30.1.el9_2.x86_64"
args="ro rd.lvm.lv=rootvg/lv_root rd.lvm.lv=rootvg/lv_swap rhgb quiet biosdevname=0 LANG=en_US.UTF-8 rd.plymouth=0 plymouth.enable=0 crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M $tuned_params net.ifnames=0"
root="/dev/mapper/rootvg-lv_root"
initrd="/boot/initramfs-5.14.0-284.30.1.el9_2.x86_64.img $tuned_initrd"
title="Red Hat Enterprise Linux (5.14.0-284.30.1.el9_2.x86_64) 9.2 (Plow)"
id="c412e00d88a746d884ab2d375aa9cfab-5.14.0-284.30.1.el9_2.x86_64"
index=1
kernel="/boot/vmlinuz-4.18.0-477.27.1.el8_8.x86_64"
args="ro rd.lvm.lv=rootvg/lv_root rd.lvm.lv=rootvg/lv_swap rhgb quiet net.ifnames=0 biosdevname=0 LANG=en_US.UTF-8 $tuned_params crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M"
root="/dev/mapper/rootvg-lv_root"
initrd="/boot/initramfs-4.18.0-477.27.1.el8_8.x86_64.img $tuned_initrd"
title="Red Hat Enterprise Linux (4.18.0-477.27.1.el8_8.x86_64) 8.8 (Ootpa)"
id="c412e00d88a746d884ab2d375aa9cfab-4.18.0-477.27.1.el8_8.x86_64"
index=2
kernel="/boot/vmlinuz-4.18.0-477.21.1.el8_8.x86_64"
args="ro rd.lvm.lv=rootvg/lv_root rd.lvm.lv=rootvg/lv_swap rhgb quiet net.ifnames=0 biosdevname=0 LANG=en_US.UTF-8 $tuned_params crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M"
root="/dev/mapper/rootvg-lv_root"
initrd="/boot/initramfs-4.18.0-477.21.1.el8_8.x86_64.img $tuned_initrd"
title="Red Hat Enterprise Linux (4.18.0-477.21.1.el8_8.x86_64) 8.8 (Ootpa)"
id="c412e00d88a746d884ab2d375aa9cfab-4.18.0-477.21.1.el8_8.x86_64"
index=3
kernel="/boot/vmlinuz-3.10.0-1160.92.1.el7.x86_64"
args="ro rd.lvm.lv=rootvg/lv_root rd.lvm.lv=rootvg/lv_swap rhgb quiet net.ifnames=0 biosdevname=0 LANG=en_US.UTF-8 $tuned_params crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M"
root="/dev/mapper/rootvg-lv_root"
initrd="/boot/initramfs-3.10.0-1160.92.1.el7.x86_64.img $tuned_initrd"
title="Red Hat Enterprise Linux (3.10.0-1160.92.1.el7.x86_64) 8.8 (Ootpa)"
id="c412e00d88a746d884ab2d375aa9cfab-3.10.0-1160.92.1.el7.x86_64"
index=4
kernel="/boot/vmlinuz-3.10.0-1160.90.1.el7.x86_64"
args="ro rd.lvm.lv=rootvg/lv_root rd.lvm.lv=rootvg/lv_swap rhgb quiet net.ifnames=0 biosdevname=0 LANG=en_US.UTF-8 $tuned_params crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M"
root="/dev/mapper/rootvg-lv_root"
initrd="/boot/initramfs-3.10.0-1160.90.1.el7.x86_64.img $tuned_initrd"
title="Red Hat Enterprise Linux (3.10.0-1160.90.1.el7.x86_64) 8.8 (Ootpa)"
id="c412e00d88a746d884ab2d375aa9cfab-3.10.0-1160.90.1.el7.x86_64"
index=5
kernel="/boot/vmlinuz-3.10.0-1160.88.1.el7.x86_64"
args="ro rd.lvm.lv=rootvg/lv_root rd.lvm.lv=rootvg/lv_swap rhgb quiet net.ifnames=0 biosdevname=0 LANG=en_US.UTF-8 $tuned_params crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M"
root="/dev/mapper/rootvg-lv_root"
initrd="/boot/initramfs-3.10.0-1160.88.1.el7.x86_64.img $tuned_initrd"
title="Red Hat Enterprise Linux (3.10.0-1160.88.1.el7.x86_64) 8.8 (Ootpa)"
id="c412e00d88a746d884ab2d375aa9cfab-3.10.0-1160.88.1.el7.x86_64"
index=6
kernel="/boot/vmlinuz-0-rescue-c412e00d88a746d884ab2d375aa9cfab"
args="ro rd.lvm.lv=rootvg/lv_root rd.lvm.lv=rootvg/lv_swap rhgb quiet net.ifnames=0 biosdevname=0 LANG=en_US.UTF-8 crashkernel=1G-4G:192M,4G-64G:256M,64G-:512M"
root="/dev/mapper/rootvg-lv_root"
initrd="/boot/initramfs-0-rescue-c412e00d88a746d884ab2d375aa9cfab.img"
title="Red Hat Enterprise Linux (0-rescue-c412e00d88a746d884ab2d375aa9cfab) 8.8 (Ootpa)"
id="c412e00d88a746d884ab2d375aa9cfab-0-rescue"
The grubby --set-default=/boot/vmlinuz-<kernel> or grubby --set-default-index=<index number> commands can be used to set the default kernel that will be used on boot.
~]# grubby --set=default=/boot/vmlinuz-4.18.0-477.27.1.el8_8.x86_64
~]# grubby --set-default-index=1
Did you find this article helpful?
If so, consider buying me a coffee over at