Bug 1962056 - "dnf autoremove" ask to remove "kernel" packages of ZERO sizes after receiving kernel 5.11.20 !!
Summary: "dnf autoremove" ask to remove "kernel" packages of ZERO sizes after receivin...
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 34
Hardware: Unspecified
OS: Linux
Target Milestone: ---
Assignee: rpm-software-management
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2021-05-19 09:12 UTC by yousifjkadom@yahoo.com
Modified: 2021-06-17 09:38 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2021-06-17 09:38:06 UTC
Type: Bug

Attachments (Terms of Use)

Description yousifjkadom@yahoo.com 2021-05-19 09:12:24 UTC
Description of problem:
Just few minutes ago, I perform "sudo dnf upgrade --refresh". It show me many packages for updates, including kernel version 5.11.20-300f.c34 , dnf, ....
Before applying this update, the command "sudo dnf autoremove" ask for NO THING to be removed. But after applied this updates, "sudo dnf autoremove" asking me now to remove the following:

sudo dnf autoremove
Last metadata expiration check: 0:16:33 ago on Wed 19 May 2021 08:17:12 AM GMT.
Dependencies resolved.
 Package            Architecture  Version                 Repository       Size
 kernel             x86_64        5.11.19-300.fc34        @updates          0  
 kernel             x86_64        5.11.20-300.fc34        @updates          0  
 libiec61883        x86_64        1.2.0-26.fc34           @fedora          85 k

Transaction Summary
Remove  3 Packages

Freed space: 85 k
Is this ok [y/N]: N
Operation aborted.

Version-Release number of selected component (if applicable):
dnf --version
  Installed: dnf-0:4.7.0-1.fc34.noarch at Wed 19 May 2021 08:15:04 AM GMT
  Built    : Fedora Project at Thu 13 May 2021 02:35:13 PM GMT

  Installed: rpm-0: at Fri 14 May 2021 04:50:05 AM GMT
  Built    : Fedora Project at Mon 22 Mar 2021 11:03:11 AM GMT

How reproducible:
run "sudo dnf autoremove" after receiving the last updates that contain new kernel & dnf packages ....

Steps to Reproduce:

Actual results:

Expected results:
There should no such behavior !

Additional info:
1) I'm on Fedora Linux X64 Cinnamon edition since version 24,
2) I'm always upgrading my system from command line using tty terminal,
3) my system upgrade history is as following: from 24 to 26, from 26 to 28, from 28 to 30, from 30 to 32, & lastly from 32 to 34.
4) I think that I was confronted with same immediately after upgrading from Fedora 30 to 32 & solved by instruction given here when I filed a bug about that at that time - see the following:
5) when I upgraded from Fedora 32 to 34, I DID NOT SUFFER FROM THIS ISSUE IMMEDIATELY after upgrade. But I started to suffer from it just after receiving the new updates minutes ago ....
6) after upgraded my system from Fedora 32 to 34 I suffer from the following problem that solved - see bellow link:
7) after upgraded my system from Fedora 32 to 34 I run following commands:
sudo dnf upgrade --refresh (receive no thing)
sudo dnf autoremove (asked me to remove packages - see again https://bugzilla.redhat.com/show_bug.cgi?id=1960555 )
sudo dnf remove --duplicates (no thing to remove)
sudo dnf remove --oldinstallonly (remove old kernels of Fedora 32)
sudo dnf remove --obsoletes (no thing to removed)
sudo dnf distro-sync (no thing to do)
sudo dnf system-upgrade clean

Kindly, you help to fix this problem .... Do I have to treat this bug in same way by run "dnf mark install kernel" ? But even so, do this indicating that "the problem with installonly packages (kernel), that were marked as installed as a dependencies" is still existing ??

Also, what about the package "libiec61883" that autoremove asking me now to remove ? Is it safe to be removed ?

Thank you.

Comment 1 Marek Blaha 2021-06-17 09:38:06 UTC
It might be a consequence of https://bugzilla.redhat.com/show_bug.cgi?id=1844362 - due to a bug (fixed already) kernels were marked "installed as a dependency". If this was the case you can fix it by changing the installation reasons of kernel packages using `dnf mark` command:

# dnf mark install kernel # mark the kernel package as user-installed
# dnf mark remove kernel-core kernel-modules # mark -core and -modules as dependency-installed

The zero size of kernel package is expected. The `kernel` package is a meta package - it does not contain any files and it's purpose is just to pull in actual kernel packages as dependencies - kernel-core and kernel-modules packages.
I believe the original bug has been already fixed in dnf so I'm closing it. Please do not hesitate to re-open the bug in case it occurred again (after applying the fix mentioned above).

Btw this is how I succeeded to reproduce your issue:
I have two kernels installed:
# dnf repoquery --installed kernel

Than I mark the kernel package as dependency-installed (this allows autoremove to remove the package when no other installed package requires it):
# dnf mark remove kernel
kernel-5.11.12-300.fc34.x86_64 unmarked as user installed.
kernel-5.12.10-300.fc34.x86_64 unmarked as user installed.

And I mark kernel-core and kernel-modules packages as user-installed:
# dnf mark install kernel-core kernel-modules
kernel-core-5.11.12-300.fc34.x86_64 marked as user installed.
kernel-core-5.12.10-300.fc34.x86_64 marked as user installed.
kernel-modules-5.12.10-300.fc34.x86_64 marked as user installed.
kernel-modules-5.11.12-300.fc34.x86_64 marked as user installed.

Now the autoremove command is free to remove the kernel package:
# dnf autoremove
Dependencies resolved.
 Package             Architecture        Version                         Repository             Size
 kernel              x86_64              5.11.12-300.fc34                @fedora                 0  
 kernel              x86_64              5.12.10-300.fc34                @updates                0  

Transaction Summary
Remove  2 Packages

Freed space: 0  
Is this ok [y/N]

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