1

I am trying to use the software watchdog kernel module called softdog. I am not sure how to use it properly.

I have removed the module from ...

/etc/modprobe.d/blacklist-watchdog.conf

Then I have run...

modprobe softdog

This resulted in the following line in dmesg...

│[60656.721980] softdog: initialized. soft_noboot=0 soft_margin=60 sec soft_panic=0 (nowayout=0)

So it seems like softdog was initialized correctly.

Once softdog initializes the files /dev/watchdog and /dev/watchdog0 are created.

But I have not started a watchdog daemon, so I assume no one is feeding these files (no clue why there is two).

I am expecting that because I do not have a watchdog daemon installed, that softdog will reboot the system....but this is not what I am seeing. (fyi I plan on installing a watchdog daemon once I can confirm that softdog module is capable of restarting the system).

Has anyone ever successfully configured the softdog module to work as a software watchdog?

Scorb
  • 602
  • 5
  • 27
  • 50
  • Yes. I tested it in ubuntu 20.04 . If it doesn't write to the /dev/watchdog at least every minute , the softdog driver will reboot the system. You can see the tests that the watchdog daemon does to ensure the system is healthy [here](https://linux.die.net/man/8/watchdog) . I installed the daemon via "sudo apt install watchdog " and enabled it via "sudo service watchdog start". – Parsa Mousavi Jun 02 '20 at 16:14
  • That is the watchdog daemon. I am curious how you were able to get the softdog module to work. Does the watchdog daemon start the softdog module for you? How do you know the watchdog is actually working? – Scorb Jun 02 '20 at 17:05
  • No , you have to modprobe the softdog as you stated in the post.It's a builtin kernel module . And if you want to know whether the watchdog daemon is working or not you can check its status via "service watchdog status" . I just tried it again with a simple config in lubuntu 18 in virtualbox and I added the test " ping 8.8.8.8" and disabled the guest network to see the effect. It got rebooted after almost one minute. You can find more configuration options in the manpage. – Parsa Mousavi Jun 02 '20 at 17:21
  • I am still confused. I have loaded softdog, and watchdog daemon is not running. Does that not mean that softdog should reboot the system. It is softdogs job to reboot the system, it is watchdog daemons job to feed softdog so it doesnt reboot. Why is why system now rebooting? – Scorb Jun 02 '20 at 17:28
  • "The watchdog daemon can be stopped without causing a reboot if the device /dev/watchdog is closed correctly" This is stated in the manpage. I think the device is somehow closed if the daemon hadn't opened it before. I tried manually write into the watchdog file white the daemon is inactive. Guess what ? It got restarted ! So it seems that if nothing tampers it , it wouldn't try to reboot your system. – Parsa Mousavi Jun 02 '20 at 18:21
  • I was inspecting the [source code of softdog](https://elixir.bootlin.com/linux/latest/source/drivers/watchdog/softdog.c) to figure that out. There's [softdog_ping](https://elixir.bootlin.com/linux/latest/source/drivers/watchdog/softdog.c#L81) function which starts the timer and [softdog_fire](https://elixir.bootlin.com/linux/latest/source/drivers/watchdog/softdog.c#L55) which causes the system to go into an emergency restart. But nothing is there to check whether the device is opened or not . I think this behavior is default within the watchdog framework in the linux kernel . – Parsa Mousavi Jun 02 '20 at 18:24
  • And yes there are lots of watchdog drivers in the kernel , not just the softdog. I'm not sure but I think it's kind of related to pseudo-device management rather than watchdog management. – Parsa Mousavi Jun 02 '20 at 18:27
  • I did with default moves `modprobe softdog` and `systemctl start watchdog`. That's it, nothing else. Ubuntu 20.04.2 LTS – astrowalker Apr 23 '21 at 13:41

0 Answers0