Bug 264981 - dkms remove does not remove/restore modules
dkms remove does not remove/restore modules
Product: Fedora
Classification: Fedora
Component: dkms (Show other bugs)
All All
medium Severity low
: ---
: ---
Assigned To: Matt Domsch
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2007-08-29 16:15 EDT by Piergiorgio Sartor
Modified: 2007-11-30 17:12 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-10-24 03:02:14 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Piergiorgio Sartor 2007-08-29 16:15:30 EDT
Description of problem:
When removing a module installed with dkms, a module replacing one in the
kernel, the dkms module is not removed from "/lib/modules/2.6.xxx/extra/" and
the original module, usually stored in
"/var/lib/dkms/fuse-kmod/original_module/2.6.xxx/{arch}/", is deleted and not
restored in the "/lib/modules/2.6.xxx/kernel/..." place.

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

How reproducible:

Steps to Reproduce:
Install some modules, like fuse, using dkms.
Remove the module with dkms.
Check "/lib/modules/2.6.xxx/extra/" and the kernel, eventually with "rpm -qV

Actual results:
In "extra" a module is still there and the rpm verification reports the original
module is missing.

Expected results:
The "extra" dir should not contain the module and the rpm verification should
succeed, i.e. the original module should be restored.

Additional info:
This seems to happen since the "extra" dir is used to store the new module,
before, when there was a replacement in the same sub-dir, everything was working
Modules which do not replace original ones, like the nvidia, do not seem to
cause any issue.
The check is done after the install in reboot, I do not know if this could make
any difference.
Comment 1 Matt Domsch 2007-09-19 23:11:31 EDT
Adding jcm for his thoughts on dealing with the /lib/modules/$ver/'extra' directory.
Comment 2 Piergiorgio Sartor 2007-09-23 08:58:46 EDT
I checked quickly.
It seems that the original module is restored in /lib/modules/$ver/extra instead
of the original location.
So what happens could be: the new module is installed in 'extra' (always) and
the original is taken from wherever it was and stored in /var/lib/dkms/...
Once "dkms remove" is issued, the original module is moved in 'extra' (since no
other location seems to be known, at this point) and not in the original place.
I guess the problem is that, when replacing existing modules, dkms should not
copy the new one in 'extra', but (after the backup) in the correct location.
In the "fuse.ko" example, the new module should be installed in:


and not in 'extra', so that the inverse operation (remove new, restore old)
could succeed.

Hope this helps.
Comment 3 Matt Domsch 2007-10-10 16:23:20 EDT
actually, it does quite a bit.  It only fails when uninstalling something for
which there's already one elsewhere in the tree - e.g. in both kernel/fs/fuse
and extras/.  Turns out, this function here was returning the lookup in the
wrong order, so it would delete the one in kernel/fs/fuse rather than deleting
the one in extras/ like it should.  It needs to delete from extras/ first.  Can
you give this patch a try?


diff --git a/dkms b/dkms
index 98ce503..d199893 100755
--- a/dkms
+++ b/dkms
@@ -1456,9 +1456,9 @@ function possible_dest_module_locations()
     # override_dest_module_location() is what controls whether or not they're
the same.

     local location
-    location[0]="${DEST_MODULE_LOCATION[$count]}"
-    [ "${location[0]}" != "${dest_module_location[$count]}" ] && \
-       location[1]="${dest_module_location[$count]}"
+    location[0]="${dest_module_location[$count]}"
+    [ "${DEST_MODULE_LOCATION[$count]}" != "${dest_module_location[$count]}" ] && \
+       location[1]="${DEST_MODULE_LOCATION[$count]}"

     echo "${location[0]} ${location[1]}"
Comment 4 Piergiorgio Sartor 2007-10-10 17:19:47 EDT
Assuming I patched dkms correctly, it seems to me nothing changed, the original
fuse.ko module is copied in extra, as before.
Following is the output of "dkms remove". The original module is moved to extra,
I confirmed the output here is correct.
BTW, the patch command somehow failed (with reject), I had to patch dkms by
hand. The "diff -u" has "@@ -1414,9 +1414,9 @@" as reference and not "@@ -1456,9
+1456,9 @@".
Could you eventually attach your gzipped version of dkms?

-------- Uninstall Beginning --------
Module:  fuse-kmod
Version: 2.7.0
Kernel: (x86_64)

Status: Before uninstall, this module version was ACTIVE on this kernel.
Removing any linked weak-modules

 - Uninstallation
   - Deleting from: /lib/modules/
 - Original module
   - Archived original module found in the DKMS tree
   - Moving it to: /lib/modules/

Removing original_module from DKMS tree for kernel (x86_64)

DKMS: uninstall Completed.

Deleting module version: 2.7.0
completely from the DKMS tree.
Comment 5 Matt Domsch 2007-10-10 18:01:17 EDT
It is supposed to put it into /extra.  This is where module-init-tools expects
updated (or out-of-tree) modules to be put now, for Fedora 6 and higher.

I'll post a momentarily to the Fedora buildsystem.
Comment 6 Matt Domsch 2007-10-10 23:25:57 EDT
is built and available, will be in F7 testing repo shortly too.
Comment 7 Piergiorgio Sartor 2007-10-11 14:40:04 EDT
(In reply to comment #6)
> is built and available, will be in F7 testing repo shortly too.

I made a couple of tests with the new version and it seems it works!

The fuse.ko module was restored in the original location (kernel/fs/fuse) and
rpm -qV kernel-... was not reporting any issue.

Thanks a lot.

I guess, after going into fedora updates, you could close the bug.

Thanks again.

Comment 8 Fedora Update System 2007-10-11 18:53:06 EDT
dkms- has been pushed to the Fedora 7 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update dkms'
Comment 9 Fedora Update System 2007-10-24 03:02:11 EDT
dkms- has been pushed to the Fedora 7 stable repository.  If problems still persist, please make note of it in this bug report.

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