Keeping your Raspberry Pi alive: enabling Hardware Watchdog under Arch Linux

 

images-1

Raspberry Pi [WWW] is a nice platform for implementing nice and potentially complex & useful systems. Once prototyping and testing is over, all you want now is that thing “just works”. Yes, we want to avoid reseting the device manually too! Unfortunately, complex electronics like Raspberry Pi might get stuck either in software or at hardware level. So, the question is: can we reset the device when somehow it gets stuck and shows no life?

The solution is to use BCM2708 chip’s hardware watchdog [PDF]. It will poll the device at regular intervals and will do a reset for us. Assuming that you are running Linux based distribution adapted for the Raspberry Pi device, this is going to be a 2-step dance in terminal.

The watchdog can be enabled as we load the kernel module:

sudo modprobe watchdog

The module is not loaded by default with each boot of the system. To be sure it gets loaded every time as we start our Raspberry Pi, create a file named /etc/modules-load.t/bcm2708-wdog.conf with following contents

bcm2708_wdog

Next, we need to enable the watchdog service which will poll the device at regular intervals. First you enable the service (will persist upon reboots)

sudo systemctl enable watchdog.service

Second, you just start the service in familiar fashion by issuing the command

sudo systemctl start watchdog.service

But, before you start the service, you may need to look at the watchdog daemon configuration file /etc/watchdog.conf. If you loaded the module and enabled the service, the file should be already there with some meaningful defaults. I recommend you to skim through the corresponding man page to get idea of defaults and possibilities that are at your fingertips

man watchdog.conf

Credits go to [WWW] and [WWW] with instruction how to do the same in Debian.

This entry was posted in Uncategorized and tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *