Watchdog: device or resource busy

I am trying to pass the gatekeeper - /dev/watchdog to Raspbian - from C.

The problem is how I try to access the device, always throwing busy or resolved error rejections (since the process is already running and served by the system ..).

The watchdog API says that ".. the driver will not disable the watchdog unless a specific magic symbol" V "was sent / dev / watchdog timer before closing the file. 'But again I can not write /dev/watchdog .. I tried :

 echo V > /dev/watchdog //bash, /dev/watchdog: Permission denied open("/dev/watchdog", O_WRONLY); //C, Device or resource busy 

Is there a way to free the device so that I can control the beating from C?

+6
source share
2 answers

I had this problem when I was working with Raspberry Pi. My application used a lot of CPU time. After 1 or 2 days of work, this caused a raspberry curl. So I decided to use wtchdog. When I wanted to write a gatekeeper from a C ++ program, I got the same error.

The solution I found:

open a new sudo nano /etc/udev/rules.d/60-watchdog.rules rule file sudo nano /etc/udev/rules.d/60-watchdog.rules

and add this line to the file KERNEL=="watchdog", MODE="0666"

After that, I was able to access the watchdog screen window or C ++ program.

+5
source

Why the error "device or resource busy"

The problem I discovered was that systemd and wd_keepalive seemed to use the watchdog resource for each fuser output:

 >sudo fuser -v /dev/watchdog USER PID ACCESS COMMAND /dev/watchdog: root 15087 F.... wd_keepalive 

and

 >sudo fuser -v /dev/watchdog USER PID ACCESS COMMAND /dev/watchdog: root 1 F.... systemd 

Fix busy error

I removed the watchdog links from /etc/systemd/system.conf to get rid of the busy problem in systemd busy system.

If you feel brave, you can kill -9 your PID wd_keepalive and then direct your character to /dev/watchdog if you want to manually control the gatekeeper. I prefer to just let the demon do its job.

Configuring a watchdog timer running on a Pi operating in Stretch mode 12/17/18

Unlike some other suggestions for SO and network, I did not need to set the watchdog timer as a device on the Pi, for example, in /boot/config.txt . I also did not need to call any services, except through systemctl. I just ran

 sudo apt-get install watchdog sudo update-rc.d watchdog defaults 

Then, to set the watchdog timer, I put these lines in /etc/watchdog.conf

 watchdog-device = /dev/watchdog # Set default Timeout watchdog-timeout = 14 

Launch Watchdog

Then the only thing I needed to do to use watchdog was to call this from my application, which I launch after loading:

 sudo systemctl enable watchdog sudo systemctl start watchdog sudo systemctl -l status watchdog 
0
source

Source: https://habr.com/ru/post/988015/


All Articles