szatox Advocate
Joined: 27 Aug 2013 Posts: 3432
|
Posted: Sun Sep 04, 2022 3:01 pm Post subject: Protip: hardware watchdog |
|
|
So, I've recently stumbled upon this underappreciated thing and I though someone here might find it handy:
Some arm boards come equipped with a hardware watchdog.
One notable example would be rpi4b, which I imagine is quite popular by now. I don't know about earlier versions, but if you have them, you might want to check.
Enabling hardware watchdog takes 3 steps:
1) kernel support for the available watchdog chip
2) opening /dev/watchdog to start the reset timer (closing it may or may not stop the timer, depending on kernel's config)
3) repeatedly writing to /dev/watchdog to reset the reset timer
Step 2 and 3 should probably be taken care of by a dedicated service (like, you know, "watchdog" for example). Systemd's pid 1 can also be configured to do that via variables in /etc/systemd/system.conf
I know I'm not the only one who experienced crashes, and sometimes small arm boards are used in remote locations making resetting them quite a hassle. While watchdog is obviously inferior to stuff not crashing in the first place, it can be a pretty good workaround.
Also, my rpi seems to have stopped crashing since I enabled watchdog. I knew computers can sense fear when the user is in a hurry, but now I have another point showing they can be successfully threatened into working too
Alright, folks, that's it for today.
GL&HF |
|