1

How does one check the status of the hardware watchdog with systemd?

With util-linux you have the wdctl command which prints some information, however this doesn't always work (e.g. on a Raspberry Pi 3 or later). For example on a Pi 3:

# wdctl /dev/watchdog0
wdctl: cannot read information about /dev/watchdog0: No such file or directory
# wdctl /dev/watchdog
wdctl: cannot read information about /dev/watchdog: No such file or directory

However the watchdog appears to be active:

# dmesg | grep watchdog
[    6.985782] bcm2835-wdt bcm2835-wdt: Broadcom BCM2835 watchdog timer
[   17.190956] systemd[1]: Using hardware watchdog 'Broadcom BCM2835 Watchdog timer', version 0, device /dev/watchdog
[   17.206391] systemd[1]: Set hardware watchdog to 15s.

So is there a systemd-specific command that can be used to display the current status of the hardware watchdog and what systemd itself is doing with it?

Note that the old watchdog service no longer applies, as this was from before systemd got native hardware watchdog support:

# systemctl status watchdog
Unit watchdog.service could not be found.

I am after a command that provides similar information to wdctl, in that the watchdog timer is active, in use, and what the timeout is currently set to. Sort of like systemctl list-timers but for the hardware watchdog.

1 Answer 1

1

watchdogs are exclusive use devices. Which explains the wdctl outputs you reported.

However, all watchdog devices export their settings in /sys

You should then be able to find them under /sys/class/watchdog/*

If you want a command, then would grep . /sys/class/watchdog/*/*satisfy your need ?

3
  • That's odd, because on some systems I can run wdctl with the watchdog active and it tells me what the current timeout is. Running your grep command reveals basic information about the device, but nothing of interest. Looking through the sysfs directory, there doesn't seem to be anything that reports whether the watchdog is active, or what the current timeout is.
    – Malvineous
    Jan 2 at 12:30
  • 1
    @Malvineous : The 2 infos you are looking for are supposed to be found in /sys/class/watchdog/watchdogN/ status and timeout files respectively (N standing for associated id) don't you get those files ?
    – MC68020
    Jan 2 at 13:06
  • Interesting. No, I don't have those files in there, only dev, device, power, subsystem and uevent. It's the same on the system that wdctl works, as on the one where it doesn't. Hunting through the various subfolders I don't see any files like status or timeout or anything else of interest.
    – Malvineous
    Jan 2 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.