8

I am running Fedora 32 and I want to remove the new 5.7 kernel since it is causing some problems.

I have tried:

sudo dnf remove kernel-*5.7.10-201.fc32.x86_64

And it did remove something but the kernel is still there in the GRUB menu and is strangely fully bootable.

How do I remove it for good ? I want it gone from the GRUB menu and completely from my system.

Running the command:

dnf list installed kernel-* | grep -i 5.7

proves the kernel 5.7 is still present:

kernel-core.x86_64 5.7.10-201.fc32
kernel-devel.x86_64 5.7.10-201.fc32
kernel-headers.x86_64 5.7.10-200.fc32
kernel-modules.x86_64 5.7.10-201.fc32
kernel-modules-extra.x86_64 5.7.10-201.fc32

How do I remove these and how do I get rid of it from GRUB ?

Note: Running something like:

sudo dnf remove kernel-core.x86_64 5.7.10-201.fc32
sudo dnf remove kernel-core.x86_64.5.7.10-201.fc32
sudo dnf remove kernel-core.5.7.10-201.fc32.x86_64

All give errors.

The errors are as follows:

$ sudo dnf remove kernel-core.x86_64 5.7.10-201.fc32
No match for argument: 5.7.10-201.fc32
Error: 
 Problem: The operation would result in removing the following protected packages: kernel-core
(try to add '--skip-broken' to skip uninstallable packages)


$ sudo dnf remove kernel-core.x86_64.5.7.10-201.fc32
No match for argument: kernel-core.x86_64.5.7.10-201.fc32
No packages marked for removal.
Dependencies resolved.
Nothing to do.
Complete!


$ sudo dnf remove kernel-core.5.7.10-201.fc32.x86_64
No match for argument: kernel-core.5.7.10-201.fc32.x86_64
No packages marked for removal.
Dependencies resolved.
Nothing to do.
Complete!
5
  • 1
    are you 100% sure that version is not the one currently running? what does uname -r say?
    – schaiba
    Jul 27, 2020 at 3:34
  • @schaiba It says : 5.7.10-201.fc32.x86_64
    – ng.newbie
    Jul 27, 2020 at 8:03
  • @schaiba That is I can boot into the kernel after it has been removed. Which is to say is weird.
    – ng.newbie
    Jul 27, 2020 at 10:32
  • So, you can boot into a kernel version that you want to keep, yes?
    – rickhg12hs
    Jul 27, 2020 at 11:35
  • @rickhg12hs yes. I had to use rpm to get the full name.
    – ng.newbie
    Jul 27, 2020 at 12:50

1 Answer 1

8

It seems DNF does not give the full name of the package that would be needed by dnf remove to remove the kernel.

For that it is better to use rpm.

This is the command that worked for me:

sudo dnf remove $(rpm -qa | grep ^kernel | grep 5\.7)
2
  • 2
    I get "Problem: The operation would result in removing the following protected packages: kernel-core (try to add '--skip-broken' to skip uninstallable packages)"; With --skip-broken: "Problem: The operation would result in removing the following protected packages: kernel-core"
    – MrTomRod
    Nov 4, 2022 at 6:56
  • in my case that resulted in fedora wanting to remove also emacs, luarocks and suchlike packages. I realized it's the kernel-headers package that's contentious, and sudo dnf remove $(rpm -qa | grep ^kernel | grep 6\.5 | grep -v headers) worked as intended. Oct 1, 2023 at 5:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .