Does the Raspberry Pi 4 have a hardware watchdog timer like the RPi3 does? If it does, which kernel module should I load in order to use it?
I'm running Raspbian Buster, kernel 4.19.93-v7l+
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.Sign up to join this community
To check if the watchdog is available, you can run
wdctl which gives you a bit more info than just looking at
To start using the watchdog, you can still use the old
watchdog daemon mentioned in the other answers, but since 2012
systemd has had built in support for watchdogs that doesn't require installing anything else and offers better compatibility with the shutdown/reboot process.
To use this, edit
/etc/systemd/system.conf and set these values as required:
RuntimeWatchdogSec- reboot the system if nothing contacts the watchdog within this time (specify the value like
10s, etc.) This defaults to
off, meaning the system will never reboot when it freezes.
RebootWatchdogSec- different timeout used when rebooting, in case you need more (or less) time. Defaults to
10min. Note that this only applies during the last phase of the reboot, once all running programs have been terminated. If your programs take too long to shut down, this value won't help (see below).
ShutdownWatchdogSec- this is no longer used, it was renamed to
RebootWatchdogSecin July 2019.
KExecWatchdogSec- ignore this unless you know what kexec is and you know you are using it. (It's used when faking a reset by just restarting the kernel - the lack of a hardware reset means the watchdog is still running and may expire before everything has finished loading again).
WatchdogDevice- this can be ignored as the default of
DefaultTimeoutStopSec- how long to wait for each program to exit when shutting down or rebooting. Defaults to
90sbut I am impatient so I set this to
10sas anything on my system that takes longer than five seconds is broken, so a 10 second timeout is just fine.
If you are using a Pi 2 or older, set
/boot/config.txt and reboot. This is enabled by default from the Raspberry Pi 3 onwards, so you can skip this step with recent models.
You don't need to run
systemctl enable watchdog (that's for the old method mentioned above) but you will need to run
systemctl daemon-reload (or reboot) after making these changes before they will take effect.
Ok, after some testing it seems like the watchdog module is loaded by default.
To check for yourself, see if
This is the guide what worked for me.
Do NOT attempt to load ANY modules.
config.txt and Device Tree will load the module.
NOTE you also need to enable the watchdog service. See https://raspberrypi.stackexchange.com/a/68332/8697