Is it possible to activate the watchdog on any Linux machine?

There are two types of watchdog; hardware and software. On the Orange Pi the SOC chip provides a hardware watchdog. If initialised then it needs to be pinged every so often, otherwise it performs a board reset.

However not many desktops have hardware watchdogs, so the kernel provides a software version. Now the kernel will try and keep track, and force a reboot. This isn't as good as a hardware watchdog because if the kernel, itself, breaks then nothing will trigger the reset. But it works.

The software watchdog can be initialised by loading the softdog module

% modprobe softdog
% dmesg | tail -1
[  120.573945] softdog: Software Watchdog Timer: 0.08 initialized. soft_noboot=0 soft_margin=60 sec soft_panic=0 (nowayout=0)

We can see this has a 60 second timeout by default.

If I then do

% echo > /dev/watchdog
% dmesg | tail -1
[  154.514976] watchdog: watchdog0: watchdog did not stop!

We can see the watchdog hadn't timed out.

I then leave the machine idle for a minute and on the console I see

[  214.624112] softdog: Initiating system reboot

and the OS reboots.


On a modern Linux operating system that uses systemd you can configure systemd to interact with the hardware watchdog on your behalf, rather than doing it yourself or using a separate user-space daemon.

You can do that by setting a (positive) RuntimeWatchdogSec value in the systemd configuration file, /etc/systemd/system.conf.