JRehkemper.de

Change Default Kernel in Grub

By default your System will always boot with the latest installed kernel. But sometimes you might not want that.
Maybe there is a bug or your software is not yet compatible.

You can either select a different kernel everytime you boot the system, or change the configured default kernel.

On Red Hat Based Systems you can use grubby for this kind of configurations.

Check current Configuration

First confirm your current default kernel. It should be the one you are running right now.

$ grubby --default-kernel
/boot/vmlinuz-5.14.0-70.30.1.el9_0.x86_64

$ uname -r
5.14.0-70.30.1.el9_0.x86_64

List Installed Kernels

Next list all installed Kernel. Each row gets its own id. it is counted from the top, staring with 0.

[tux@server]$ grubby --info=ALL | grep title
title="Red Hat Enterprise Linux (5.14.0-70.30.1.el9_0.x86_64) 9.0 (Plow)"    <---0
title="Red Hat Enterprise Linux (5.14.0-70.13.1.el9_0.x86_64) 9.0 (Plow)"    <---1

Look through this list and find the ID of your desired kernel.

Set the new default kernel.

In this example we want to make the kernel with the ID 1 our new default. This can be done with grubby.

$ grub2-set-default 1  

You can confirm you changes by displaying the new default kernel again.

$ grubby --default-kernel
/boot/vmlinuz-5.14.0-70.13.1.el9_0.x86_64

Reboot

Now if you reboot your system, it should boot with the new default kernel, just as you specified it.

profile picture of the author

Jannik Rehkemper

I'm an professional Linux Administrator and Hobby Programmer. My training as an IT-Professional started in 2019 and ended in 2022. Since 2023 I'm working as an Linux Administrator.