How to set the default kernel version?

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux 10
  • Red Hat Enterprise Linux 9
  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 7

Issue

  • How to set the default kernel version?

Resolution

  • To set a specific kernel as the default boot entry, use the grubby --set-default <full path to kernel vmlinuz file> command.

    # grubby --set-default /boot/vmlinuz-5.14.0-427.33.1.el9_4.x86_64
    

    Note: The above command set the default kernel to version 5.14.0-427.33.1.el9_4.x86_64, replace the version with the version of the kernel to set as default.

Notes:

  • List available kernels on the system using the ls -1 /boot/vmlinuz-* command.
  • grubby sets the save_entry value in the /boot/grub2/grubenv file to the specified kernel. For this to work, ensure GRUB_DEFAULT=saved is configured in the /etc/default/grub file.
  • After setting the default kernel, reboot the system to boot into the newly configured default kernel.

Diagnostic Steps

SBR
Components

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.