FS#31848 - [dkms] Cannot properly work in case of package upgrade

Attached to Project: Community Packages
Opened by Laurent Carlier (lordheavy) - Monday, 08 October 2012, 22:34 GMT
Last edited by Allan McRae (Allan) - Saturday, 17 November 2012, 22:57 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Laurent Carlier (lordheavy)
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 is used to build fglrx module from catalyst with the following install file:
--8<--
post_install()
{
dkms add -m fglrx -v $1
dkms build -m fglrx -v $1
dkms install -m fglrx -v $1
}

post_upgrade()
{
# removing old version
dkms remove -m fglrx -v $2 --all
# then installing the new one
dkms add -m fglrx -v $1
dkms build -m fglrx -v $1
dkms install -m fglrx -v $1
}

pre_remove()
{
dkms remove -m fglrx -v $1 --all
}
-->8--

When installing a module managed by dkms, it create a symling from the /usr/src/mod-ver to /var/lib/dkms/mod-ver during the "add" step

The problem, when upgrading the package, the old package is removed, breaking the symlink created by dkms, so dkms cannot remove the previous module, leaving old modules in /lib/modules/... and old files/symling in /var/lib/dkms

The solution is to change the bahaviour of dkms: copying source files, instead of linking.
This task depends upon

Closed by  Allan McRae (Allan)
Saturday, 17 November 2012, 22:57 GMT
Reason for closing:  Fixed
Additional comments about closing:  pacman 4.0.3-4
Comment by Peter Wu (Lekensteyn) - Thursday, 11 October 2012, 13:02 GMT
DKMS works perfect if the .install files are more sane.

This commit is just wrong:
https://projects.archlinux.org/svntogit/community.git/commit/trunk?h=packages/catalyst-dkms&id=07123edeb2acc83c68525b739eb0fe30e7ea0610

As you said, the old source files are already removed. This is the correct command for pre_upgrade (assuming the PKGBUILD manpage is correct):
- dkms remove -m fglrx -v $1 --all
+ dkms remove -m fglrx -v $2 --all

See also https://wiki.archlinux.org/index.php/Dynamic_Kernel_Module_Support#How_to_create_.install_.2F_dkms.conf_files.3F

(can the affected package be changed to catalyst-dkms?)
Comment by Laurent Carlier (lordheavy) - Thursday, 11 October 2012, 16:08 GMT
Ok, it seems there is a bug in pacman, according to https://wiki.archlinux.org/index.php/PKGBUILD#install

"pre_upgrade - The script is run right before files are extracted. Two arguments are passed in the following order: new package version, old package version."

But in pre_upgrade, only $1 is passed; new version, no old version in $2; $2 is empty
Comment by Peter Wu (Lekensteyn) - Wednesday, 14 November 2012, 23:54 GMT
I have posted a workaround on https://wiki.archlinux.org/index.php/Dynamic_Kernel_Module_Support#How_to_create_.install_.2F_dkms.conf_files.3F Basically, you use pacman -Qi to query the current installed version.

I can indeed confirm that the second version argument is never passed (checked both with a test package and the alpm source code).

Loading...