Raspberry Pi

From Timon's Wiki
Revision as of 13:20, 18 March 2023 by Timon (talk | contribs) (Created page with "=== Watchdog setup === Be sure the watchdog is installed as a Kernel module: <code>ls -al /dev/watchdog*</code> should show one or more files. The watchdog must then be enabled in <code>systemd</code>. Edit the <code>/etc/systemd/system.conf</code> config file. Under the <code>[Manager]</code> section, add the following:<syntaxhighlight lang="toml"> RuntimeWatchdogSec=10 ShutdownWatchdogSec=10min </syntaxhighlight>Reboot the system to apply all changes. <code>dmesg</cod...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Watchdog setup

Be sure the watchdog is installed as a Kernel module: ls -al /dev/watchdog* should show one or more files.

The watchdog must then be enabled in systemd. Edit the /etc/systemd/system.conf config file. Under the [Manager] section, add the following:

RuntimeWatchdogSec=10
ShutdownWatchdogSec=10min

Reboot the system to apply all changes. dmesg should now log watchdog being started.

$ dmesg | grep -i watchdog
[    0.596574] bcm2835-wdt bcm2835-wdt: Broadcom BCM2835 watchdog timer
[    2.336190] systemd[1]: Using hardware watchdog 'Broadcom BCM2835 Watchdog timer', version 0, device /dev/watchdog
[    2.336229] systemd[1]: Set hardware watchdog to 10s.

To test the watchdog, you can start a fork bomb to freeze the system, the watchdog should detect the freeze and automatically reboot. This fork bomb can be executed inside your shell: :(){ :|:& };: This will freeze your system! Make sure nothing important is running in the background. It can take a few minutes before reboot.