启用Raspberry Pi 3的Watchdog

modprobe bcm2835_wdt
apt install watchdog

# testing
lsmod | grep bcm2835_wdt
wd_identify --config-file /etc/watchdog.conf --verbose

# configuration
echo "dtparam=watchdog=on" >> /boot/config.txt
sed -i "s/none/bcm2835_wdt/g" /etc/default/watchdog
cat > /etc/modprobe.d/watchdog.conf <<EOF
options bcm2835_wdt nowayout=1 heartbeat=15
EOF
echo "bcm2835_wdt" >> /etc/modules-load.d/modules.conf
cat > /etc/sysctl.d/00-panic.conf <<EOF
kernel.panic=60
EOF
cat > /etc/watchdog.conf <<EOF
#ping                    = 192.168.1.1
#ping                    = 192.168.1.2
#interface               = eth0
#file                   = /var/log/messages
#change                 = 1407

# 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              = 18
max-load-5              = 16
max-load-15             = 12

# Note that this is the number of pages!
# To get the real size, check how large the pagesize is on your machine.
#min-memory             = 1
#allocatable-memory     = 1

#repair-binary          = /usr/sbin/repair
#repair-timeout         = 60
#test-binary            =
#test-timeout           = 60

# The retry-timeout and repair limit are used to handle errors in a more robust
# manner. Errors must persist for longer than retry-timeout to action a repair
# or reboot, and if repair-maximum attempts are made without the test passing a
# reboot is initiated anyway.
#retry-timeout          = 60
#repair-maximum         = 1

watchdog-device = /dev/watchdog

# Defaults compiled into the binary
temperature-sensor      = /sys/class/thermal/thermal_zone0/temp
max-temperature = 80

# Defaults compiled into the binary
#admin                  = root
#interval               = 1
#logtick                = 1
#log-dir         = /var/log/watchdog

# This greatly decreases the chance that watchdog won't be scheduled before
# your machine is really loaded
realtime                = yes
priority                = 1

# Check if rsyslogd is still running by enabling the following line
#pidfile         = /var/run/rsyslogd.pid

watchdog-timeout = 15
EOF
systemctl enable watchdog
systemctl start watchdog

注:老的Raspberry Pi的相应内核模块名为 bcm2708_wdog ,其余类似。

发表评论

电子邮件地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据