Issue
How to change the default boot entry for kernel in RHEL 8?
Changing the default kernel of an RHEL 8 system with multiple kernel versions installed.
Resolution
Listing the Default Kernel:
To get the file name of the current default kernel.
# grubby --default-kernel Eg: # grubby --default-kernel /boot/vmlinuz-4.18.0-80.7.1.el8_0.x86_64
To get the index number of the current default kernel.
# grubby --default-index Eg: # grubby --default-index 0
Listing Available Kernels:
To get the list of file names of available kernels.
# ls -l /boot/vmlinuz-* Eg: # ls -l /boot/vmlinuz-* -rwxr-xr-x. 1 root root 7872864 Jul 12 05:27 /boot/vmlinuz-0-rescue-31c619b4ae7b4a29b0cdd151ca2a7ca6 -rwxr-xr-x. 1 root root 7876960 Jun 24 06:52 /boot/vmlinuz-4.18.0-80.7.1.el8_0.x86_64 -rwxr-xr-x. 1 root root 7872864 Mar 13 08:34 /boot/vmlinuz-4.18.0-80.el8.x86_64
Changing Default Kernel Boot Entry:
To change the default kernel boot entry using kernel filename.
# grubby --set-default <kernel-filename> Eg: # grubby --set-default /boot/vmlinuz-4.18.0-80.el8.x86_64 OR # grubby --set-default vmlinuz-4.18.0-80.el8.x86_64
To change the default kernel boot entry using kernel entry-index.
# grubby --set-default-index=<kernel-entry-index> Eg: # grubby --set-default-index=1
To determine the order of the kernel entry-index, the latest kernel installed will have the entry-index of
0
and the older kernel version will get1
. In the mentioned example older kernelkernel-4.18.0-80.el8.x86_64
will have entry-index1
and the latest kernelkernel-4.18.0-80.7.1.el8_0.x86_64
will have entry-index0
The detailed information of a certain kernel version can be collected by using
--info
, it will show the index as well.
# grubby --info <kernel-filename> Eg: # grubby --info /boot/vmlinuz-4.18.0-80.7.1.el8_0.x86_64 index=0 kernel="/boot/vmlinuz-4.18.0-80.7.1.el8_0.x86_64" args="ro crashkernel=auto resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet $tuned_params" root="/dev/mapper/rhel-root" initrd="/boot/initramfs-4.18.0-80.7.1.el8_0.x86_64.img $tuned_initrd" title="Red Hat Enterprise Linux (4.18.0-80.7.1.el8_0.x86_64) 8.0 (Ootpa)" id="31c619b4ae7b4a29b0cdd151ca2a7ca6-4.18.0-80.7.1.el8_0.x86_64"
1 Comments