Watchdog on DietPi / RaspberryPi Zero

Hello
I tried to activate the watchdog on my system like shown here:

When I start the watchdog service I get the following errors

Jan 08 21:13:14 DietPi systemd[1]: Starting watchdog daemon...
Jan 08 21:13:15 DietPi watchdog[857]: unknown protocol icmp
Jan 08 21:13:15 DietPi sh[857]: watchdog: unknown protocol icmp
Jan 08 21:13:15 DietPi systemd[1]: watchdog.service: Control process exited, code=exited, status=2/INVALIDARGUMENT
Jan 08 21:13:15 DietPi systemd[1]: watchdog.service: Control process exited, code=exited, status=1/FAILURE
Jan 08 21:13:15 DietPi systemd[1]: watchdog.service: Failed with result 'exit-code'.
Jan 08 21:13:15 DietPi systemd[1]: Failed to start watchdog daemon.
Jan 08 21:13:15 DietPi systemd[1]: watchdog.service: Triggering OnFailure= dependencies.

Can you help me?

Can you share the service configuration. And maybe you would need to install packages like iputils-ping

here’s my configuration:

watchdog.conf.txt (5.9 KB)

iputils-ping was already installed…

ping and ping-count are commented in your config :thinking:.

Does this work?

ping 192.168.178.1

You are right. The configuration which lead to the errors was this one.
The ping count I did not change (but I tested it also with and without - same result).

watchdog.conf.txt (5.9 KB)

Run this and restart watchdog

cat << EOF >> /etc/default/watchdog
watchdog_options="ping"
EOF
systemctl restart watchdog.service

This did not change anything. The error message stays the same.

BTW: why are there two configuration files for the watchdog?

just executing ping like this:
ping 192.168.178.1

works fine… so very strange why the watchdog cannot execute it…

Pls can you share watchdog systemd definition

can you tell me how to do this?

systemctl cat watchdog.service

That’s strange. I tried to run it on my raspberry and I had the same issue with you. But it was fixed by enabling the ping in the watchdog options.

The defaults is not exactly a configuration file.

Here’s the output:

# /lib/systemd/system/watchdog.service
[Unit]
Description=watchdog daemon
Conflicts=wd_keepalive.service
After=multi-user.target
OnFailure=wd_keepalive.service

[Service]
Type=forking
EnvironmentFile=/etc/default/watchdog
ExecStartPre=/bin/sh -c '[ -z "${watchdog_module}" ] || [ "${watchdog_module}" = "none" ] || /sbin/modprobe $watchdog_module'
ExecStart=/bin/sh -c '[ $run_watchdog != 1 ] || exec /usr/sbin/watchdog $watchdog_options'
ExecStopPost=/bin/sh -c '[ $run_wd_keepalive != 1 ] || false'

[Install]
WantedBy=default.target

did a test on RP4B facing the same issue, while it was working fine on a x64 VM. interesting :thinking:

Does it probably require logind?

systemctl unmask systemd-logind
apt install dbus
systemctl start systemd-logind

Such a dependency for a watchdog would not be exactly helpful, when e.g. logind hangs (as well), but who knows. systemd added it as dependency for quite a bunch of features with Bookworm (the related systemd version).

nope, doesn’t change anything

To rule out the systemd unit: when stipping the service, and running watchdog from console with the arguments/options from /etc/default/watchdog, does it work? Ah hence just watchdog ping`.

Ahh wait a second, this cannot work. The watchdog_options are added as arguments just like that according to the systemd unit, and ping is no valid argument @trendy. There is no command-line argument to define the ping method. Instead one can set it e.g. to -c /etc/watchdog.conf to define the config file. That however is the default. So best to keep the watchdog_options variable commented in /etc/default/watchdog.

The command to test one console is hence reallt just watchdog, which then uses mentioned config file, just like the systemd service should do by default.

root@DietPiM6:~# watchdog
watchdog: unknown protocol icmp
root@DietPiM6:~#

Okay very weird. I will run some tests when I am back home in a day.