daedalus-v4l2-dkms: postinst builds only for running kernel; modules missing after kernel-switch reboot #64
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom
On higgs (Pi CM5) the entire daedalus stack went silent after a reboot into a freshly installed kernel:
/dev/daedalus-v4l2absent,daedalus-v4l2.serviceskipped onConditionPathExists=, libva fell back to a non-existent v3d driver andvaInitializefailed, Firefox/ffmpeg -hwaccel vaapicorrectly fell back to SW. Diagnosis was time-consuming because everything looks installed (dpkg -l daedalus-v4l2-dkmsreportsii) and the failure is silent.Root cause
From
/var/log/dpkg.logon higgs:The 6.18 kernel image was installed 13.5 hours BEFORE
daedalus-v4l2-dkmswas first installed. When the kernel image landed,/etc/kernel/postinst.d/dkmsran for whatever DKMS modules were already registered — daedalus wasn't one of them. Thendaedalus-v4l2-dkmsgot installed while the system was still running 6.12.88. Its postinst (seedebian/daedalus-v4l2-dkms/build-deb.shlines 75–131) only does:dkms autoinstallbuilds for the running kernel only. So the module was built for 6.12.88, and the same pattern repeated through every subsequent bump (r18, r20, r22, r24). The 6.18.29 kernel directory/lib/modules/6.18.29+rpt-rpi-2712/updates/dkms/stayed empty for daedalus the whole time. On the first reboot into 6.18.29 (this morning),modprobe daedalus_v4l2→Module ... not found. Daemon never starts.Manually running
sudo dkms add daedalus_v4l2/0.1.0+r24+gf0d4186 && sudo dkms autoinstall && sudo modprobe daedalus_v4l2 && sudo systemctl start daedalus-v4l2.serviceimmediately recovered the stack —LIBVA_DRIVER_NAME=v4l2_request vainfothen surfaces H264 Main/High/CB, HEVC Main, VP9 Profile 0, AV1 Profile 0 cleanly.Why the existing safety net misses it
The postinst has a verification block that warns if
dkms statusdoesn't showinstalled|loadedfor$KERNELVER=$(uname -r). On the install host that check passed (the build succeeded for the running 6.12 kernel) — so no warning fired. The check has no notion of "other installed kernels also need this module".The
dkms addline silences stderr via2>/dev/null || true, which is independently risky (would also mask a genuine add failure), but isn't the proximate cause here.Proposed fix (smallest)
Change the postinst to autoinstall across every kernel that has headers on disk, not just the running one:
Matches the standard pattern used by
dh_dkms-generated packages.Proposed fix (cleaner, follow-up)
Migrate
debian/daedalus-v4l2-dkms/todh-dkmsdebhelper (Debian's endorsed convention). It handles the multi-kernel case, plus registers a dpkg trigger on/lib/modules/*so newly installed kernels automatically rebuild. The current bespokebuild-deb.shcould keep building the .deb the same way and just emit the dh-dkms-style postinst/prerm hooks instead of the hand-rolled ones.Sibling package
The Arch
arch/daedalus-v4l2-dkmsPKGBUILD likely has the same gap. Should audit.Repro environment
6.12.75+rpt-rpi-2712,6.12.88+deb13-arm64,6.18.29+rpt-rpi-2712daedalus-v4l2-dkmsversions seen on host (per dpkg log): r16+gf55b2cd, r18+g481279c, r20+g3dd0eb0, r22+g462aa4b, r24+gf0d4186Severity
Medium — silent failure mode that costs hours to diagnose and looks like a Firefox/libva bug. Bites every time the running kernel switches without a fresh
dpkg-reconfigure. Workaround documented above.Fixed via #65 (merged) and validated on higgs.
Before the upgrade: 1 kernel covered (the running one only). After: every kernel on higgs whose headers are installed has
/lib/modules/<kver>/updates/dkms/daedalus_v4l2.ko.xzpopulated. Running module loaded and/dev/daedalus-v4l2present as expected.The
dh-dkmsmigration (proposed as the long-term option) is intentionally not in this PR — would restructure the build fromdpkg-deb-by-hand to debhelper-drivendpkg-source. Worth doing separately if/when we hit the next case the minimal fix doesn't catch (e.g. headers installed after the package via a laterapt install).