Monday, September 11, 2017

Help! I Can't Reach the Power Switch

Pi is going to live in a remote location keeping it up and responding is better than a long drive just to press a reboot button. The watchdog service is going to help us out by rebooting the system when one of it's tests gets triggered.

Outline of Actions

  1. Turn on watchdog hardware
  2. Install Service
  3. Configure watchdog tests
  4. Run service
  5. Setup service to run on boot

Action Details

1. Turning on the hardware

Modify system config
sudo nano /boot/config.txt
Add this:
# turn on the hardward watchdog 
dtparam=watchdog=on
After reboot you should see watchdog listed (I don't know why there are two)
$ ls -al /dev/watchdog*
crw------- 1 root root  10, 130 Sep 11 15:38 /dev/watchdog
crw------- 1 root root 252,   0 Sep 11 15:38 /dev/watchdog0

2. Install the software

sudo apt-get install watchdog

3. Enable the tests

sudo nano /etc/watchdog.conf
uncomment a few lines
max-load-1      = 24
min-memory      = 1
watchdog-device = /dev/watchdog

4. Run the Service

sudo systemctl start watchdog
sudo systemctl status watchdog

5. Run on Boot

sudo nano /lib/systemd/system/watchdog.service
 
Change WantedBy to this:
[Install]
WantedBy=multi-user.target
 
And Enable
sudo systemctl enable watchdog

Resources

Enabling Watchdog on Raspberry Pi by Abdullah Bashir
Is this the correct way to install the watchdog package? by paulv 

No comments:

Post a Comment