Debian Bug report logs - #815142
snmpd: dose not start snmpd when LXC containers (running snmpd process inside it) exists

version graph

Package: snmpd; Maintainer for snmpd is Net-SNMP Packaging Team <pkg-net-snmp-devel@lists.alioth.debian.org>; Source for snmpd is src:net-snmp (PTS, buildd, popcon).

Reported by: Genta IHA <genta@ate-mahoroba.jp>

Date: Fri, 19 Feb 2016 10:21:02 UTC

Severity: normal

Tags: patch

Found in version net-snmp/5.7.2.1+dfsg-1

Reply or subscribe to this bug.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, genta@ate-mahoroba.jp, Net-SNMP Packaging Team <pkg-net-snmp-devel@lists.alioth.debian.org>:
Bug#815142; Package snmpd. (Fri, 19 Feb 2016 10:21:05 GMT) (full text, mbox, link).


Acknowledgement sent to Genta IHA <genta@ate-mahoroba.jp>:
New Bug report received and forwarded. Copy sent to genta@ate-mahoroba.jp, Net-SNMP Packaging Team <pkg-net-snmp-devel@lists.alioth.debian.org>. (Fri, 19 Feb 2016 10:21:06 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Genta IHA <genta@ate-mahoroba.jp>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: snmpd: dose not start snmpd when LXC containers (running snmpd process inside it) exists
Date: Fri, 19 Feb 2016 19:19:03 +0900
Package: snmpd
Version: 5.7.2.1+dfsg-1
Severity: normal
Tags: patch

Dear Maintainer,

We are managing a Debian box running some LXC containers.
These LXC containers have a running snmpd process.

These snmp process in LXC containers are visible from the host.
Example:

---- cut here ----
    lxc-host:~$ sudo lxc-ls --running
    debian8

    ('init' of the container "debian8" is running PID 27570)
    lxc-host:~$ sudo ps xa|grep ini[t]
        1 ?        Ss     0:04 /sbin/init
    27570 ?        Ss     0:03 init [3]

    (one snmpd process running in the LXC container (PPID: 27570))
    lxc-host:~$ sudo ps xaj|grep snmp[d]
    27570 28867 28865 28865 ?           -1 S      103   4:57 /usr/sbin/snmpd -Lsd -Lf /dev/null -u snmp -g snmp -I -smux mteTrigger mteTriggerConf -p /run/snmpd.pid
---- cut here ----

In such a situation, I've tried "service snmpd start" on the host,
but it doesen't work. Because the "start-stop-daemon" in the file
/etc/init.d/snmpd don't have "--pid-file" option, then it beleve that
snmpd already running. But the snmp process is LXC containers' one,
not for the host.

I attached a patch to fix this problem.

-- System Information:
Debian Release: 8.3
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16.0-4-amd64 (SMP w/1 CPU core)
Locale: LANG=ja_JP.UTF-8, LC_CTYPE=ja_JP.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages snmpd depends on:
ii  adduser                3.113+nmu3
ii  debconf [debconf-2.0]  1.5.56
ii  libc6                  2.19-18+deb8u3
ii  libsnmp-base           5.7.2.1+dfsg-1
ii  libsnmp30              5.7.2.1+dfsg-1
ii  lsb-base               4.1+Debian13+nmu1

snmpd recommends no packages.

Versions of packages snmpd suggests:
pn  snmptrapd  <none>

-- debconf information excluded

--- snmpd.orig	2015-04-15 06:36:32.000000000 +0900
+++ snmpd	2016-02-19 16:06:35.746248954 +0900
@@ -45,21 +45,21 @@
 	    mkdir -p /var/run/agentx
     fi
     if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
-	start-stop-daemon --quiet --start --oknodo --exec /usr/sbin/snmpd \
+	start-stop-daemon --quiet --start --pidfile $SNMP_PID --oknodo --exec /usr/sbin/snmpd \
 	    -- $SNMPDOPTS
 	log_progress_msg " snmpd"
     fi
     ;;
   stop)
     log_daemon_msg "Stopping SNMP services:"
-    start-stop-daemon --quiet --stop --oknodo --retry 3 --exec /usr/sbin/snmpd && [ ! -f $SNMP_PID ] || rm $SNMP_PID
+    start-stop-daemon --quiet --stop --pidfile $SNMP_PID --oknodo --retry 3 --exec /usr/sbin/snmpd && [ ! -f $SNMP_PID ] || rm $SNMP_PID
     log_progress_msg " snmpd"
     ;;
   restart)
     log_daemon_msg "Restarting SNMP services:"
-    start-stop-daemon --quiet --stop --oknodo --retry 3 --exec /usr/sbin/snmpd  && [ ! -f $SNMP_PID ] || rm $SNMP_PID
+    start-stop-daemon --quiet --stop --pidfile $SNMP_PID --oknodo --retry 3 --exec /usr/sbin/snmpd  && [ ! -f $SNMP_PID ] || rm $SNMP_PID
     if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
-	start-stop-daemon --quiet --start --exec /usr/sbin/snmpd -- $SNMPDOPTS
+	start-stop-daemon --quiet --start --pidfile $SNMP_PID --exec /usr/sbin/snmpd -- $SNMPDOPTS
 	log_progress_msg " snmpd"
     fi
     ;;



Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Wed Jan 10 10:45:24 2018; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.