More
referral
Increase your income with Hive. Invite your friends and earn real cryptocurrency!

Guide - USB Hardware Watchdog

I have seen many people asking about getting USB hardware watchdogs working. This guide is intended to get you started.

I will be using the following watchdog in this tutorial, but I will do my best to make it agnostic.

http://a.co/d/fo9lbdx

  1. Power down your mining rig.
  2. Connect the USB hardware watchdog to both the USB port and the power terminals.
  3. Boot the mining rig.
  4. Once system boots, either SSH or KVM into Rig.
  5. Issue the following command to see if the watchdog was recognized.
    journalctl -u hive | grep -Pzo ".*\>.*watchdogs(.|\n)*(?=\n.*\>.*Applying)"
    Expected Output:

Aug 26 13:52:48 B01-R02-MNR-07 hive[963]: > Detecting watchdogs
Aug 26 13:52:49 B01-R02-MNR-07 hive[963]: Watchdogs InUa found: 0
Aug 26 13:52:49 B01-R02-MNR-07 hive[963]: OpenDev Watchdogs found: 0
Aug 26 13:52:49 B01-R02-MNR-07 hive[963]: Esonics Watchdogs found: 0
Aug 26 13:52:49 B01-R02-MNR-07 hive[963]: QinHeng Electronics HL-340 Watchdogs found: 1
Aug 26 13:52:49 B01-R02-MNR-07 hive[963]: Found on port /dev/china_dog0
Aug 26 13:52:49 B01-R02-MNR-07 hive[963]: Not found config /hive-config/watchdog_srrv2.txt

  1. Find out which type of watchdog you have. In the above example, there is a QinHeng watchdog installed.
  2. Change to the watchdog directory.
    cd /hive/opt/
    Pick the appropriate watchdog.
    e1000e/ esonics/ k10temp/ ohgodapill/ opendev/ qinheng/ srrv2/ watchdoginua/
    Example:
    cd /hive/opt/qinheng/
  3. Find out what the name of the executable is for your watchdog.
    ls
    Example:
    hl340 hl340.sh
  4. Check to make sure the process is running.
    ps -ef | grep hl340
    Example:
    root 1701 1 0 Aug26 ? 00:00:23 bash /hive/opt/qinheng/hl340 ping /dev/china_dog0
  5. Test the watchdog (the port that you are pinging will be in the output of the process above)
    ./hl340 ping /dev/china_dog0
    You should see your watchdog light blink when it receives a ping.
  6. Check to make sure the watchdog is running correctly. (the process ID should be the one from the above output)
    strace -p 1701 -e write

If there is an issue with the watchdog, you may have to try the following steps.

  1. Identify what port the USB watchdog is using.
    lsusb

The watchdog should be listed here.
Example:

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 0781:5583 SanDisk Corp.
Bus 001 Device 004: ID 5131:2407
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

  1. Determine which type of watchdog you have and change to the appropriate directory.
    cd /hive/opt/qinheng/
  2. Modify the shell script to include the Bus ID of the USB watchdog.
    nano hl340.sh
    Example:
    find
    '1a86:7523|5131:2007|0471:2379'
    add your BUS ID
    '1a86:7523|5131:2007|0471:2379|5131:2407'
  3. Restart computer and test again.

Hi! This my log, looks good, but when my rig stuck on time reboot nothing happens more 5 minutes. Maybe watchDog must work differently when ubuntu stuck? I want to fix hardware stuck. If you can - explain to me, please.

root@GreenRig:/hive/opt/qinheng# ps -ef | grep hl340
root 1443 1 0 23:07 ? 00:00:00 bash /hive/opt/qinheng/hl340 pin
g /dev/china_dog0
root 12258 7224 0 23:37 pts/9 00:00:00 grep --color=auto hl340
root@GreenRig:/hive/opt/qinheng# ./hl340 ping /dev/china_dog0
Using /dev/china_dog0
Pinging watchdog
(blinking)

root@GreenRig:/hive/opt/qinheng# strace -p 1443 -e write
strace: Process 1443 attached
— SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=18888, si_uid=0, si_st
atus=0, si_utime=0, si_stime=0} —
write(1, “Pinging watchdog\n”, 17) = 17
write(1, “x1Ex00”, 6) = 6

root@GreenRig:/hive/opt/qinheng# lsusb
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 2717:4106
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 002: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 009 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 008 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

same here. when the rig hangs and cannot reboot (software), the hw watchdog (340) doesn’t reset the rig as expected.

Hello.

I’m having a issue. When I try to use any command, such as “ping”, “restart” or “power”, it says:

“stty: /dev/china_dog0: invalid argument”

And then starts pinging the hardware that blinks. But “restart” and “power” commands don’t work.

At “hl340.sh” I already removed all the others bus ID leaving only the hardware watchdog ID and got the same results.

Does anyone knows how to fix it?

Not sure if the scripts have changed, but when I opened the /hive/opt/qinheng/hl340 (I am using the Chinese Watchdog), the command to restart the rig is written “reset”. Try

/hive/opt/qinheng/hl340 reset

The code for power is commented out in that same file. Uncommenting those line should enable the power command.

1 Like