daedalus-v4l2-dkms: loud warning when DKMS build doesn't land
Sonnet pre-deployment review caught a BLOCKER: on a fresh higgs
(Debian 13 / Pi CM5) install without the RPi kernel headers
pre-installed, the postinst's `dkms autoinstall || true` silently
swallowed the build failure. Package appeared installed but the
.ko was absent; `modprobe daedalus_v4l2` then failed and the
entire stack was dead with no clear pointer to the cause.
Fix in both ecosystems:
debian/daedalus-v4l2-dkms/build-deb.sh:
- After `dkms autoinstall`, verify the post-condition with
`dkms status -m daedalus_v4l2 -v VER -k $(uname -r)`.
- If the module isn't 'installed' / 'loaded' for the running
kernel, emit a yellow-bolded ANSI warning naming the most
likely cause (kernel headers package missing) and the exact
recovery steps (linux-headers-rpi-2712 for RPi or
linux-headers-$KERNELVER for Debian generic, then
`dkms autoinstall` + `modprobe`).
- Colour only on TTY; the warning is unconditional regardless.
arch/daedalus-v4l2-dkms/:
- New daedalus-v4l2-dkms.install with post_install +
post_upgrade hooks that run the same `dkms status` check.
- post_upgrade catches the case where a kernel-headers package
was uninstalled / pruned between upgrades, silently
regressing the build.
- Wired into the PKGBUILD via install="${pkgname}.install".
Both versions point at the actual repair commands rather than
just saying "build failed", so the user is one apt/pacman away
from a working stack instead of debugging dkms internals.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+45
-2
@@ -78,10 +78,53 @@ set -e
|
||||
|
||||
NAME=${MODULE_NAME}
|
||||
VERSION=${PKGVER}
|
||||
KERNELVER=\$(uname -r)
|
||||
|
||||
# Yellow + bold ANSI for the warning so it stands out in apt's
|
||||
# stream of "Setting up" lines. Disable colour on non-TTY.
|
||||
if [ -t 1 ]; then
|
||||
Y=\$(printf '\\033[1;33m'); R=\$(printf '\\033[0m')
|
||||
else
|
||||
Y=''; R=''
|
||||
fi
|
||||
|
||||
warn() {
|
||||
printf '%s==> daedalus-v4l2-dkms: %s%s\\n' "\$Y" "\$1" "\$R" >&2
|
||||
}
|
||||
|
||||
if [ "\$1" = "configure" ]; then
|
||||
if ! command -v dkms >/dev/null 2>&1; then
|
||||
warn "dkms not installed; module \$NAME/\$VERSION not registered."
|
||||
warn "Install 'dkms' then run: dkms add \$NAME/\$VERSION && dkms autoinstall"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "\$1" = "configure" ] && command -v dkms >/dev/null 2>&1; then
|
||||
dkms add "\$NAME/\$VERSION" 2>/dev/null || true
|
||||
dkms autoinstall "\$NAME/\$VERSION" || true
|
||||
|
||||
# Don't let autoinstall failure mask the actual problem behind '|| true'.
|
||||
# Run it, capture the result, then verify post-condition.
|
||||
autoinstall_rc=0
|
||||
dkms autoinstall "\$NAME/\$VERSION" || autoinstall_rc=\$?
|
||||
|
||||
# Verify the module actually built + installed for the running kernel.
|
||||
status=\$(dkms status -m "\$NAME" -v "\$VERSION" -k "\$KERNELVER" 2>/dev/null || true)
|
||||
if ! printf '%s\\n' "\$status" | grep -q -E 'installed|loaded'; then
|
||||
warn ""
|
||||
warn "DKMS build did NOT land for kernel \$KERNELVER."
|
||||
warn " dkms status -m \$NAME -v \$VERSION -k \$KERNELVER:"
|
||||
warn " \$(printf '%s' "\$status" | head -1)"
|
||||
warn ""
|
||||
warn "Most likely cause: kernel headers package is missing."
|
||||
warn " Raspberry Pi OS / Pi 5: apt install linux-headers-rpi-2712"
|
||||
warn " Debian generic: apt install linux-headers-\$KERNELVER"
|
||||
warn ""
|
||||
warn "After installing headers, finish the install with:"
|
||||
warn " sudo dkms autoinstall \$NAME/\$VERSION"
|
||||
warn " sudo modprobe daedalus_v4l2"
|
||||
warn ""
|
||||
warn "Until then daedalus_v4l2 will NOT be loadable and the"
|
||||
warn "userspace daedalus-v4l2 daemon will have nothing to talk to."
|
||||
fi
|
||||
fi
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
Reference in New Issue
Block a user