[systemd-devel] How to check watchdog status?

Mantas Mikulėnas grawity at gmail.com
Fri Jan 7 16:00:14 UTC 2022


On Fri, Jan 7, 2022 at 4:56 PM Adam Nielsen <a.nielsen at shikadi.net> wrote:

> Hi all,
>
> If I have asked systemd to make use of a hardware watchdog by setting
> RuntimeWatchdogSec in systemd.conf, how can I work out whether systemd
> is actually using the hardware watchdog or not?
>
> There is a non-systemd command "wdctl" which queries /dev/watchdog0 and
> tells you things like what the current timeout is set to, however
> on some of my machines this works, but on others it gives an error
> saying /dev/watchdog0 is unavailable.
>
> Some reading suggests only one program can access /dev/watchdog0 at a
> time, so I am not sure whether this means systemd is already using the
> watchdog and that's why wdctl can't access it, or does it mean the
> watchdog hardware isn't working properly?  On the machines where wdctl
> does print details about /dev/watchdog0, does this mean systemd has not
> taken ownership of it, or does that device allow multiple instances of
> the watchdog?
>

Recent versions of util-linux will obtain the information through /sys if
they're unable to open the watchdog device for whatever reason. Older
versions just give up.

Generally, if systemd or something else is actively using the watchdog,
then wdctl will report a "Timeleft" value lower than the total "Timeout" as
it is actively counting down. (If it does report identical values, that
*could* mean systemd just pinged the watchdog, so wait 1-2 seconds and
check again.)

-- 
Mantas Mikulėnas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20220107/fdd86a0c/attachment.htm>


More information about the systemd-devel mailing list