Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#60266 - [dkms] Does not remove/uninstall modules that replace original kernel modules

Attached to Project: Arch Linux
Opened by Michael Niewöhner (c0d3z3r0) - Monday, 01 October 2018, 15:25 GMT
Last edited by Sébastien Luttringer (seblu) - Tuesday, 21 May 2019, 14:10 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Sébastien Luttringer (seblu)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

DKMS does not remove/uninstall modules that replace original kernel modules (like hdaps.ko)

Steps to reproduce:
- install tp_smapi-dkms
- install other kernel
- run dkms status:

[c0d3@z3r0 linux-c0]$ dkms status
chipsec-dkms, git: added
thinkpad-wmi, r12.aa470c9, 4.19.0-rc6-r1538316935-g17b57b188-1-c0, x86_64: installed
tp_smapi-dkms, 0.42, 4.19.0-r1537683012-g328c6333b-1-c0, x86_64: installed (original_module exists)
tp_smapi-dkms, 0.42, 4.19.0-rc6-r1538316935-g17b57b188-1-c0, x86_64: installed (original_module exists)
vboxhost, 5.2.18_OSE, 4.19.0-rc6-r1538316935-g17b57b188-1-c0, x86_64: installed


This also leads to orphaned modules dirs at /lib/modules:
[c0d3@z3r0 linux-c0]$ ls -l /lib/modules
total 40
drwxr-xr-x 3 root root 4096 1. Okt 15:48 4.17.14-1-c0
drwxr-xr-x 3 root root 4096 1. Okt 15:44 4.18.0-r1534819029-g778a3395-1-c0
drwxr-xr-x 3 root root 4096 1. Okt 15:46 4.18.0-r1534902456-gad1d6973-1-c0
drwxr-xr-x 3 root root 4096 1. Okt 15:47 4.18.0-r1535128463-gaa5b1054-1-c0
drwxr-xr-x 3 root root 4096 1. Okt 15:47 4.18.4-1-c0
drwxr-xr-x 3 root root 4096 1. Okt 15:47 4.19.0-r1535497894-g3f16503b-1-c0
drwxr-xr-x 3 root root 4096 1. Okt 15:47 4.19.0-r1536290397-ga49a9dcce-1-c0
drwxr-xr-x 4 root root 4096 1. Okt 15:59 4.19.0-r1537683012-g328c6333b-1-c0
drwxr-xr-x 5 root root 4096 1. Okt 17:12 4.19.0-rc6-r1538316935-g17b57b188-1-c0
drwxr-xr-x 2 root root 4096 1. Okt 17:12 extramodules-4.19-c0

Patch attached.

This task depends upon

Closed by  Sébastien Luttringer (seblu)
Tuesday, 21 May 2019, 14:10 GMT
Reason for closing:  Upstream
Comment by Sébastien Luttringer (seblu) - Friday, 26 October 2018, 11:45 GMT
I cannot reproduce with your instruction.

# dkms status
tp_smapi-dkms, 0.42, 4.18.16-arch1-1-ARCH, x86_64: installed
tp_smapi-dkms, 0.42, 4.18.3-seblu, x86_64: installed
tp_smapi-dkms, 0.42, 4.19.0-seblu, x86_64: installed
tp_smapi-dkms, 0.42, 4.9.128-seblu, x86_64: installed

The log of the installation:

# dkms install tp_smapi-dkms/0.42 -k 4.18.16-arch1-1-ARCH

Kernel preparation unnecessary for this kernel. Skipping...

Building module:
cleaning build area...
make -j8 KERNELRELEASE=4.18.16-arch1-1-ARCH KVER=4.18.16-arch1-1-ARCH HDAPS=1...
cleaning build area...
Kernel cleanup unnecessary for this kernel. Skipping...

DKMS: build completed.

hdaps.ko:
Running module version sanity check.
- Original module
- No original module exists within this kernel
- Installation
- Installing to /usr/lib/modules/4.18.16-arch1-1-ARCH/updates/

thinkpad_ec.ko:
Running module version sanity check.
- Original module
- No original module exists within this kernel
- Installation
- Installing to /usr/lib/modules/4.18.16-arch1-1-ARCH/extra/

tp_smapi.ko:
Running module version sanity check.
- Original module
- No original module exists within this kernel
- Installation
- Installing to /usr/lib/modules/4.18.16-arch1-1-ARCH/extra/

depmod....

DKMS: install completed.


