| 63 | | Most Linux watchdog drivers have a {{{nowayout}}} kernel parameter which can be defaulted at build time via the kernel config {{{CONFIG_WATCHDOG_NOWAYOUT}}} or passed in via a parameter during module loading or via bootargs. Drivers that support this should display the nowayout setting upon driver init. If {{{nowayout=1}}} the driver does not allow the watchdog to be disabled (no way out of the situation). This is desireable in high reliability cases as the normal API behavior is to start the watchdog when {{{/dev/watchdog}}} is opened by the userspace app, and stop/disable the watchdog when it is closed (which can happen if the userspace watchdog process is killed or even crashes). |
| 64 | | |
| 65 | | Example trying to kill the watchdog: |
| 66 | | {{{ |
| 67 | | #!bash |
| 68 | | root@ventana:~# ps |
| 69 | | PID USER VSZ STAT COMMAND |
| 70 | | 1 root 1676 S init [5] |
| 71 | | 2 root 0 SW [kthreadd] |
| 72 | | 3 root 0 SW [ksoftirqd/0] |
| 73 | | .... |
| 74 | | 467 root 1720 S watchdog |
| 75 | | |
| 76 | | |
| 77 | | root@ventana:~# kill -9 467 |
| 78 | | [ 49.320282] watchdog watchdog0: nowayout prevents watchdog being stopped! |
| 79 | | [ 49.327081] watchdog watchdog0: watchdog did not stop! |
| 80 | | }}} |
| | 63 | Most Linux watchdog drivers have a {{{nowayout}}} kernel parameter which can be defaulted at build time via the kernel config {{{CONFIG_WATCHDOG_NOWAYOUT}}} or passed in via a parameter during module loading or via bootargs. If {{{nowayout=1}}} the driver does not allow the watchdog to be disabled (no way out of the situation). This is desirable in high reliability cases as the normal API behavior is to start the watchdog when {{{/dev/watchdog}}} is opened by the userspace app, and stop/disable the watchdog when it is closed (which can happen if the userspace watchdog process is killed or even crashes). |
| | 64 | |
| | 65 | Examples: |
| | 66 | - IMX SoC: |
| | 67 | * enabling nowayout via U-Boot bootargs: |
| | 68 | {{{#!bash |
| | 69 | u-boot=> setenv bootargs "$bootargs imx2_wdt.nowayout=1"; saveenv |
| | 70 | }}} |
| | 71 | * show watchdog source/driver: |
| | 72 | {{{#!bash |
| | 73 | # cat /sys/class/watchdog/watchdog0/identity |
| | 74 | imx2+ watchdog |
| | 75 | }}} |
| | 76 | * show nowayout: |
| | 77 | {{{#!bash |
| | 78 | # cat /sys/class/watchdog/watchdog0/nowayout |
| | 79 | 1 |
| | 80 | }}} |
| | 81 | * show module details for imx2_wdt (watchdog found in IMX SoC's) |
| | 82 | {{{#!bash |
| | 83 | # modinfo imx2_wdt |
| | 84 | name: imx2_wdt |
| | 85 | filename: (builtin) |
| | 86 | alias: platform:imx2-wdt |
| | 87 | license: GPL v2 |
| | 88 | file: drivers/watchdog/imx2_wdt |
| | 89 | description: Watchdog driver for IMX2 and later |
| | 90 | author: Wolfram Sang |
| | 91 | parm: nowayout:Watchdog cannot be stopped once started (default=0) (bool) |
| | 92 | parm: timeout:Watchdog timeout in seconds (default=60) (uint) |
| | 93 | }}} |
| | 94 | * killing watchdog process |
| | 95 | {{{#!bash |
| | 96 | root@noble-venice:~# echo 8 > /proc/sys/kernel/printk |
| | 97 | root@noble-venice:~# fuser /dev/watchdog |
| | 98 | /dev/watchdog: 507 |
| | 99 | root@noble-venice:~# ps -ef | grep 507 |
| | 100 | root 507 1 0 19:37 ? 00:00:00 /usr/sbin/watchdog |
| | 101 | root 557 538 0 19:38 ttymxc1 00:00:00 grep --color=auto 507 |
| | 102 | root@noble-venice:~# kill -9 507 |
| | 103 | root@noble-venice:~# [ 55.457477] watchdog: watchdog0: watchdog did not stop! |
| | 104 | root@noble-venice:~# fuser /dev/watchdog |
| | 105 | /dev/watchdog: 567 |
| | 106 | root@noble-venice:~# ps -ef | grep 567 |
| | 107 | root 567 1 0 19:38 ? 00:00:00 /usr/sbin/wd_keepalive |
| | 108 | root 574 538 0 19:38 ttymxc1 00:00:00 grep --color=auto 567 |
| | 109 | root@noble-venice:~# kill -9 567 |
| | 110 | root@noble-venice:~# [ 68.062109] watchdog: watchdog0: watchdog did not stop! |
| | 111 | [ 117.146646] watchdog: watchdog0: watchdog did not stop! |
| | 112 | ... |
| | 113 | U-Boot SPL 2024.10-00060-g6b9a0425420c (Jan 29 2026 - 17:17:43 -0800) |
| | 114 | GSCv3 : v65 0x42a7 RST:CPU Thermal protection:enabled at 96C |
| | 115 | }}} |
| | 116 | * Within 30 seconds of killing the watchdog processes the board reboots with a RST:CPU which indicates CPU watchdog |
| | 117 | * Note on Ubuntu root filesystems typically once /sbin/watchdog dies systemd launches /usr/sbin/wd_keepalive |