snmpd init script uses start-stop-daemon without pidfile argument

Bug #1192319 reported by Nic Bernstein
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
net-snmp (Ubuntu)
New
Medium
Unassigned

Bug Description

The snmpd.init file in Precise, Quantal, Raring and Saucy invokes start-stop-daemon without the --pidfile argument. This causes all instances of snmpd to die when used on an LXC parent host, for example.

From the man page for start-stop-daemon:
       Note: unless --pidfile is specified, start-stop-daemon behaves similar
       to killall(1). start-stop-daemon will scan the process table looking
       for any processes which match the process name, uid, and/or gid (if
       specified). Any matching process will prevent --start from starting the
       daemon. All matching processes will be sent the TERM signal (or the one
       specified via --signal or --retry) if --stop is specified. For daemons
       which have long-lived children which need to live through a --stop, you
       must specify a pidfile.

In an LXC environment, all the container processes appear in the parent host's process table, thus "service snmpd {restart|stop}" will kill all running snmpd instances, even those in child containers.

In Precise, Quantal and Raring (5.4.3~dfsg-...), this is typical of how the process is stopped:
   start-stop-daemon --quiet --stop --oknodo --exec /usr/sbin/snmpd

In saucy (5.7.2~dfsg-4ubuntu1) this is typical of how the process is stopped:
   start-stop-daemon --quiet --stop --oknodo --exec /usr/sbin/snmpd && [ ! -f $SNMP_PID ] || rm $SNMP_PID

In all cases, --pidfile should be used to constrain the action of start-stop-daemon.

Observed empirically in snmpd-5.4.3~dfsg-2.4ubuntu1.1, observed in source packages for 5.4.3~dfsg-2.7ubuntu and 5.7.2~dfsg-4ubuntu1 on launchpad.

Revision history for this message
Robie Basak (racb) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better.

I've just checked the Debian net-snmp source, and it looks like this bug applies equally there. So it would be best fixed in Debian, and then Ubuntu will pick it up on the next merge. In any case, I'd prefer to see an opinion from the Debian maintainer on this.

Would you mind filing a bug with Debian please?

tags: added: bitesize needs-upstream-report
Changed in net-snmp (Ubuntu):
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.