How can I downgrade to a kernel that I don't have installed locally?

,

Hello,

I’m having some problems on my machine (with kernel 5.2.9) and someone here advised me to downgrade to 5.1.x, but I’m not sure how to do it.
I found the list of all available kernels here and saw that the latest 5.1 is 5.1.20. Now I’m not sure:

  1. From which category? (x86_64?)
  2. Which specific RPMs? There’s a long list
  3. How do I install them? Simply RPM install will downgrade the kernel? Do I need to dnf remove something first?
  4. After I’ve installed, how do I setup grub to load that specific verison?

I’d appreciate any help

Guy

That depends on your CPU architecture, but more than likely you have an x86 64 bits system, so Yes.

That depends on what kernel packages are installed (required) on your system. Find out the currently installed kernel packages with following command. Then download the same ones from the older kernel version:

rpm -qa "kernel*"

go to the directory where you downloaded them, then simply run sudo dnf install kernel-5.x-...

dnf will take care of that. there is a post-install script that will automatically update grub.

2 Likes

Thanks for the quick reply.

So if I understand you correctly - there’s no need to download the RPMs at all, simply find the version I want and dnf install it?
Is rpm -qa "kernel*" redundant?

Thanks

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:

2 Likes

No, misunderstanding here. You have to download the .rpm packages, which you then install using dnf.

no, rpm -qa is a query command that will show you the rpm packages installed on your system, while ls is a simply list of the current directory. Different things.

What I meant is that the dnf install command will add the new (old) kernel to the grub list of bootable kernels.

Correct, it will not set the newly installed kernel as the default.

If the 5.2.9 is faulty you can also remove it.

Did you actually investigate the error? Is it a known bug you are affected by, or would it be worth reporting it?

1 Like

Wow thanks for the help!
I don’t know if it’s a known error. Originally I posted this and got an advice to downgrade the kernel

OK I successfully downgraded to 5.1.20.
I used rpm -i <file>.rpm on all the RPMs I downloaded.
After the installation I ran grubby --default-kernel and found out the default was changed to the kernel I just installed.

Thanks again

2 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.