Raspberry Pi Watchdog Timer
Earlier today I experienced an amount of panic that I think most nerds can relate to. I tried to sync my git project and I got “no route to host” in response. GASP. There are so many things that can go wrong, especially when you’re forcing all the heavy lifting on a tiny little raspberry pi. The thing has been a brute every since I got it, though, chugging away with nary a care. It truly has been a workhorse for the specs and size.
Well, initially I had assumed the “no route to host” involved the pi just seizing on me, as I’ve had pi’s seize on me before. After about half an hour of fiddling around I wound up discovering that the issue was a DHCP misfire that I can’t really attribute to anything specifically at the moment, not the pi itself. However, I really enjoy the idea of the watchdog timer rebooting the pi if something does seize up, so I turned it on.
What you’ll need to do is edit the /etc/systemd/system.conf
file and add these lines:
RuntimeWatchdogSec=15s
RebootWatchdogSec=10min
DefaultTimeoutStopSec=90s
Then just issue sudo systemctl daemon-reload
and you should be all set. If the watchdog doesn’t get a response after 15 seconds it reboots the pi. Boom. Fixed. Preemptively fixed, rather.