MagicMirror² v2.14.0 is available! For more information about this release, check out this topic.

Bullet Proof Mirror aka Watchdog

  • #Bullet proof mirror and how to enable the pi watch dog.

    The pi has a watchdog timer circuit built into it that is a prety reasonable means of detecting crashes and forcing an automated reboot.

    So first we need to enable it.

    First enable watchdog from /boot/config.txt, adding the following line:

    # Then install watchdog service:
    sudo apt install watchdog
    #Uncomment the following line from /etc/watchdog.conf
    # Uncomment to enable test. Setting one of these values to '0' disables it.
    # These values will hopefully never reboot your machine during normal use
    # (if your machine is really hung, the loadavg will go much higher than 25)
    max-load-1		= 24
    max-load-5		= 18
    max-load-15		= 12
    watchdog-device	= /dev/watchdog

    So basically constant loads and watchdog will kick in not sure what the time base is think its seconds but the above does the job. Then do a reboot and we can check its running by searching the syslog in /var/log for ‘watchdog’ But how do we know its working? We can test with a fork bomb and overload the Pi. If you have done an OC (Over Clock) on your pi do not run this and for anyone this test is your own decision. I have to say that but yeah you know.

    So what we will do is turn off all the swap so the test ends quicker and it doesn’t thrash your flash.

    sudo swapoff -a
    import os

    So we found that watchdog is running in the syslog and now to test. python3

    Doesn’t take long to swamp the system that one The time base has me confused as its very quick to react on a load test but pretty sure the ping test is a minute. Its good how it is and the default values seem to work well as the highest I have ever seen my pi is just above 3 Ping test I tried this by putting in the IP of my desktop which is local but then I just shut down. And right enough after a minute my computer was no longer available the pi restarted.

    The only thing I am worried about and I guess this is true that you could enter an IP that may never exist and turn your pi into a rotating boot. Time to put the SD card in a reader and edit your files and remove that watchdog test on another computer I guess. If you don’t have an overzealous internal firewall that putting in your router ip with me would make a good WiFi watchdog Then maybe a internet IP like googles main DNS of might but not sure if you constanty pinging that you may get filtered. is usually what many use just never set up a perm watchdog so honestly can not say - did actually take that service down and got bombarded by sysadmins to re-instate and its prob the UK’s unofficial official ping test.

    etc/watchdog.conf is a standard linux watchdog file So you can read up on these.

    As per usual you can all my stuff on

Log in to reply