Bug 1734311 - dkms modules left behind when kernel is removed.
Summary: dkms modules left behind when kernel is removed.
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: dkms
Version: 30
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Simone Caronni
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-07-30 08:36 UTC by Stefan van der Eijk
Modified: 2020-05-26 14:29 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-05-26 14:29:47 UTC
Type: Bug


Attachments (Terms of Use)

Description Stefan van der Eijk 2019-07-30 08:36:25 UTC
Description of problem:

Removing kernel doesn't clean up dkms modules of that kernel version.

Version-Release number of selected component (if applicable):


How reproducible:

Remove the old kernel version (5.1.19-300.fc30.x86_64 in this case):

# dnf remove `rpm -qa | grep 5.1.19-300.fc30.x86_64`

Run dkms status:

# dkms status
zfs, 0.8.1, 5.1.20-300.fc30.x86_64, x86_64: installed

Run updatedb and search for DKMS related files are left behind:

# updatedb
# locate 5.1.19-300.fc30
/usr/lib/modules/5.1.19-300.fc30.x86_64
/usr/lib/modules/5.1.19-300.fc30.x86_64/extra
/usr/lib/modules/5.1.19-300.fc30.x86_64/extra/icp.ko.xz
/usr/lib/modules/5.1.19-300.fc30.x86_64/extra/spl.ko.xz
/usr/lib/modules/5.1.19-300.fc30.x86_64/extra/zavl.ko.xz
/usr/lib/modules/5.1.19-300.fc30.x86_64/extra/zcommon.ko.xz
/usr/lib/modules/5.1.19-300.fc30.x86_64/extra/zfs.ko.xz
/usr/lib/modules/5.1.19-300.fc30.x86_64/extra/zlua.ko.xz
/usr/lib/modules/5.1.19-300.fc30.x86_64/extra/znvpair.ko.xz
/usr/lib/modules/5.1.19-300.fc30.x86_64/extra/zunicode.ko.xz
/var/lib/dkms/zfs/kernel-5.1.19-300.fc30.x86_64-x86_64
/var/lib/dkms/zfs/0.8.1/5.1.19-300.fc30.x86_64
/var/lib/dkms/zfs/0.8.1/5.1.19-300.fc30.x86_64/x86_64
/var/lib/dkms/zfs/0.8.1/5.1.19-300.fc30.x86_64/x86_64/Module.symvers
/var/lib/dkms/zfs/0.8.1/5.1.19-300.fc30.x86_64/x86_64/log
/var/lib/dkms/zfs/0.8.1/5.1.19-300.fc30.x86_64/x86_64/module
/var/lib/dkms/zfs/0.8.1/5.1.19-300.fc30.x86_64/x86_64/zfs_config.h
/var/lib/dkms/zfs/0.8.1/5.1.19-300.fc30.x86_64/x86_64/log/make.log
/var/lib/dkms/zfs/0.8.1/5.1.19-300.fc30.x86_64/x86_64/module/icp.ko.xz
/var/lib/dkms/zfs/0.8.1/5.1.19-300.fc30.x86_64/x86_64/module/spl.ko.xz
/var/lib/dkms/zfs/0.8.1/5.1.19-300.fc30.x86_64/x86_64/module/zavl.ko.xz
/var/lib/dkms/zfs/0.8.1/5.1.19-300.fc30.x86_64/x86_64/module/zcommon.ko.xz
/var/lib/dkms/zfs/0.8.1/5.1.19-300.fc30.x86_64/x86_64/module/zfs.ko.xz
/var/lib/dkms/zfs/0.8.1/5.1.19-300.fc30.x86_64/x86_64/module/zlua.ko.xz
/var/lib/dkms/zfs/0.8.1/5.1.19-300.fc30.x86_64/x86_64/module/znvpair.ko.xz
/var/lib/dkms/zfs/0.8.1/5.1.19-300.fc30.x86_64/x86_64/module/zunicode.ko.xz




Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:

All dkms files related to the kernel version are removed from the system.

# updatedb ; locate 5.1.19-300.fc30
<no results>

Additional info:

Comment 1 Ben Cotton 2020-04-30 20:31:30 UTC
This message is a reminder that Fedora 30 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 30 on 2020-05-26.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '30'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 30 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 2 Gregory Lee Bartholomew 2020-05-13 04:34:39 UTC
I just saw this as well when doing a "dnf update" on a Fedora 31 system that included both a new kernel and a new version of zfs-dkms. The leftover files under /var/lib/dkms/zfs can be particularly problematic for zfs-dkms. I saw the following lines in my terminal while performing an update:

...
  Running scriptlet: kernel-core-5.6.11-200.fc31.x86_64                                                                                      44/44 
dkms: running auto installation service for kernel 5.6.11-200.fc31.x86_64
Error! Could not locate dkms.conf file.
File: /var/lib/dkms/zfs/0.8.3/source/dkms.conf does not exist.
 Done. 

  Running scriptlet: zfs-0.8.4-1.fc31.x86_64                                                                                                 44/44
...

This is untested, but I think a crude workaround for the above problem in particular may be to create an executable script named /etc/kernel/install.d/35-zfs-dkms-cleanup.install containing the following lines:

---
#!/usr/bin/sh

if [[ "$1" == "add" ]]; then
   b="/var/lib/dkms/zfs"
   z=$(/usr/bin/rpm -q zfs-dkms)
   for d in $(/usr/bin/find $b -mindepth 1 -maxdepth 1 -type d -printf "%f\n"); do
      if [[ "$z" != "zfs-dkms-$d"* ]]; then
         rm -rf "$b/$d"
      fi
   done
fi

exit 0
---

I've added the above script to my personal system to hopefully resolve this issue the next time around, but I haven't tested it yet.

Comment 3 Gregory Lee Bartholomew 2020-05-13 04:40:14 UTC
It would probably be good to do a little input validation on $z in the above script ... This one might be a little better:

---
if [[ "$1" == "add" ]]; then
   b="/var/lib/dkms/zfs"
   z=$(/usr/bin/rpm -q zfs-dkms)
   for d in $(/usr/bin/find $b -mindepth 1 -maxdepth 1 -type d -printf "%f\n"); do
      if [[ "$z" == "zfs-dkms-"* ]] && [[ "$z" != "zfs-dkms-$d"* ]]; then
         rm -rf "$b/$d"
      fi
   done
fi

exit 0
---

Comment 4 Gregory Lee Bartholomew 2020-05-13 04:42:25 UTC
And I missed the shebang line -- #!/usr/bin/sh -- on that last one, sorry, I wish I could edit these posts.

Comment 5 Gregory Lee Bartholomew 2020-05-14 02:11:18 UTC
FYI, it looks like ColMelvin just fixed this bug upstream:

https://github.com/ColMelvin/zfs/commit/4a7771819ac8f4523392c14a66cc453b345084cc

I advise that users finding this bug report use (or wait for) his proper patch rather than the untested hack I posted earlier.

In particular, I'm worried that running "rpm -q" while a rpm transaction is in progress as my aforementioned hack attempts to do might cause the installation process to hang.

Comment 6 Ben Cotton 2020-05-26 14:29:47 UTC
Fedora 30 changed to end-of-life (EOL) status on 2020-05-26. Fedora 30 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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