My remote Glinet-B1300 OpenWRT router is stuck for some unknown reason and I just recall that some OpenWRT routers have hardware watchdog. So when I visit my sumerhouse. I will manually reboot and enable the watchdog.
This page explains how to enable watchdog:
But what are precisely the cases when a reboot is triggered? Does loosing access to the Internet trigger a reboot? So does it ping some address?
Ok, sounds clear. Are thse settings permanent or lost after reboot ?
I'm not familiar with this at all but it has got my attention
Might be missing something but it looks like:
procd starts watchdogd, then watchdogd pokes procd at the configured or default intervals.
When poked, procd checks all the services it has started, restarting each service if failed.
There does not seem to be a mechanism to soft or hard reboot the device.
It would be easy to write a service (init.d) script to check parameters of choice and [soft] reboot as required. How to do a hard reset by software?
From my undertanding, you can query watchdog with:
# ubus call system watchdog
In case of hardware freeze, watchdog triggers a hardware reset and OpenWRT reboots.
OpenWrt kernel freeze, or procd failure.
But there can be many different "freezes".
A full on hardware freeze will stop watchdogd as well.
My question is what criteria does watchdog use to determine when to hard reset, and how does it do a hard reset? This must be hardware dependent and openwrt does not have hwreset command.
(This is where the usb monitor devices come into play)
Already answered above.
When its timer times out.
Thank you for the info. Is it possible to induce an artificial kernel freeze or a procd failure ?
I already tried that but i am not sure if this is the correct way and I will write down why i have my doubts. I tried the
echo c > /proc/sysrq-trigger in three cases:
- Ubuntu 20.04 (VirtualBox) -> system crashed
- OpenWRT (19.07.5 - APU2) with the watchdog enabled -> system rebooted 5 seconds afte the panic command, watchdog timeout=30sec
- OpenWRT 19.07.5(VirtualBox) complete absence of watchdog -> exact same behavior as in OpenWRT case above.
By testing the last case it should crash just like in Ubuntu case, right ?
Am i missing something ?
You can also try other methods:
If you are testing a VM, be sure to enable the watchdog device in the VM configuration.