Enabling the watchdog timer on the Raspberry Pi

Turns out that the Broadcom BCM2708 chip on the RPi has a hardware watchdog. This can be very useful if your RPi is located remotely and locks up. However, this would not the preferred method of restarting the unit and in extreme cases this can result in file-system damage that could prevent the RPi from booting. If this occurs regularly you better find the root cause of the problem rather than fight the symptoms.

Enable Watchdog Kernel Module

echo 'bcm2708_wdog' >> /etc/modules
sudo modprobe bcm2708_wdog

Install Watchdog Daemon

sudo apt-get install watchdog chkconfig
chkconfig watchdog on
sudo /etc/init.d/watchdog start

sudo vim /etc/watchdog.conf
# Uncomment the line watchdog-device = /dev/watchdog
# You might also want to uncomment max-load-1, or add something like "max-load-1 = 24" to reset your Pi if the load average exceeds 24 in any 1-minute span.

sudo /etc/init.d/watchdog restart

The watchdog daemon will send /dev/watchdog a heartbeat every 10 seconds. If /dev/watchdog does not receive this signal it will brute-force restart your Raspberry Pi.

If you are feeling adventurous you can test the setup by launching one of the fork-bombs you can find out there. Just make sure you don’t have anything of importance running.
: (){ :|:& };:

Thanks to gadgetoid for the original tip !

Author: Leo Gaggl

ict business owner specialising in mobile learning systems. interests: sustainability, internet of things, ict for development, open innovation, agriculture

2 thoughts on “Enabling the watchdog timer on the Raspberry Pi”

Leave a Reply