Why is apt-mark hold not stopping dkms from running on Debian?

My apt install id3v2 fails due to

dkms: running auto installation service for kernel 6.1.0-18-amd64.

with

dpkg: error processing package linux-headers-amd64 (--configure):
 dependency problems - leaving unconfigured
Processing triggers for man-db (2.11.2-2) ...
Errors were encountered while processing:
 linux-image-6.1.0-18-amd64
 linux-headers-6.1.0-18-amd64
 linux-image-amd64
 linux-headers-amd64

I’ve tried apt-mark hold linux-image-amd64 and have two holds

$ apt-mark showhold
linux-headers-amd64
linux-image-amd64

I am running 6.1.0-17-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.69-1 (2023-12-30) x86_64 GNU/Linux

Asked By: OrigamiEye

||

A package hold doesn’t prevent packages which are already installed from being processed:

hold is used to mark a package as held back, which will prevent the package from being automatically installed,
upgraded or removed

In your case, linux-image-6.1.0-18-amd64 is already installed (at least partially), and it’s its configuration which tries to run dkms and fails.

Since you’re still running 6.1.0-17, the simplest solution for now is to remove 6.1.0-18:

sudo apt purge linux-image-6.1.0-18-amd64

(which will also remove linux-image-amd64).

Once the failing dkms module is fixed, you’ll have to install linux-image-amd64 again to upgrade your kernel.

If the failure is caused by NVIDIA drivers, that problem has already been fixed; you should upgrade the drivers instead of removing the kernel.

Answered By: Stephen Kitt

If you have problems like this again with dkms you can stop the failing building until a fix for that is released. Note this is only a workaround not a solution.

Check with

dkms status

which module is concerned.

Then show under

/usr/src/name-of-whatever-pachage-which-version/dkms.conf

for the string

AUTOINSTALL="yes"

and change to no.
Do not forget to change it back after a bugfix; or you can long wait for building. 😀

Answered By: nobody
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.