User Tools

Site Tools

한국어

comfilepi:enable_the_internal_watchdog_timer

This is an old revision of the document!


Enable the Internal Watchdog Timer

The ComfilePi's SoC has an internal watchdog timer that can be used to automatically reboot the system should it ever become unresponsive.

First, verify that the /dev/watchdog device exists:

pi@raspberrypi:~ $ ls -al /dev/watchdog*
crw------- 1 root root  10, 130 Feb 14  2019 /dev/watchdog
crw------- 1 root root 251,   0 Feb 14  2019 /dev/watchdog0

Get more information about the watchdog configuration with `sudo wdctl`:

pi@raspberrypi:~ $ sudo wdctl
Device:        /dev/watchdog0
Identity:      Broadcom BCM2835 Watchdog timer [version 0]
Timeout:       15 seconds
Pre-timeout:    0 seconds
Timeleft:      14 seconds
FLAG           DESCRIPTION               STATUS BOOT-STATUS
KEEPALIVEPING  Keep alive ping reply          1           0
MAGICCLOSE     Supports magic close char      0           0
SETTIMEOUT     Set timeout (in seconds)       0           0

Uncomment the following lines in the file /etc/systemd/system.conf:

RuntimeWatchdogSec=10
RebootWatchdogSec=10min

Install the watchdog service with the following commands:

sudo apt update
sudo apt install watchdog

Check if the watchdog service is running with the following command:

pi@raspberrypi:~ $ systemctl | grep watchdog
watchdog.service         loaded active running   watchdog daemon 

If the watchdog.service is not running, start it with the following command:

sudo systemctl start watchdog.service

If you want the service to run automatically on each boot run the following command:

sudo systemctl enable watchdog.service

To test if the watchdog service is working, first, obtain root privileges and then initiate a forkbomb:

pi@raspberrypi:~ $ sudo su
pi@raspberrypi:~ $ echo 1 > /proc/sys/kernel/sysrq
pi@raspberrypi:~ $ echo "c" > /proc/sysrq-trigger

If the watchdog is working, then after about 10 to 20 seconds the ComfilePi should reboot.

ComfilePi - Industrial Raspberry Pi Panel PC

comfilepi/enable_the_internal_watchdog_timer.1687135182.txt.gz · Last modified: 2023/06/19 09:39 by COMFILE Technology