Package: watchdog
Version: 5.12-1
Severity: important
Tags: patch

Dear Maintainer,

wd_keepalive gets killed on shutdown from sendsigs. If the watchdog module runs 
with "nowayout", this leads to a hard reset after some time. This "some time" 
usually is very probably during the fs unmounting, which in turn probably leads 
to file system corruption.

An exemplary case:
Watchdog module:
options bcm2708_wdog heartbeat=15 nowayout=1 
rc6.d:
lrwxrwxrwx 1 root root 18 Nov 24  2013 rc6.d/K01watchdog -> ../init.d/watchdog
lrwxrwxrwx 1 root root 18 Nov  1 23:58 rc6.d/K07sendsigs -> ../init.d/sendsigs
lrwxrwxrwx 1 root root 18 Nov  1 23:58 rc6.d/K11umountfs -> ../init.d/umountfs

On K01, wd_keepalive is started, on K07 it gets killed by killall5 and on K11 
the PC shuts down due to the hardware watchdog.

It seems, the sendsigs init script (from package initscripts) has a mechanism 
to circumvent this, so it is easy to patch by adding a pid file to 
/run/sendsigs.omit.d like:

... on watchod start

        rm -f /run/sendsigs.omit.d/$KEEPALIVE_NAME.pid

... on watchod stop

        ln -s /var/run/$KEEPALIVE_NAME.pid 
/run/sendsigs.omit.d/$KEEPALIVE_NAME.pid

Some own testing showed that this works flawlessly. Since sendsigs is from 
initscripts and watchdog depends on this implicitly, the directory can be 
assumed to exist.

Ralf


-- System Information:
Debian Release: 7.6
Architecture: armhf (armv6l)

Kernel: Linux 3.12.28+ (PREEMPT)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages watchdog depends on:
ii  debconf [debconf-2.0]  1.5.49
ii  libc6                  2.13-38+rpi2+deb7u3
ii  lsb-base               4.1+Debian8+rpi1+deb7u1
ii  makedev                2.3.1-92
ii  udev                   175-7.2

watchdog recommends no packages.

watchdog suggests no packages.

-- Configuration Files:
/etc/init.d/watchdog changed:
PATH=/bin:/usr/bin:/sbin:/usr/sbin
test -x /usr/sbin/watchdog || exit 0
run_watchdog=0
watchdog_options=""
watchdog_module="none"
[ -e /etc/default/watchdog ] && . /etc/default/watchdog
NAME=watchdog
KEEPALIVE_NAME=wd_keepalive
DAEMON=/usr/sbin/watchdog
KEEPALIVE_DAEMON=/usr/sbin/wd_keepalive
STOP_RETRY_SCHEDULE='TERM/10/forever/KILL/1'
. /lib/lsb/init-functions
case "$1" in
  start)
    if [ $run_watchdog = 1 ]
    then
        # do we have to load a module?
        [ ${watchdog_module:-none} != "none" ] && /sbin/modprobe 
$watchdog_module
        # make sure that wd_keepalive is stopped
        log_begin_msg "Stopping watchdog keepalive daemon..."
        start-stop-daemon --stop --quiet --oknodo --retry $STOP_RETRY_SCHEDULE \
            --pidfile /var/run/$KEEPALIVE_NAME.pid
        log_end_msg $?
        rm -f /run/sendsigs.omit.d/$KEEPALIVE_NAME.pid
        # Unconditionally start watchdog daemon because we want to run it even
        # if wd_keepalive wasn't running
        log_begin_msg "Starting watchdog daemon..."
        start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
             --exec $DAEMON -- $watchdog_options
        log_end_msg $?
    fi
    ;;
  stop)
    if [ $run_watchdog = 1 ]
    then
        log_begin_msg "Stopping watchdog daemon..."
        start-stop-daemon --stop --quiet --retry $STOP_RETRY_SCHEDULE \
            --pidfile /var/run/$NAME.pid
        log_end_msg $?
        # make sure that wd_keepalive is started
        log_begin_msg "Starting watchdog keepalive daemon..."
        start-stop-daemon --start --quiet --pidfile 
/var/run/$KEEPALIVE_NAME.pid \
            --exec $KEEPALIVE_DAEMON -- $watchdog_options
        log_end_msg $?
        ln -s /var/run/$KEEPALIVE_NAME.pid 
/run/sendsigs.omit.d/$KEEPALIVE_NAME.pid
    fi
    ;;
  restart)
    $0 force-reload
    ;;
  force-reload)
    if [ $run_watchdog = 0 ]; then exit 0; fi
    log_daemon_msg "Restarting ${NAME}"
    log_progress_msg "Stopping $NAME daemon..."
    start-stop-daemon --stop --pidfile /var/run/$NAME.pid --quiet \
        --retry $STOP_RETRY_SCHEDULE || log_end_msg $?
    log_progress_msg "Starting $NAME daemon..."
    start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
        --exec $DAEMON -- $watchdog_options
    log_end_msg $?
    ;;
  status)
    status_of_proc "$DAEMON" watchdog
    ;;
  *)
    echo "Usage: /etc/init.d/watchdog {start|stop|restart|force-reload|status}"
    exit 1
esac
exit 0

/etc/watchdog.conf changed:
change                  = 1800
max-load-1              = 100
max-load-5              = 25
min-memory              = 1
watchdog-device = /dev/watchdog
interval                = 10
realtime                = yes
priority                = 1


-- debconf information:
  watchdog/module: none
  watchdog/run: true
  watchdog/restart: false


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to