User Tools

Site Tools



Step 1: Load kernel module

Load kernel module (temporary until next reboot):

sudo modprobe bcm2708_wdog

Configure loading the module on startup:

sudo nano /etc/modules

Add this line at the end:


Step 2: Install watchdog

sudo apt-get install watchdog

I got these error messages during the installation:

Setting up watchdog (5.12-1) ...
/run/udev or .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation.
insserv: warning: script 'mathkernel' missing LSB tags and overrides
insserv: There is a loop between service watchdog and mathkernel if stopped
insserv: loop involving service mathkernel at depth 2
insserv: loop involving service watchdog at depth 1
insserv: Stopping mathkernel depends on watchdog and therefore on system facility `$all' which can not be true!
insserv: exiting now without changing boot order!
update-rc.d: error: insserv rejected the script header
dpkg: error processing watchdog (--configure):
 subprocess installed post-installation script returned error exit status 1

I guess this issue is related to a change in the Raspbian image at the end of 2013. The solution is based on this forum post:

sudo nano /etc/init.d/mathkernel

Add these lines after the first line #!/bin/sh:

# Provides:          skeleton
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Example initscript
# Description:       This file should be used to construct scripts to be
#                    placed in /etc/init.d.

These lines are copied from the file /etc/init.d/skeleton.

Step 3: Configure watchdog

sudo nano /etc/watchdog.conf

Check that these two lines are activated (remove the #-sign in front of these lines):

max-load-1              = 24
watchdog-device = /dev/watchdog

Restart the watchdog:

sudo /etc/init.d/watchdog restart

Step 4: Test watchdog

Ensure that you saved all open data before you run this command! Otherwise they will be lost!

The following command (fork bomb) will crash the Raspberry PI:

:(){ :|:& };:

The Raspberry PI should restart after some seconds, if the watchdog is working correctly.

watchdog.txt · Last modified: 29.01.2014 22:36 by derk