kernel-debs: run header_postinst.d from linux-headers postinst (DKMS order-safety) - #10775
igorpecovnik wants to merge 1 commit into
Conversation
…order-safety) DKMS modules only ever got built from the linux-image postinst, via run-parts /etc/kernel/postinst.d (which includes dkms's autoinstall hook). The linux-headers postinst compiled the header tree but did NOT run /etc/kernel/header_postinst.d -- unlike stock Debian, whose linux-headers postinst runs that directory, and where dkms ships /etc/kernel/header_postinst.d/dkms to (re)build modules when headers install. Consequence: the linux-image / linux-headers configure ORDER mattered. In a single apt transaction (kernel install or an armbian-config branch switch) apt is free to configure linux-image before linux-headers; the image postinst then runs its DKMS autoinstall with no headers present and fails, and nothing rebuilds the module when the headers are configured moments later. The module is left unbuilt, and pre-#10766 the failed image postinst aborted before the boot-symlink relink, which could leave the board unbootable. Observed on a Radxa Cubie A5E: current->edge switch failed because aic8800-sdio DKMS built with no edge headers. Fix: after compiling the header tree, run the same header hooks Debian runs -- run-parts /etc/kernel/header_postinst.d with the kernel version as the argument. Now whichever of linux-image / linux-headers is configured LAST builds the DKMS modules, so install order no longer matters and the module is ready on the first pass. Non-fatal (|| true): a broken out-of-tree module must not stop the headers package from installing. Verified live on the Cubie A5E: with aic8800-sdio registered in the dkms tree but not built for the running kernel (the exact post-image-install state), running `run-parts --arg=<ver> /etc/kernel/header_postinst.d` rebuilt and installed the module ("Autoinstall ... succeeded"). Complements #10766 (relink boot symlinks even if a postinst.d hook fails): that keeps the board bootable if a build genuinely fails; this makes the build succeed regardless of package configure order. Signed-off-by: Igor Pecovnik <igor@armbian.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: armbian/build/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe linux-headers post-installation hook now runs Debian header hooks through ChangesLinux headers hook integration
Priority: ⚪ Not assessed Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Nice find. Still, I'm confused:
|
|
Current tests shows that kernel switching with DKMS driver works as expected. I installed ZFS to Rock 5 running vendor kernel, then run auto test, which switches to current and then back to vendor. ZFS followed.
Power — min 0.90 W · avg 6.99 W · peak 14.30 W · 1272 samples xychart-beta
title "Power — Rock 5B Plus 01"
x-axis "sample" 1 --> 1272
y-axis "W" 0.5 --> 14.5
line [3.65, 3.19, 3.86, 3.78, 4.37, 3.55, 3.76, 5.60, 9.56, 7.96, 11.25, 10.73, 5.08, 4.96, 9.51, 8.80, 9.34, 9.33, 6.59, 4.18, 3.49, 3.51, 3.59, 5.19, 7.01, 5.76, 6.12, 7.19, 6.61, 10.69, 11.74, 12.13, 8.48, 6.12, 9.78, 8.90, 11.61, 11.15, 6.78, 4.91]
|
Root cause (the package-level fix)
DKMS modules only ever got built from the linux-image postinst, via
run-parts /etc/kernel/postinst.d(which includes dkms's autoinstall hook). Armbian's linux-headers postinst compiles the header tree but does not run/etc/kernel/header_postinst.d— unlike stock Debian, whose linux-headers postinst runs that directory, and wheredkmsships/etc/kernel/header_postinst.d/dkmsto (re)build modules when headers install.Consequence: the linux-image / linux-headers configure order mattered. In a single apt transaction (a kernel install, or an armbian-config branch switch) apt is free to configure
linux-imagebeforelinux-headers; the image postinst then runs DKMS autoinstall with no headers present and fails, and nothing rebuilds the module when the headers are configured moments later. The module is left unbuilt — and pre-#10766 the failed image postinst aborted before the boot-symlink relink, which could leave the board unbootable.Observed on a Radxa Cubie A5E:
current→edgeswitch failed becauseaic8800-sdioDKMS built with no edge headers; CI [autotests run 35497058533] recordedkernel-switch edge → dpkg_state=absent.Fix
After compiling the header tree, run the same header hooks Debian runs —
run-parts /etc/kernel/header_postinst.dwith the kernel version as the argument. Now whichever oflinux-image/linux-headersis configured last builds the DKMS modules, so install order no longer matters and the module is ready on the first pass. Non-fatal (|| true): a broken out-of-tree module must not stop the headers package from installing.Verification (live, Radxa Cubie A5E)
With
aic8800-sdioregistered in the dkms tree but not built for the running kernel (the exact post-image-install state), running just the header hook:The header hook rebuilt and installed the module first-try — exactly what this change wires into the headers postinst.
bash -nclean; rendered postinst fragment verified.Relationship to the other fixes
/bootsymlinks) even if apostinst.dhook genuinely fails.Signed-off-by: Igor Pecovnik igor@armbian.com
Summary by CodeRabbit