Skip to content

Instantly share code, notes, and snippets.

@lbussy
Last active August 6, 2021 11:22
Show Gist options
  • Save lbussy/17f57adefbf744a102166d0894b54c6c to your computer and use it in GitHub Desktop.
Save lbussy/17f57adefbf744a102166d0894b54c6c to your computer and use it in GitHub Desktop.
How to set up the Raspberry Pi Watchdog Daemon

Raspberry Pi Watchdog System

There are two parts of the Raspberry Pi's Watchdog system; the daemon and the hardware module.

First, load the watchdog module:

$ sudo modprobe bcm2708_wdog

(may have changed to bcm2835_wdt)

Then edit the /etc/modules file so that it restarts with the Pi:

$ sudo nano /etc/modules

Add the following line to the end:

bcm2708_wdog

(may have changed to bcm2835_wdt)

Install and configure the watchdog daemon to start on boot:

$ sudo apt-get install watchdog chkconfig
$ systemctl enable watchdog
$ systemctl start watchdog

Next configure watchdog:

$ sudo nano /etc/watchdog.conf

Uncomment the line #watchdog-device = /dev/watchdog so it reads:

watchdog-device = /dev/watchdog

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

Testing:

Issue the following command (known as a "fork bomb") to lock up your system:

: (){ :|:& };:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment