FS#72046 - libalpm dkms hook/script fails at removing dkms modules on upgrade

Attached to Project: Arch Linux
Opened by Tamim (shmoo) - Monday, 06 September 2021, 12:21 GMT
Last edited by Sébastien Luttringer (seblu) - Tuesday, 09 November 2021, 10:09 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 16
Private No

Details

Description:

Regression with DKMS 2.8.6

DKMS always fails to remove modules on package upgrade via the libalpm-upgrade hook.
Manually uninstalling with `dkms remove --no-depmod nvidia/470.57.02 --all` works as expected but not when invoked from the alpm hook/script.

(2/3) Remove DKMS modules
==> Unable to remove module nvidia/470.57.02 for kernel 5.10.62-1-lts: Not found in dkms status output.
==> Unable to remove module nvidia/470.57.02 for kernel 5.13.13-arch1-1: Not found in dkms status output.
==> Unable to remove module nvidia/470.57.02 for kernel 5.13.14-1-clear: Not found in dkms status output.

Downgrading DKMS to 2.8.5 fixes the issue

Additional info:
* dkms version: 2.8.6


Steps to reproduce:

1. build and install some dkms module with makepkg
2. reinstall the same package to trigger the dkms hook

This task depends upon

Closed by  Sébastien Luttringer (seblu)
Tuesday, 09 November 2021, 10:09 GMT
Reason for closing:  Fixed
Additional comments about closing:  dkms 2.8.6-2
Comment by gamezelda (gamezelda) - Thursday, 09 September 2021, 18:38 GMT Comment by gamezelda (gamezelda) - Thursday, 09 September 2021, 18:51 GMT
Tentative patch (this is applied to hook.sh in the Arch package itself)
Comment by gamezelda (gamezelda) - Friday, 10 September 2021, 23:13 GMT
(I was taking a second look at the patch and I noticed that the format in dkms status didn't change for status 'added' like it did for 'built' and 'installed', so I thought my patch broke it. However, after some testing and checking the code, I found removing a module in status 'added' was also broken in dkms 2.8.5-1, so the patch doesn't break anything that wasn't already broken.)
Comment by David C. Rankin (drankinatty) - Saturday, 11 September 2021, 17:34 GMT
I can confirm this exact problem. I had to go manually remove old directories from /var/lib/dkms/vboxhost/ before 'dkms status' will run without error. This started following:

[2021-09-05T20:29:01-0500] [ALPM] upgraded dkms (2.8.5-1 -> 2.8.6-1)
Comment by Stuart Cardall (itoffshore) - Sunday, 12 September 2021, 21:30 GMT
I can confirm this too on zfs / lkrg / nvidia - the old modules do not get removed & the new modules get built too quickly (in a fraction of a second) - & fail to load during boot.

Downgrading dkms back to 2.8.5 & modules build again correctly.
Comment by Sébastien Luttringer (seblu) - Monday, 13 September 2021, 02:36 GMT
I released a quick fix version based on your patch. Thanks!

I'll look later at the second part of the issue ; modules in added state (e.g when module fail to build for all kernels) are not removed.
Comment by ketsui (ketsui) - Tuesday, 28 September 2021, 06:22 GMT
Apparently dkms also fails to remove modules on kernel uninstall, I was testing something by installing/uninstalling linux-lts (I use vanilla linux) and the pacman hook complains as follow:

==> Unable to remove module rtl8188fu/r60.e2d69b2 for kernel 5.10.69-1-lts: Not found in dkms status output.

The command I used:

sudo pacman -Rns linux-lts{,-headers}

I am running dkms version 2.8.6-2.

Loading...