How to boot with old kernel version in RHEL7 ?

Solution Verified - Updated -


  • Red Hat Enterprise Linux 7 [ALL]


  • System installed with latest kernel version, but need to boot with old one.
  • How to change the default boot entry for kernel in RHEL 7 ?


  • By default, the key for the GRUB_DEFAULT directive in the /etc/default/grub file is the word saved. This instructs GRUB 2 to load the kernel specified by the saved_entry directive in the GRUB 2 environment file, located at /boot/grub2/grubenv. One can set another GRUB record to be the default, using the grub2-set-default command, which will update the GRUB 2 environment file.

  • By default, the saved_entry value is set to the name of latest installed kernel of package type kernel. This is defined in /etc/sysconfig/kernel by the UPDATEDEFAULT and DEFAULTKERNEL directives. The file can be viewed by the root user as follows:

    $ cat /etc/sysconfig/kernel
    # UPDATEDEFAULT specifies if new-kernel-pkg should make
    # new kernels the default
    # DEFAULTKERNEL specifies the default kernel package type
  • To force a system to always use a particular menu entry, use the menu entry name as the key to the GRUB_DEFAULT directive in the /etc/default/grub file. To list the available menu entries, run the following command as root:

    ~]# awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg
    ~]#  awk -F\' '$1=="menuentry " {print $2}' /etc/grub2-efi.cfg 
    Red Hat Enterprise Linux Server (3.10.0-693.el7.x86_64) 7.3 (Maipo)           <<==== Entry 0
    Red Hat Enterprise Linux Server (3.10.0-514.el7.x86_64) 7.3 (Maipo)           <<==== Entry  1
    Red Hat Enterprise Linux Server (0-rescue-d3c598b9d2204138bd2e1001316a5cc6) 7.3 (Maipo)
  • GRUB 2 supports using a numeric value as the key for the saved_entry directive to change the default order in which the kernel or operating systems are loaded. To specify which kernel or operating system should be loaded first, pass its number to the grub2-set-default command. For example:

    ~]# grub2-set-default 1
  • Check the below file to see the kernel which will be loaded at next boot, crosscheck the numeric value with the menuentry in the /etc/default/grub file.

    ~]# cat /boot/grub2/grubenv |grep saved
    ~]# cat /boot/grub2/grubenv |grep saved
  • Changes to /etc/default/grub require rebuilding the grub.cfg file as follows:

  • Rebuild the /boot/grub2/grub.cfg file by running the grub2-mkconfig -o command as follows:

    • On BIOS-based machines: ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
    • On UEFI-based machines: ~]# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg

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.