So far, original_module happen when the built modules is already in extra or updates directories. Kernel provided modules doesn't belong in these directory. So how you hdsa modules did find its way in these directories?
Comment by Sébastien Luttringer (seblu) - Friday, 26 October 2018, 14:02 GMT
I guess you are working on 2.6.x branch, which is broken even with your last patch merged upstream.
Comment by Michael Niewöhner (c0d3z3r0) - Friday, 26 October 2018, 18:48 GMT
Hmmm, very interesting... You are right. "original_module exists" message should not happen in my case.
Yes, I'm on 2.6.x... well, no, actually it's master.
WTF. I have to check this again.
Thanks.
Comment by Michael Niewöhner (c0d3z3r0) - Friday, 26 October 2018, 19:27 GMT
I had a look at this again. "original_module" should happen indeed if a module replaces a kernel module.

I realized there is another upstream patch needed, additionally to my hook patch here.
My hook patch fixes the problem of not uninstalling dkms modules on a kernel update because of not matching "installed (original_module exists)".

With my patch:
[c0d3@z3r0 tmp]$ dkms status
chipsec-dkms, git: added
thinkpad-wmi, r12.aa470c9, 4.19.0-rc8-r1540570303-g18d0eae30-1-c0, x86_64: installed
tp_smapi-dkms, 0.42, 4.19.0-rc8-r1540570303-g18d0eae30-1-c0, x86_64: installed (original_module exists)
vboxhost, 5.2.18_OSE: added

Without my patch:
[c0d3@z3r0 tmp]$ dkms status
chipsec-dkms, git: added
thinkpad-wmi, r12.aa470c9, 4.19.0-rc8-r1540570303-g18d0eae30-1-c0, x86_64: installed
tp_smapi-dkms, 0.42, 4.19.0-rc8-r1540570303-g18d0eae30-1-c0, x86_64: installed (original_module exists)
tp_smapi-dkms, 0.42, 4.19.0-rc6-r1538316935-g17b57b188-1-c0, x86_64: installed (original_module exists)
vboxhost, 5.2.18_OSE: added

Without my hook patch, the rc6 kernel module does not get removed.




DKMS does not move the original module back to it's original place but into /updates.
That is why it is not removed by pacman! That's the patch needed upstream; move original_module back to it's original location.


[c0d3@z3r0 linux-c0]$ sudo dkms install tp_smapi-dkms/0.42 -k 4.19.0-rc8-r1540570303-g18d0eae30-1-c0

Creating symlink /var/lib/dkms/tp_smapi-dkms/0.42/source ->
/usr/src/tp_smapi-dkms-0.42

DKMS: add completed.

[...]

DKMS: build completed.

hdaps.ko:
Running module version sanity check.
- Original module
- Found /usr/lib/modules/4.19.0-rc8-r1540570303-g18d0eae30-1-c0/kernel/drivers/platform/x86/hdaps.ko
- Storing in /var/lib/dkms/tp_smapi-dkms/original_module/4.19.0-rc8-r1540570303-g18d0eae30-1-c0/x86_64/
- Archiving for uninstallation purposes
- Installation
- Installing to /usr/lib/modules/4.19.0-rc8-r1540570303-g18d0eae30-1-c0/updates/

[...]

depmod...

DKMS: install completed.


[c0d3@z3r0 linux-c0]$ sudo dkms uninstall tp_smapi-dkms/0.42 -k 4.19.0-rc8-r1540570303-g18d0eae30-1-c0
[sudo] password for root:

-------- Uninstall Beginning --------
Module: tp_smapi-dkms
Version: 0.42
Kernel: 4.19.0-rc8-r1540570303-g18d0eae30-1-c0 (x86_64)
-------------------------------------

Status: Before uninstall, this module version was ACTIVE on this kernel.

hdaps.ko:
- Uninstallation
- Deleting from: /usr/lib/modules/4.19.0-rc8-r1540570303-g18d0eae30-1-c0/updates/
- Original module
- Archived original module found in the DKMS tree
- Moving it to: /usr/lib/modules/4.19.0-rc8-r1540570303-g18d0eae30-1-c0/updates/

[...]

depmod...

Removing original_module from DKMS tree for kernel 4.19.0-rc8-r1540570303-g18d0eae30-1-c0 (x86_64)

DKMS: uninstall completed.
Comment by Michael Niewöhner (c0d3z3r0) - Friday, 26 October 2018, 20:12 GMT
Upstream issue opened: https://github.com/dell/dkms/issues/64
The patch here is still needed to keep dkms status clean!
EDIT: If upstream does not touch original kernel modules, this patch ist NOT needed, since "original_module exists" will not be shown.

UPDATE: All problems seem to be solved, when I comment out this line:
#((module_count == 1)) && archive_pref4=${installed_modules[0]}

UPDATE: PR at upstream: https://github.com/dell/dkms/pull/65
The patch here can be dropped then.
Comment by Michael Niewöhner (c0d3z3r0) - Sunday, 11 November 2018, 17:30 GMT
PR at upstream got merged. This is resolved now

Loading...