Table of Contents

Watchdog on Linux/Ubuntu

Background

Watchdog timers are commonly found in embedded systems and other computer-controlled equipment where humans cannot easily access the equipment or would be unable to react to faults in a timely manner. In such systems, the computer cannot depend on a human to reboot it if it hangs; it must be self-reliant.

Odroid C1/C1+ support watchdog driver aml_wdt to control the PMU.

Test Watchdog module

Watchdog driver aml_wdt is configurable for Odroid C1/C1+.

You should be able to see /dev/watchdog and /dev/watchdog0 device files being created.

odroid@odroid:~$ ls -la /dev/watchdog*
crw------- 1 root root  10, 130 Oct 30 17:28 /dev/watchdog
crw------- 1 root root 250,   0 Oct 30 17:28 /dev/watchdog0
odroid@odroid:~$

Watchdog daemon will trigger and reboot if we access the device file manually.

# cat /dev/watchdog
[ 7639.726211] watchdog watchdog0: watchdog did not stop!

To manually stop watchdog to reboot.

# echo V > /dev/watchdog

Install Watchdog daemon

To install watchdog daemon

sudo apt-get install watchdog

Create dir for watchdog logs files

sudo mkdir -p /var/log/watchdog

Watchdog demon configuration files

You need to edit the /etc/watchdog.conf file to un-comment and so actually use the /dev/watchdog device access to the module. Otherwise the watchdog will not use the hardware and rely only on its internal code to soft-reboot a broken machine.

$ cat /etc/watchdog.conf
#ping                   = 172.31.14.1
#ping                   = 172.26.1.255
#interface              = eth0
#file                   = /var/log/messages
#change                 = 1407

# Uncomment to enable test. Setting one of these values to '0' disables it.
# These values will hopefully never reboot your machine during normal use
# (if your machine is really hung, the loadavg will go much higher than 25)
#max-load-1             = 24
#max-load-5             = 18
#max-load-15            = 12

# Note that this is the number of pages!
# To get the real size, check how large the pagesize is on your machine.
#min-memory             = 1

#repair-binary          = /usr/sbin/repair
#repair-timeout         =
#test-binary            =
#test-timeout           =

watchdog-device = /dev/watchdog

# Defaults compiled into the binary
#temperature-device     =
#max-temperature        = 120

# Defaults compiled into the binary
admin                   = root
interval                = 1
logtick                = 1
log-dir         = /var/log/watchdog

# This greatly decreases the chance that watchdog won't be scheduled before
# your machine is really loaded
realtime                = yes
priority                = 1

# Check if rsyslogd is still running by enabling the following line
pidfile         = /var/run/rsyslogd.pid

# set watchdog timer
watchdog-timeout        = 15

For more configuration please follow link below. http://www.sat.dundee.ac.uk/psc/watchdog/watchdog-configure.html

Start Watchdog Service and Verify

root@odroid:~# service watchdog status
 * watchdog is running
root@odroid:~#

Once the watchdog demon is configures then it tries to continuously try to reset the watchdog timer.

Another way to test watchdog device is working under watchdog demon.

root@odroid:~#
root@odroid:~# pkill -9 watchdog
root@odroid:~# [ 2452.972630@0] watchdog watchdog0: watchdog did not stop!
    QA5:A;SVN:B72;POC:17F;STS:0;BOOT:0;INIT:10;BOOT:1;INIT:0;READ:0;CHECK:0;PASS:1;

    ----------------------------------------------------------------------
    Welcome to Hardkernel's ODROID-C... (Built at 19:33:00 Dec 8 2014) *
    ----------------------------------------------------------------------
    CPU : AMLogic S805
    MEM : 1024MB (DDR3@792MHz)
    BID : HKC1310001
    S/N : HKC11122F37DF492
    0x0000009f
    check SD_boot_type:0x1 card_type:0x1
    Loading U-boot...success.