Bug 1657287 - cannot autoremove unused kernel package when kernel-modules is installed
Summary: cannot autoremove unused kernel package when kernel-modules is installed
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 29
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jaroslav Mracek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-12-07 15:24 UTC by Maciek Borzecki
Modified: 2018-12-10 16:06 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2018-12-10 13:24:01 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Maciek Borzecki 2018-12-07 15:24:19 UTC
Description of problem:
When the system image had kernel-modules installed, after upgrading to the new kernel, dnf autoremove fails to clean up the old kernel and modules, raising an error:

[guest@localhost ~]$ sudo dnf autoremove -y
Last metadata expiration check: 0:10:27 ago on Fri 07 Dec 2018 03:07:24 PM UTC.
Error: 
 Problem: The operation would result in removing the following protected packages: kernel-core

This does not happen if kernel-modules was not installed before.

Version-Release number of selected component (if applicable):
dnf-4.0.9-1.fc29.noarch
dnf-data-4.0.9-1.fc29.noarch
dnf-plugins-core-4.0.2-1.fc29.noarch
dnf-yum-4.0.9-1.fc29.noarch
kernel-core-4.18.16-300.fc29.x86_64
kernel-core-4.19.6-300.fc29.x86_64
kernel-modules-4.18.16-300.fc29.x86_64
kernel-modules-4.19.6-300.fc29.x86_64
libdnf-0.22.3-1.fc29.x86_64
libsolv-0.7.1-2.fc29.x86_64

How reproducible:
always

Steps to Reproduce:
1. Grab Fedora-Cloud-Base-29-1.2.x86_64 image
2. uname -r gives  4.18.16-300.fc29.x86_64
3. dnf install kernel-modules-4.18.16-300.fc29.x86_64 (matching running kernel)
4. dnf upgrade kernel\* -y
5. reboot
6. uname -r gives 4.19.6-300.fc29.x86_64
6. dnf autoremove -y, gives:
 Problem: The operation would result in removing the following protected packages: kernel-core
7. dnf remove kernel-modules-4.18.16-300.fc29.x86_64 kernel-core-4.18.16-300.fc29.x86_64 works

Actual results:


Expected results:
the unused kernel would be autoremoved

Comment 1 Jaroslav Mracek 2018-12-10 13:24:01 UTC
Kernel is installonly package and therefore it is not automatically removed. The number of kept installonly packages can be set in /etc/dnf/dnf.conf with key installonly_limit.

If I have installonly_limit=3 it means that 3 kernel packages will be kept on the system. Minimal number is 2 and it is for good reason.

Hope that it helps.

Comment 2 Maciek Borzecki 2018-12-10 16:06:33 UTC
I think there's still something fishy:

[guest@localhost ~]$ sudo dnf --setopt installonly_limit=1 autoremove 
Last metadata expiration check: 0:07:38 ago on Mon 10 Dec 2018 03:55:06 PM UTC.
Error: 
 Problem: The operation would result in removing the following protected packages: kernel-core

Any suggestions how to tell dnf autoremove to clean up unused kernel versions? Removing them manually via dnf remove works.


Note You need to log in before you can comment on or make changes to this bug.