Enable hardware watchdog on Raspberry Pi-powered Volumio audio player

Posted on Thu 28 March 2024 in Audio

The Raspberry Pi features a built-in hardware watchdog timer that automatically resets the system if it becomes unresponsive or freezes. If enabled, it expects the OS to reset the hardware watchdog every 15 seconds. Otherwise the hardware watchdog will initiate a system reboot. This can be handy when used as an audio player like Volumio especially if the hardware is not easy to access.

Given that systemd provides support for hardware watchdogs, there is no need to install additional userspace tools for basic hardware reset functionality. As a prerequisite, SSH must be enabled temporarily in Volumio. After successful login, the Device Tree parameter for watchdog can be configured:

echo 'dtparam=watchdog=on' |sudo tee -a /boot/userconfig.txt

After reboot, the next step is to uncomment and change RuntimeWatchdogSec and ShutdownWatchdogSec in /etc/systemd/system.conf

sudo vi /etc/systemd/system.conf
RuntimeWatchdogSec=14
ShutdownWatchdogSec=2min
  • RuntimeWatchdogSec=14 - controls the keep-alive ping interval but systemd pings the hardware at half the specified interval (every 7 seconds)
  • ShutdownWatchdogSec=2min - controls the watchdog interval to use during reboots

The changes can applied via sudo systemctl daemon-reload (or a reboot) and tested via the classic fork bomb

:(){ :|:& };:

Once executed, the system will become unresponsive so the watchdog initiates a reboot.