how to configure centos 8 to boot with old kernel version

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"


We will edit CentOS 8 the GRUB2 configuration parameter and change it using grubby to boot with old kernel or to change the default boot entry for kernel in the system.

Grubby is a command line tool for updating and displaying information about the configuration files for various architecture specific bootloaders. It primarily designed to be_used from scripts which install new kernels and need to find information about the current boot environment.

Grubby will use these default settings to search for an existing configuration. If no bootloader configuration file found, grubby will use the default value for that architecture.

From man page of grubby, Here is some of the arguments which we will use:

       The first entry which boots the specified kernel is made the default boot entry. This may not be invoked with --set-default-index.

       Makes the given entry number the default boot entry. This may not be invoked with --set-default.  The given value represents the index in the post-modification boot entry list.

       Display the full path to the current default kernel and exit.

       Display the numeric index of the current default boot entry and exit.
       Display  information  on  all  boot entries which match kernel-path. If kernel-path is DEFAULT, then information on the default kernel is displayed. If kernel-path is ALL, then information on all boot entries are dis‐played.

Check default boot kernel and boot with old kernel

Just follow the steps below

  • Before we configure our CentOS to boot with old kernel version, check the current default kernel with the command below.
[root@unixcop ~]# grubby --default-kernel
  • To check the mapped index with this kernel
[root@unixcop ~]# grubby --default-index
[root@unixcop ~]#

NOTE: The grubby –default-index command will have a NULL output if only one kernel installed on your system.

  • To get more information about a specified initrd image, you can use the command below
grubby --info=/boot/vmlinuz-4.18.0-305.12.1.el8_4.x86_64
  • List of initrd image available on your system.
[[root@unixcop ~]# ls -l /boot/vmlinuz-*
-rwxr-xr-x. 1 root root 10034312 Aug 30 15:38 /boot/vmlinuz-0-rescue-6b373fdfa30442f7870b901d0b7ce04a
-rwxr-xr-x. 1 root root 7868768 Jun 12 18:59 /boot/vmlinuz-4.18.0-231.2.el8_0.x86_64
-rwxr-xr-x. 1 root root 7876960 Jun 15 16:22 /boot/vmlinuz-4.18.0-305.12.1.el8_4.x86_64
-rwxr-xr-x. 1 root root 7872864 Feb 10 18:04 /boot/vmlinuz-4.18.0-80.el8.x86_64
  • Get the list of available kernels install on your system
[root@unixcop ~]# rpm -qa | grep kernel | sort -V
[root@unixcop ~]# 

NOTE: Since your system is running with the latest available kernel on my system, the index will be shown as “0” then the older version will be mapped with index 1 then the next older version will be mapped with index 2

[root@unixcop ~]# uname -r
[root@unixcop ~]#
  • So boot your system with older kernel by using the below command using –set-default option.
[root@unixcop ~]# grubby --set-default-index=1
The default is /boot/loader/entries/6b373fdfa30442f7870b901d0b7ce04a-4.18.0-231.2.el8_0.x86_64.conf with index 1 and kernel /boot/vmlinuz-4.18.0-231.2.el8_0.x86_64
[root@unixcop ~]#
  • Reboot your system
  • Check the default kernel using which the system will be booted during next reboot.
[root@unixcop ~]# grubby --default-kernel
  • Check the default index value which will be active post reboot
grubby --default-index
[root@unixcop ~]# cat /proc/cmdline
BOOT_IMAGE=(hd0,msdos1)/vmlinuz-4.18.0-231.2.el8_0.x86_64 root=/dev/mapper/cl-root ro crashkernel=auto resume=/dev/mapper/cl-swap rhgb quiet


That’s it,

We illustrated how to configure CentOS 8 to boot with the old kernel,

Thank you…

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"
unixcop Admin


Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook