Repository navigation
feat(watchdog): add x86 hardware watchdog support - #2019
Closed
filippocarletti wants to merge 1 commit into
Closed
filippocarletti wants to merge 1 commit into
filippocarletti wants to merge 1 commit into
Conversation
procd pings /dev/watchdog, but no driver was shipped. Loading all upstream drivers is not enough: the first registered device owns /dev/watchdog, and ib700wdt registers without probing the hardware. ns-watchdog ships i6300esb, iTCO_wdt, sp5100_tco and softdog (opt-in), blacklists them for kmodloader in /etc/modules.conf and picks the driver in preinit, before procd opens the device. The blacklist is rewritten at boot if a restored config changed it. Disable with system.@System[0].watchdog=0 or ns.watchdog=0 on the kernel command line. Document it in the package README and a design note. Assisted-by: Claude Code:Claude Opus 5.5
filippocarletti
force-pushed
the
feat/watchdog
branch
from
November 17, 2026 17:44
56a4a8d to
c365d13
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I want NethSecurity to reset itself when the kernel or the init process (procd) hangs, instead of waiting for someone to power-cycle the box. procd already pings
/dev/watchdogevery 5 seconds with a 30 seconds timeout; what was missing is loading the right driver.Loading every upstream watchdog driver is not enough. The first device that registers owns
/dev/watchdog. On a PC Engines APU, theib700wdtdriver took it without checking the hardware, so procd was pinging a watchdog that could not reset the board. This PR adds thens-watchdogpackage, which picks the driver at boot before procd opens the device. It is enabled by default on x86, also after an upgrade.i6300esb(QEMU/KVM/Proxmox),iTCO_wdt(Intel),sp5100_tco(AMD, APU).softdogis shipped but used only when configured. I left out the Super I/O drivers (w83627hf_wdt,it87_wdt,f71808e_wdt),ib700wdtandmlx_wdt./etc/modules.conf(owned by ubox, edited in a marked block), so kmodloader never loads them on its own, neither before preinit nor in/etc/init.d/boot./etc/modules.confis saved by sysupgrade and backups, so the hook writes the block again at boot if a restored copy dropped or changed it./lib/preinit/83_ns_watchdog) loads them withinsmod, which ignores the blacklist, in priority order and keeps only the ones that find a device.system.@system[0].watchdog=0, or withns.watchdog=0on the kernel command line from the GRUB menu.What I tested on the current PR image, on a PC Engines APU and on a KVM Q35 VM with an i6300esb watchdog:
sp5100_tcoon the APU,i6300esbon the VM (withiTCO_wdtkept as a secondary device). Nothing is reloaded after the selection.system.@system[0].watchdog=0on the APU: after reboot no watchdog module is loaded and there is no/dev/watchdog. Removing the option turns the watchdog back on.ns.watchdog=0added in GRUB menu also disabled the watchdog./etc/modules.conf: before preinit nothing was loaded (that step reads the image copy), but/etc/init.d/bootloadedsoftdogaswatchdog2. With ns-watchdog 0.0.3 the same test logsrestored the modules blacklist, the block is back identical to the image copy, andsoftdogis not loaded. A normal reboot does not rewrite the file. The other 0.0.3 fixes (log messages when a watchdog module cannot be unloaded) are tested only in a busybox simulation.How to test
dmesg | grep ns-watchdogshows the chosen driver,ubus call system watchdogreportsrunning,/etc/modules.confcontains thens-watchdogblock, andlsmodshows nosoftdogand no watchdog module without a device.ubus call system watchdog '{"stop":true}': the machine resets after about 30 seconds and comes back with all services running./dev/watchdogand no watchdog module loaded.uci set system.@system[0].watchdog=0; uci commit system; reboot: no/dev/watchdog, also after boot completes. Same withns.watchdog=0added in the GRUB menu.ns-watchdogblock from/etc/modules.confand reboot:dmesgshowsrestored the modules blacklist, the block is back andsoftdogis not loaded.:(){ :|:& };:See also