snmpd init script uses start-stop-daemon without pidfile argument
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-
In saucy (5.7.2~
start-
In all cases, --pidfile should be used to constrain the action of start-stop-daemon.
Observed empirically in snmpd-5.
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?