8

On my (embedded) system I have multiple watchdog character devices:

# ls -al /dev/watchdog*
crw------- 1 imp  root  10, 130 Apr 26 07:43 /dev/watchdog
crw------- 1 root root 253,   0 Apr 26 07:44 /dev/watchdog0
crw------- 1 root root 253,   1 Apr 26 07:44 /dev/watchdog1

# dmesg | grep -i watchdog
[    2.342104] omap_wdt: OMAP Watchdog Timer Rev 0x01: initial timeout 60 sec
[    6.713125] softdog: Software Watchdog Timer: 0.08 initialized. soft_noboot=0 soft_margin=120 sec soft_panic=0 (nowayout=1)

I'm pretty sure that /dev/watchdog0 is the hardware watchdog and /dev/watchdog1 is the software watchdog, but why is there also a /dev/watchdog ?

Background: The software watchdog is configured with nowayout flag, so, once it has been feeded it won't stop anymore until reboot. However, writing to /dev/watchdog doesn't seem to trigger the software watchdog and doesn't give me the important nowayout feature. I could use /dev/watchdog1 directly, but then I'd need some reliable way to identify the correct software watchdog device filename...

Udo G
  • 1,123
  • 3
  • 12
  • 27
  • Good question. I am using the hardware watchdog of the ARM A20, and also have got here a watchdog and watchdog0... – Rui F Ribeiro Apr 26 '16 at 09:50
  • Stop the watchdog daemon. what does `sudo wd_identify` says? – Rui F Ribeiro Apr 26 '16 at 09:58
  • I don't have that command on my system. – Udo G Apr 26 '16 at 13:09
  • It is a part of the watchdog package in Debian. – Rui F Ribeiro Apr 27 '16 at 09:10
  • You can get the latest watchdog code from here: https://sourceforge.net/p/watchdog/code/ci/master/tree/ And you can then build that package and have wd_identify to run the command. There is more stuff on this here: http://www.sat.dundee.ac.uk/~psc/watchdog/Linux-Watchdog.html Which might be of some help. So far the watchdog daemon only supports one device to write to, but that is something that could be changed if needed. – Paul Crawford Oct 02 '16 at 09:22

1 Answers1

5

I had the same question. According to the kernel documentation:

  • id: [...] id 0 is special. It has both a /dev/watchdog0 cdev (dynamic major, minor 0) as well as the old /dev/watchdog miscdev. The id is set automatically when calling watchdog_register_device.

In other words, /dev/watchdog and /dev/watchdog0 both point to the same device. Any additional watchdogs will be numbered greater than 0 and will have only a single device node.

larsks
  • 32,449
  • 5
  • 54
  • 70