[Pkg-net-snmp-devel] Bug#790303: snmpd: "snmpd" fails to "restart" during "logrotate" if it is too busy

Paavo Hartikainen pahartik at sci.fi
Sat Jun 27 22:06:58 UTC 2015

Package: snmpd
Version: 5.4.3~dfsg-2.8+deb7u1
Severity: normal
Tags: patch

If "snmpd" is too busy to finish for "restart" within 2 seconds defined 
in "/etc/init.d/snmpd", it is accidentally left not running after 
"logrotate".  My solution was to check whether it has finished and add 
conditional delay.

This is how I solved it for production server:

diff --git a/init.d/snmpd b/init.d/snmpd
index 92e54bb..5b5a9bf 100755
--- a/init.d/snmpd
+++ b/init.d/snmpd
@@ -66,7 +66,9 @@ case "$1" in
     start-stop-daemon --quiet --stop --oknodo --exec /usr/sbin/snmpd
     start-stop-daemon --quiet --stop --oknodo --exec /usr/sbin/snmptrapd
     # Allow the daemons time to exit completely.
-    sleep 2
+    sleep 2 \
+      && pgrep --uid snmp --group root snmpd && sleep 4 \
+      && pgrep --uid snmp --group root snmpd && sleep 8
     if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
        start-stop-daemon --quiet --start --exec /usr/sbin/snmpd -- $SNMPDOPTS
        echo -n " snmpd"

-- System Information:
Debian Release: 7.8
  APT prefers oldstable-updates
  APT policy: (500, 'oldstable-updates'), (500, 'oldstable')
Architecture: mipsel (mips64)

Kernel: Linux 3.16.0-0.bpo.4-loongson-2f
Locale: LANG=POSIX, LC_CTYPE=POSIX (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash

Versions of packages snmpd depends on:
ii  adduser                3.113+nmu3
ii  debconf [debconf-2.0]  1.5.49
ii  libc6                  2.13-38+deb7u8
ii  libsnmp15              5.4.3~dfsg-2.8+deb7u1
ii  libwrap0               7.6.q-24
ii  lsb-base               4.1+Debian8+deb7u1

snmpd recommends no packages.

snmpd suggests no packages.

-- Configuration Files:
/etc/snmp/snmpd.conf [Errno 13] Permission denied: u'/etc/snmp/snmpd.conf'
/etc/snmp/snmptrapd.conf [Errno 13] Permission denied: u'/etc/snmp/snmptrapd.conf'

-- debconf information:

More information about the Pkg-net-snmp-devel mailing list