A user can use the “snap set” command to config the watchdog parameters.
$ snap set core watchdog.runtime-timeout=1m
Set a timeout value in seconds (or in other time units if suffixed with “ms”, “min”, “h”, “d”, “w”). The watchdog hardware (/dev/watchdog) or the kernel option systemd.watchdog-device=) will be programmed to automatically reboot the system if it is not contacted within the specified timeout interval.
$ snap set core watchdog.shutdown-timeout=10m
It works as a safety net to ensure that the reboot takes place even if a clean reboot attempt times out. Note that the shutdown-timeout applies only to the second phase of the reboot, i.e. after all regular services are already terminated, and after the system and service manager process (PID 1) got replaced by the systemd-shutdown binary.
The function is implemented with systemd. The configuration can be validated in /etc/systemd/system.conf.d/10-snapd-watchdog.conf
Dear chihchun:
Thanks!
The case you said is that snapd use the watchdog (indeed it’s support by systemd).
If a snap app want to use the hardware watchdog, what should we do ?
Currently, there is a limitation on access to hardware watchdog from snap app. There is no security interface for /dev/watchdog yet.
Could you share a bit more the use case, why do you like to manage hw watchdog from an application? That will help the core team to justify the feature request.