2

I need to keep an old kernel in Fedora: kernel-4.14.18-300.fc27.x86_64
But I still want the latest kernel updates.

1) A naive approach is to change the installonly_limit=3 value to a high number in /etc/dnf/dnf.conf.

2) A better solution was to use yumdb to avoid automatic removing of the specific kernel:

yumdb set installonly keep kernel-4.14.18-300.fc27.x86_64

But the yum package manager has been replaced with dnf and there is no dnfdb command...
I have tried adding the following line to /etc/dnf/dnf.conf with no luck:

installonlypkgs=kernel-4.14.18-300.fc27.x86_64`

How to keep a specific version of an old kernel while still allowing updates?

remjg
  • 131
  • 1
  • 6

2 Answers2

3

I think dnf mark is the command you are looking for. It marks the package as "user installed" protecting it from autoremoval.

dnf mark install kernel-4.14.18-300.fc27.x86_64

https://dnf.readthedocs.io/en/latest/command_ref.html#mark-command-label

There is also a dnf protect.d directory where you can store packages that shouldn't be removed. /etc/dnf/protected.d. However I have seen some people report this doesn't work with specific versions.

  • Thank you for your answer. I have tried `dnf mark`. Unfortunately, `dnf` still try to remove the kernel while updating. I'm gonna look into the `protected.d` solution. – remjg Sep 25 '18 at 05:30
  • Since each kernel is a different package I don't see this working as you would want. It might keep it around but that doesn't mean it will keep it in use or listed. That might be a different problem. – CmosBattery Oct 12 '18 at 14:41
1

Edit : no kernel updates since the versionlock has been applied... Still looking for a solution !

I have found the versionlock dnf plugin which seems to eventually answer my problem:

sudo dnf install python3-dnf-plugins-extras-versionlock

According to here and there, the following commands should do the job in my case:

sudo dnf versionlock add kernel-4.14.18-300.fc27*
sudo dnf versionlock add kernel-core-4.14.18-300.fc27*
sudo dnf versionlock add kernel-modules-4.14.18-300.fc27*
sudo dnf versionlock add kernel-modules-extra-4.14.18-300.fc27*
sudo dnf versionlock add kernel-devel-4.14.18-300.fc27*
remjg
  • 131
  • 1
  • 6
  • 1
    Are you **sure** `dnf versionlock` actually worked for you, _including_ the "But I still want the latest kernel updates" requirement? In my testing just now, on F30 with `5.2.11`, `5.2.13`(booted), and `5.2.14` installed, setting `dnf versionlock add kernel{,-modules,-core,-devel,-modules-extra,-debug-devel}-5.2.11-200.fc30` prevented me from getting _any_ further updates. In fact, I couldn't even manually `dnf remove kernel\*-5.2.14-200.fc30`, `dnf` reported "No match for argument". Any attempts to upgrade to the (available) `5.2.15` were also ignored, until I deleted the versionlocks. – FeRD Sep 19 '19 at 14:15
  • Indeed, no kernel update since a long time :-( I was pretty sure it was working, seems like I have missed something. – remjg Sep 19 '19 at 21:21
  • This [just came up](https://ask.fedoraproject.org/t/howto-prevent-kernel-updates/3001) on the new Ask Fedora discord, some users (including myself) posted some ideas there. – FeRD Sep 21 '19 at 08:26