Easy steps to change default kernel version RHEL/CentOS 8

In this tutorial we will learn the steps to change default kernel version i.e. switch between different installed kernel versions in RHEL/CentOS 8. The steps involved with RHEL/CentOS 8 are completely different compared to older releases as GRUB2 has been further upgraded to what we had with RHEL/CentOS 7. Hence now we have a special designated tool called grubby to change default kernel versions


Overview on grubby

  • grubby is a command line tool used to configure bootloader menu entries across multiple architectures.
  • It is used for updating and displaying information about the configuration files for various architecture specific bootloaders.
  • It is primarily designed to be used from scripts which install new kernels and need to find information about the current boot environment.
  • If no bootloader configuration file is found, grubby will use the default value for that architecture for example grub2 for x86_64 machines, elilo for ia64 etc


List installed kernel versions

For the sake of this tutorial I have installed multiple kernels on my Red Hat 8 server. So we will switch between these kernel versions in our example.

# rpm -qa | grep kernel | sort

With RHEL/CentOS 8 now the kernel rpm is distributed across kernel-core and kernel-modules. You can read more about these kernel rpms in What are kernel-core and kernel-module rpms and how to upgrade these rpms

Here we got a long list of kernel and it's dependent packages. You can use grubby to get a cleaner output for list of installed kernels

# grubby --info=ALL | grep ^kernel

This will print the initramfs version of all the installed kernels.


Currently active (loaded) kernel

To check the currently active kernel version we will use uname with -r which will give us kernel release information:

# uname -r


Get more information of boot entries

Now with grubby we have listed the available boot entries, to get more information on individual boot entries we can use:

# grubby --info="/boot/vmlinuz-4.18.0-193.14.3.el8_2.x86_64"
args="ro resume=/dev/mapper/rhel-swap rhgb quiet biosdevname=0 net.ifnames=0 enforcing=0 $tuned_params"
initrd="/boot/initramfs-4.18.0-193.14.3.el8_2.x86_64.img $tuned_initrd"
title="Red Hat Enterprise Linux (4.18.0-193.14.3.el8_2.x86_64) 8.2 (Ootpa)"


Check the kernel version which is going to be activated post reboot

Now to determine the kernel version which will be activated post reboot we use:

# grubby --grub2 --default-title
Red Hat Enterprise Linux (4.18.0-193.14.3.el8_2.x86_64) 8.2 (Ootpa)

So our currently active kernel was 4.18.0-193.el8.x86_64, but after reboot 4.18.0-193.14.3.el8_2.x86_64 will be active.

To list the boot entry of the default kernel i.e. the kernel which will be active post reboot

# grubby --default-kernel

Similarly to get the index value of default kernel

# grubby --default-index

So the boot entry with index value 0 will be activated post reboot of my Linux server.


Change the default kernel (switch kernel version)

Now assuming we wish to change the default kernel which will be active post reboot from 4.18.0-193.14.3.el8_2.x86_64 to 4.18.0-193.1.2.el8_2.x86_64

We can either use

  • kernel title
  • kernel boot entry
  • kernel index value

to change the default kernel version and to switch the kernel for activation post reboot. In this example I am using kernel boot entry to change default kernel version

# grubby --set-default "/boot/vmlinuz-4.18.0-193.1.2.el8_2.x86_64"
The default is /boot/loader/entries/d88fa2c7ff574ae782ec8c4288de4e85-4.18.0-193.1.2.el8_2.x86_64.conf with index 1 and kernel /boot/vmlinuz-4.18.0-193.1.2.el8_2.x86_64

So the default kernel version is successfully updated.



Verify the new default kernel

Next use the same command as used earlier with grubby to verify the new default kernel:

# grubby --default-kernel

To get more information of this boot entry:

# grubby --info /boot/vmlinuz-4.18.0-193.1.2.el8_2.x86_64
args="ro resume=/dev/mapper/rhel-swap rhgb quiet biosdevname=0 net.ifnames=0 enforcing=0 $tuned_params"
initrd="/boot/initramfs-4.18.0-193.1.2.el8_2.x86_64.img $tuned_initrd"
title="Red Hat Enterprise Linux (4.18.0-193.1.2.el8_2.x86_64) 8.2 (Ootpa)"

So we can also verify the default index, it should be "1" based on the above information:

# grubby --default-index

Now reboot the server and verify the active kernel using uname:

# uname -r

So our active kernel is same as we had set for default kernel. Using this method you can easily switch between different kernel versions in RHEL/CentOS 8 Linux.


What's Next

Now since you know about this wonderful grubby tool, it is time to explore this command and learn more about it's capabilities:



In this tutorial we learned about grubby tool in brief and how it can be used to change default kernel version in RHEL/CentOS 8 Linux. grubby is a very versatile tool and can do much more than switching kernel versions such as updating kernel entries, grub configuration etc.

Lastly I hope the steps from the article to switch between different kernel versions in Red Hat and CentOS 8 Linux was helpful. So, let me know your suggestions and feedback using the comment section.


Didn't find what you were looking for? Perform a quick search across GoLinuxCloud

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can either use the comments section or contact me form.

Thank You for your support!!

1 thought on “Easy steps to change default kernel version RHEL/CentOS 8”

Leave a Comment