Change default kernel

Hello everyone,
After problems with the internet, I installed the LTS kernel 5.15, but now Fedora keeps booting with the 5.15 kernel by default.
Is there also an option in Fedora 38 to boot with the last used kernel?
And how do I do that?

You can use sudo grubby to set the kernel to use by default.
See man grubby for how to list kernels and set the one you want to boot from by default.

The command ‘sudo grubby’ gives;
[rinus@fedora ~]$ sudo grubby
no action specified

And ‘grubby --default-kernel’ gives;
[rinus@fedora ~]$ grubby --default-kernel
grep: /boot/grub2/grubenv: Toegang geweigerd
/boot

And ‘dnf list installed kernel’ gives:
[rinus@fedora ~]$ dnf list installed kernel
GeĂŻnstalleerde pakketten
kernel.x86_64 6.5.5-200.fc38 @updates
kernel.x86_64 6.5.6-200.fc38 @updates
kernel.x86_64 6.5.7-200.fc38 @updates
[rinus@fedora ~]$
It appears that only kernel 6.5 is installed and yet the system boots with kernel 5.15 by default.
So if I want to boot with kernel 6.5, I have to select the grub menu every time I boot.
What command is needed to make the current kernel default?

You need to run grubby with root privileges, e.g., sudo grubby .... Solving issues in linux often requires working with the terminal and understanding how linux manages permissions and privileges. Linux distros and MacOS all shared a common “POSIX” command-line interface. There are a few excellent references but many more plagiarized, outdated, and misleading references. Linux Command has been tested over the years and is reliable.

You can also add the line GRUB_SAVEDEFAULT=true into the file /etc/default/grub then run grub2-mkconfig -o /boot/grub2/grub.cfg and it will add save_default=true into the /boot/grub2/grubenv file for you.

Once that is done then the last kernel booted will remain the default until the user selects a different one for booting on the grub menu.

Sorry I didn’t think of that, I know administrator permission is often required for commands in the terminal.
Thanks for your information.

Thank you very much for your help, this is the solution

1 Like