Package: snmpd Version: 5.2.3-4 It seems that the /etc/init.d/snmpd script (in etch) fails to restart snmpd if it fails to stop snmpd or snmptrapd. It fails to take into account that snmptrapd might be disabled (TRAPDRUN=0).
Here, start-stop-daemon successfully stops snmpd but then dies when trying to stop snmptrapd: # bash -x /etc/init.d/snmpd restart + set -e + test -x /usr/sbin/snmpd + test -x /usr/sbin/snmptrapd + export MIBDIRS=/usr/share/snmp/mibs + MIBDIRS=/usr/share/snmp/mibs + SNMPDRUN=yes + SNMPDOPTS='-Lsd -Lf /dev/null -p /var/run/snmpd.pid' + TRAPDRUN=no + TRAPDOPTS='-Lsd -p /var/run/snmptrapd.pid' + '[' -r /etc/default/snmpd ']' + . /etc/default/snmpd ++ export MIBDIRS=/usr/share/snmp/mibs ++ MIBDIRS=/usr/share/snmp/mibs ++ SNMPDRUN=yes ++ SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1' ++ TRAPDRUN=no ++ TRAPDOPTS='-Lsd -p /var/run/snmptrapd.pid' + cd / + case "$1" in + echo -n 'Restarting network management services:' Restarting network management services:+ start-stop-daemon --quiet --stop --exec /usr/sbin/snmpd How to reproduce (with default configuration files): apt-get install snmpd /etc/init.d/snmpd restart Expected behavior: an snmpd process is running. Observed behavior: snmpd failed to restart. System information: # dpkg --status snmpd Package: snmpd Status: install ok installed Priority: optional Section: net Installed-Size: 1056 Maintainer: Net-SNMP Packaging Team <[EMAIL PROTECTED]> Architecture: i386 Source: net-snmp Version: 5.2.3-4 Replaces: snmptraplogd Depends: libc6 (>= 2.3.6-6), libsensors3 (>= 1:2.10.1), libsnmp9 (>= 5.2.3), libwrap0, adduser, debconf Conflicts: snmp (<< 3.6-3), snmptraplogd Conffiles: /etc/default/snmpd a6bc1c3f7a7f23ece2e019cfa6dd6f2c /etc/snmp/snmpd.conf 152d349fcd18ec08f1a31cb4c3e2681b /etc/snmp/snmptrapd.conf a2ee110581a5a9a1e2252400cb176bcc /etc/init.d/snmpd 830572c85a626a06a109b0474f02ec6b Description: NET SNMP (Simple Network Management Protocol) Agents The Simple Network Management Protocol (SNMP) provides a framework for the exchange of management information between agents (servers) and clients. The NET SNMP agent is a daemon which listens for incoming SNMP requests from clients and provides responses. # uname -a Linux zaxxon 2.6.17-2-686 #1 SMP Wed Sep 13 16:34:10 UTC 2006 i686 GNU/Linux A suggested fix: *** /etc/init.d/snmpd~ 2006-11-23 20:19:03.000000000 +0200 --- /etc/init.d/snmpd 2006-12-11 12:31:24.000000000 +0200 *************** *** 54,61 **** ;; restart) echo -n "Restarting network management services:" ! start-stop-daemon --quiet --stop --exec /usr/sbin/snmpd ! start-stop-daemon --quiet --stop --exec /usr/sbin/snmptrapd # Allow the daemons time to exit completely. sleep 2 if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then --- 54,61 ---- ;; restart) echo -n "Restarting network management services:" ! 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 if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then -- Tuomas