What does it mean when we do echo V > /dev/watchdog
? One article said it can prevent stopping watchdog accidentally. I am not clear about this purpose.

- 104,111
- 38
- 209
- 254

- 754
- 1
- 10
- 24
2 Answers
According to the Kernel documentation this is called the 'Magic Close' feature https://www.kernel.org/doc/Documentation/watchdog/watchdog-api.txt
Magic Close feature:
If a driver supports "Magic Close", the driver will not disable the
watchdog unless a specific magic character 'V' has been sent to
/dev/watchdog just before closing the file. If the userspace daemon
closes the file without sending this special character, the driver
will assume that the daemon (and userspace in general) died, and will
stop pinging the watchdog without disabling it first. This will then
cause a reboot if the watchdog is not re-opened in sufficient time.
-
Thank you so much. I read the attached link. What would happene if we just write V, not closing device file? – nathan Aug 03 '16 at 18:52
This is documented (to some extent) in Documentation/watchdog/watchdog-api.txt
. However I think this document is partly obsolete since the watchdog driver unification. Writing any character to the watchdog device lets the watchdog know that the system is alive.
If no process writes to /dev/watchdog
, then the kernel driver doesn't ping the hardware watchdog, and the system will reboot after the watchdog times out. This is a problem if you want to do some maintenance and you prefer to make sure that the maintenance completes without risking a reboot even if it takes a long time. If you write the character V
, then the hardware watchdog will be disabled when the writer process closes /dev/watchdog
, and reenabled when the /dev/watchdog
is reopened. Then you can do maintenance for as long as you want.

- 104,111
- 38
- 209
- 254
-
So if we write 1 and then close "/dev/watchdog" , the hardware watchdog will not be disabled ? or only when we write V , disable would happen? – nathan Jul 30 '16 at 22:25
-
I just thought as long as we close "/dev/watchdog ", hardware watchdao would be enabled . Is that not right ? – nathan Jul 30 '16 at 23:10
-
@user3529352 That's right, *unless* you write `V` just before closing. – Gilles 'SO- stop being evil' Jul 30 '16 at 23:12
-
I am a little confused . What is real difference between 1. echo V ,then close "dev/watchdog". and just close device file . I am newbie to linux. Thanks so much – nathan Jul 30 '16 at 23:22