Prevent A Particular Kernel From Being Deleted

Home » CentOS » Prevent A Particular Kernel From Being Deleted
CentOS 1 Comment

Somewhat related to my inquiry earlier today about the disappearing sound card, I just got to wondering if there’s a way to “pin” the kernel that works with the soundcard such that it won’t be deleted with future updates until and unless there’s a future kernel released that solves the sound card issue.

“dnf versionlock” appears to almost do what I want, but it just locks a package to a particular version and doesn’t allow it to be upgraded past that.

I’d like to be able to install updated kernels as they are released, but somehow tell dnf to never delete kernel version 4.18.0-240.22.1.el8_3.x86_64. In the normal course of events that kernel would be deleted after a certain number of kernels are installed afterward (as specified by the installonly_limit number in /etc/dnf/dnf.conf.

So is there a way to tell dnf to update kernels in the usual manner but always keep a certain installed version until otherwise instructed?

One thought on - Prevent A Particular Kernel From Being Deleted

  • Not that I know of.  You could increase “installonly_limit” in dnf.conf to a large number, and remove kernels manually rather than automatically.  Or you could create a new empty dummy package that Requires: the kernel-version that you want to keep, and add that package to /etc/dnf/protected.d/.