Bug 2023100 - 'dnf remove <old_kernel>' leaves artifacts in /lib/modules
Summary: 'dnf remove <old_kernel>' leaves artifacts in /lib/modules
Keywords:
Status: CLOSED DUPLICATE of bug 2016630
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 34
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Kernel Maintainer List
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-11-14 18:31 UTC by Jeffrey Walton
Modified: 2022-01-14 18:06 UTC (History)
28 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-01-14 18:06:43 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Jeffrey Walton 2021-11-14 18:31:05 UTC
Hi Everyone.

I'm working on Fedora 34, x86_64, fully patched.

I have a script that keeps my Fedora workstation tidy. The script removes old kernels. The script executes the following commands:

  #!/usr/bin/env bash

  old_kernels=($(dnf repoquery --installonly --latest-limit=-1 -q))
  if [ "${#old_kernels[@]}" -eq 0 ]; then
    echo "No old kernels found"
    exit 0
  fi

  if ! dnf -y remove "${old_kernels[@]}"; then
    echo "Failed to remove old kernels"
    exit 1
  fi

  echo "Removed old kernels"
  exit 0

The script worked as expected for years. The script removed the old kernels, and it removed their extras in /lib/modules. Recently the script stopped removing the extras in /lib/modules. Here, "recently" is about the last 6 months or so.

For example, I recently ran the script to remove old kernels. The kernel package 5.14.16-201.fc34.x86_64 was removed as expected. However:

  $ ls /lib/modules
  5.14.16-201.fc34.x86_64  5.14.17-201.fc34.x86_64

Notice dnf did not remove 5.14.16-201 extras. I'm not sure what changed, but it is new behavior.

In case it matters, the machine is regularly updated with the following commands. I do not manually install kernel packages with specific version numbers.

  dnf -y upgrade && dnf -y autoremove

My apologies if this is not a dnf issue. I filed against dnf since that's the command I executed, but it could be a change somewhere else, like how dependencies are handled between kernel and kernel extra packages.

Finally, this may be related to https://bugzilla.redhat.com/show_bug.cgi?id=1998370 and/or https://bugzilla.redhat.com/show_bug.cgi?id=2016630. I did not add the links to the bug report because I am not certain they are related.

====================

$ uname -r
5.14.17-201.fc34.x86_64

$ cat /etc/fedora-release
Fedora release 34 (Thirty Four)

$ cat /etc/os-release
NAME=Fedora
VERSION="34 (Workstation Edition)"
ID=fedora
VERSION_ID=34
VERSION_CODENAME=""
PLATFORM_ID="platform:f34"
PRETTY_NAME="Fedora 34 (Workstation Edition)"
...

$ dnf info dnf
...
Name         : dnf
Version      : 4.9.0
Release      : 1.fc34
Architecture : noarch
Size         : 2.1 M
Source       : dnf-4.9.0-1.fc34.src.rpm
Repository   : @System
From repo    : updates
Summary      : Package manager
...

Comment 1 Lukáš Hrázký 2021-11-15 15:27:04 UTC
This looks like it must be somewhere in the kernel packaging, reassigning.

Comment 2 Jeffrey Walton 2022-01-14 18:06:43 UTC
This report appears to be a duplicate of Issue 2016630.

Would someone please close this bug, please.

*** This bug has been marked as a duplicate of bug 2016630 ***


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