Bug 264981 - dkms remove does not remove/restore modules
Summary: dkms remove does not remove/restore modules
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: dkms
Version: 7
Hardware: All
OS: All
medium
low
Target Milestone: ---
Assignee: Matt Domsch
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-08-29 20:15 UTC by Piergiorgio Sartor
Modified: 2007-11-30 22:12 UTC (History)
3 users (show)

Fixed In Version: 2.0.17.5-1.fc7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-10-24 07:02:14 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Piergiorgio Sartor 2007-08-29 20:15:30 UTC
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):
dkms-2.0.16-1.fc7

How reproducible:
Always.

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

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
fine.
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-20 03:11:31 UTC
Adding jcm for his thoughts on dealing with the /lib/modules/$ver/'extra' directory.

Comment 2 Piergiorgio Sartor 2007-09-23 12:58:46 UTC
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:

/lib/modules/$ver/kernel/fs/fuse/

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 20:23:20 UTC
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?

Thanks,
Matt

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 21:19:47 UTC
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?
Thanks.

-------- Uninstall Beginning --------
Module:  fuse-kmod
Version: 2.7.0
Kernel:  2.6.22.9-91.fc7 (x86_64)
-------------------------------------

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

fuse.ko:
 - Uninstallation
   - Deleting from: /lib/modules/2.6.22.9-91.fc7/extra/
 - Original module
   - Archived original module found in the DKMS tree
   - Moving it to: /lib/modules/2.6.22.9-91.fc7/extra/

Removing original_module from DKMS tree for kernel 2.6.22.9-91.fc7 (x86_64)

DKMS: uninstall Completed.

------------------------------
Deleting module version: 2.7.0
completely from the DKMS tree.
------------------------------
Done.


Comment 5 Matt Domsch 2007-10-10 22:01:17 UTC
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 2.0.17.5 momentarily to the Fedora buildsystem.

Comment 6 Matt Domsch 2007-10-11 03:25:57 UTC
http://koji.fedoraproject.org/packages/dkms/2.0.17.5/1.fc7/noarch/dkms-2.0.17.5-1.fc7.noarch.rpm
is built and available, will be in F7 testing repo shortly too.


Comment 7 Piergiorgio Sartor 2007-10-11 18:40:04 UTC
(In reply to comment #6)
>
http://koji.fedoraproject.org/packages/dkms/2.0.17.5/1.fc7/noarch/dkms-2.0.17.5-1.fc7.noarch.rpm
> 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 22:53:06 UTC
dkms-2.0.17.5-1.fc7 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 07:02:11 UTC
dkms-2.0.17.5-1.fc7 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.