Package: dkms
Version: 3.2.0-1
If a dkms module package calls /usr/lib/dkms/common.postinst in its
postinst (such as one built with dh-dkms and its default postinst [1]),
but no kernel headers are present, it will output "Building for ", then
exit 0, without actually building the module. This is because the
common.postinst (from dkms_common.postinst.in [2]) just loops over the
$KERNELS variable without checking if its empty.
Previously, the dkms package installed headers along with itself, but as
of trixie, that stopped for various reasons (see related bug 1091428 [3]).
The postinst should generate a warning, if not an error, if no kernels
are found. It's effectively a dependency being missing, but the
installation ends with a false success. In an ideal world, package
dependencies could address this, but for the reasons above, it's not
practical to use package dependencies to ensure the *correct* kernel
headers are installed.
I reported this upstream [4] but thought I ought to report it here as
well because ultimately it's dh-dkms on Debian that's using said common
postinst.
Happy to submit a patch to fix this, unless it's preferred to address it
upstream first, in which case I'll start there.
1.
https://salsa.debian.org/debian/dkms/-/blob/main/debian/scripts/postinst-dkms?ref_type=heads
2.
https://salsa.debian.org/debian/dkms/-/blob/main/dkms_common.postinst.in?ref_type=heads#L212-219
3. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1091428#10
4. https://github.com/dell/dkms/issues/545