Page MenuHomeVyOS Platform

Add hardware watchdog support via systemd
In progress, LowPublicFEATURE REQUEST

Description

Systemd since v183 supports managing the hardware watchdog. It would be a good way to add watchdog support to vyos.

Example:
/etc/systemd/system.conf.d/enabled-watchdog.conf

[Manager]
RuntimeWatchdogSec=15s
ShutdownWatchdogSec=10mins

Ideally the RuntimeWatchdogSec should be configurable as some hardware watchdogs only support limited interval. eg: Broadcom BCM2835 Watchdog timer only supports <= 15s.
The ShutdownWatchdogSec default is 10mins which can be painfully long for the system to shutdown. My preference is to set it shorter (eg: 2mins) to allow forced unclean reset if system has issues shutting down or rebooting.

systemd watchdog documentation: https://0pointer.de/blog/projects/watchdog.html

Details

Version
-
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Feature (new functionality)

Event Timeline

From my experience having systemd manage the watchdog has been very stable.
I would not recommend using using watchdogd to manage the hardware watchdog, it is ancient and doesn't integrate well with systemd.

In most cases the watchdog module is automatically loaded and device /dev/watchdog0 will exist. No special care for loading module is generally needed.

Viacheslav changed the subtype of this task from "Task" to "Feature Request".Jan 28 2025, 6:27 PM

Been testing, driver module loading is not always automatic. It is likely best to allow an option to specify the module to load. The vyos config syntax could likely be based this https://github.com/vyos-legacy/vyatta-watchdog/blob/current/README.md

wdctl can be used to check for the presence of a watchdog. Note if the watchdog isn't being managed via systemd (or similar) it will be kept alive by a kernel watchdog process.

Output:

Device:        /dev/watchdog0
Identity:      iTCO_wdt [version 0]
Timeout:       30 seconds

Example config:

# /etc/systemd/system.conf.d/watchdog.conf
[Manager]
RuntimeWatchdogSec=10
ShutdownWatchdogSec=5min
RebootWatchdogSec=5min

The RuntimeWatchdogSec is the watchdog interval, ShutdownWatchdogSec is time allowed systemd to shutdown system. and RebootWatchdogSec is equivalent for system reboots.

Viacheslav changed the task status from Open to In progress.Tue, Nov 11, 2:25 AM
Viacheslav assigned this task to Firefishy.