One small correction. As far as I know, grub will default to the latest kernel you have, not to the 5.1.X you’ve installed manually. It will add 5.1.X to the boot menu, and you can select it manually on each boot.
To make older kernel a default one for grub you should either use grubby (I’ve never done it this way):
sudo grubby --set-default /boot/vmlinuz-5.1.20-200.fc30.x86_64
Use actual kernel version number you need, don’t copypaste my number, I just made it up.
The second way I’ve actually used, you need to change /etc/default/grub
config file, change line
GRUB_DEFAULT=saved
to GRUB_DEFAULT="Name_of_the_boot_entry_you_need"
The name of the entry you can take from
-
if you system has BLS enabled (GRUB_ENABLE_BLSCFG=true
in /etc/default/grub
) – then
sudo grep title /boot/loader/entries/*-5.1.20-200.fc30.x86_64.conf
-
if GRUB_ENABLE_BLSCFG=false
then from looking for appropriate menuentry in the grub.cfg.
It should be something like
GRUB_DEFAULT="Fedora (5.1.20-200.fc30.x86_64) 30 (Thirty)"
– but don’t try to guess it, look it up exactly.
After changing /etc/default/grub
you need to regenerate grub.cfg:
sudo grub2-mkconfig -o /path/to/your/grub.cfg
where /path/to/your/grub.cfg is
-
/boot/efi/EFI/fedora/grub.cfg
– for UEFI installations
-
/boot/grub2/grub.cfg
– for Legacy/BIOS installations
You can check which mode your Fedora in installed in with
test -d /sys/firmware/efi && echo EFI || echo Legacy
Note that setting default kernel in this way is permanent, you’ll need to revert it to default (i.e. latest one) manually in a similar fashion.
P.S. Also I’ve never tested what happens if the kernel you’ve set as a default one is removed automatically as the oldest one on your system – check the links below about this autoremoval.
Also please check these two threads, they are relevant to your question:
https://discussion.fedoraproject.org/t/howto-prevent-kernel-updates/3001
https://discussion.fedoraproject.org/t/pin-or-retain-a-kernel-version-or-increase-the-number-of-kernels-retained/72318