Skip to content

fix(packaging): build DKMS modules when kernel headers are configured - #34

Merged
JBailes merged 2 commits into
mainfrom
fix/headers-rerun-dkms
Nov 2, 2026
Merged

JBailes merged 2 commits into
mainfrom
fix/headers-rerun-dkms

Conversation

@JBailes

@JBailes JBailes commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

bindeb-pkg's linux-headers package has no maintainer scripts. When apt configures linux-image before linux-headers, the image's DKMS hook skips the kernel ("kernel headers ... do not seem to be installed") and nothing reruns it, so the kernel boots without its DKMS modules. A SmoothNAS box upgraded to 7.2.14-83 that way booted without ZFS: its pool didn't import and SMB and NFS failed on the shares stored on it.

Give the headers package a postinst that runs
/etc/kernel/header_postinst.d on configure, as Debian's headers packages do. The build fails if bindeb-pkg ever ships its own headers postinst, rather than silently overwriting it.

Test: make check-headers-dkms-order (a new release CI step) installs openzfs-zfs-dkms, then linux-image alone, then linux-headers in a Debian 13 container. ZFS must be absent after the image (negative control) and built for the kernel, with its vermagic, after the headers.

bindeb-pkg's linux-headers package has no maintainer scripts. When apt
configures linux-image before linux-headers, the image's DKMS hook skips
the kernel ("kernel headers ... do not seem to be installed") and nothing
reruns it, so the kernel boots without its DKMS modules. A SmoothNAS box
upgraded to 7.2.14-83 that way booted without ZFS: its pool didn't
import and SMB and NFS failed on the shares stored on it.

Give the headers package a postinst that runs
/etc/kernel/header_postinst.d on configure, as Debian's headers packages
do. The build fails if bindeb-pkg ever ships its own headers postinst,
rather than silently overwriting it.

Test: make check-headers-dkms-order (a new release CI step) installs
openzfs-zfs-dkms, then linux-image alone, then linux-headers in a Debian
13 container. ZFS must be absent after the image (negative control) and
built for the kernel, with its vermagic, after the headers.
@JBailes
JBailes force-pushed the fix/headers-rerun-dkms branch from ffff8ca to 538003f Compare November 2, 2026 12:33
The new headers postinst builds DKMS modules when the headers are
configured, and check-headers-dkms-order failed on amd64 doing it:
dpkg could not configure linux-headers-7.2.15-86-smoothkernel. The
headers ship a prebuilt tools/objtool/objtool, which links libelf.so.1
and runs in every x86 out-of-tree build, but bindeb-pkg declares no
Depends, and neither dkms nor openzfs-zfs-dkms pulls libelf in. arm64
passed because it has no objtool. SmoothNAS boxes only worked because
the smoothnas package depends on libelf-dev.

- build-kernel.sh reads what each ELF tool in the headers package links
  and adds the matching Depends (libelf1t64 | libelf1, libssl3t64 |
  libssl3 for sign-file); a library with no package mapping fails the
  build instead of shipping a package that cannot build modules.
- check-headers-dkms-order.sh no longer discards apt output: a failed
  step prints its apt/dpkg output, dkms status and every DKMS make.log,
  so the CI log says why. Its container stays minimal on purpose.
@JBailes
JBailes merged commit 89ad633 into main Nov 2, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant