Post DNF System Upgrade Tasks, error with old kernels clean-up script

Hi, I am evaluating to move from Ubuntu to Fedora. I installed F37 KDE Spin on a VM, to check the upgrade to F38 process.

As far as I know, no GUI upgrade is available on KDE Spin, so I tried the DNF System Upgrade. Everything went fine. Now I was trying the post upgrade clean-up tasks.

I created the script ~/kernel.sh and pasted the suggested content. I then give it executable permissions and run it with sudo ~/kernel.sh.

It gives this error

Errore: 
 Problema: The operation would result in removing the following protected packages: kernel-core
(try to add '--skip-broken' to skip uninstallable packages)
Failed to remove old kernels

I am a bit frightened 'cause my understanding is that the script would try to deleted a wrong kernel.

This is my kernel list by rpm -qa kernel

kernel-6.2.11-200.fc37.x86_64
kernel-6.2.11-300.fc38.x86_64
kernel-6.2.12-300.fc38.x86_64

With fedora it is totally unnecessary to remove older kernels. Fedora does that automatically and by default keeps the latest 3 kernels installed in case of a boot problem. Thus that script is normally not needed. Note also that the link you followed is for power users – as shown by the note at the very top.

If you run the command dnf list installed 'kernel*' you should see each kernel package listed with the latest 3 versions (with a couple exceptions having only one version). Any differences would normally be because the user chose to keep more or had not upgraded enough times to perform at least 2 kernel updates after the initial install.

Most users never need to do anything more than the dnf upgrade and the system manages the rest for them.

1 Like

Note also that the link you followed is for power users – as shown by the note at the very top.

Is there an alternative way to upgrade KDE spin for normal users?

I don’t use kde, but I do always update using dnf. It has never been necessary to do the additional that is given in that link. The normal dnf upgrade process manages all that I have ever needed for many years.

1 Like

I recommend not doing any of the optional post-upgrade tasks unless you know you need it. Majority of users don’t need it.

It looks like the work on system upgrades through Discover is very close to completion, but for now, using dnf system-upgrade is fine. A lot of us choose to use dnf anyway, whether on GNOME, KDE, or other environments.

1 Like