[Sts-sponsors] [Bug 1835818] Re: snmpd causes autofs mount points to be mounted on service start/restart

2019-08-21 Thread Dan Streetman
sponsored for e,d,b,x

-- 
You received this bug notification because you are a member of STS
Sponsors, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/1835818

Title:
  snmpd causes autofs mount points to be mounted on service
  start/restart

Status in net-snmp package in Ubuntu:
  In Progress
Status in net-snmp source package in Xenial:
  In Progress
Status in net-snmp source package in Bionic:
  In Progress
Status in net-snmp source package in Cosmic:
  Won't Fix
Status in net-snmp source package in Disco:
  In Progress
Status in net-snmp source package in Eoan:
  In Progress
Status in net-snmp package in Debian:
  Unknown

Bug description:
  [Impact]

  Autofs direct map triggers are visible in /etc/mtab.
  On boot, when snmpd starts, it iterates over the entries in /etc/mtab and 
performs statfs() on them.
  This trigger automount to mount autofs mounts even if the user does not 
explicitly access them.

  However this happens only if autofs service is started before snmpd.
  If snmpd stars first /etc/mtab is not yet populated with autofs mounts and 
therefore
  are not mounted.

  When there a few autofs mount points the impact is insignificant.
  However when there are thousands of them, this causes unnecessary overhead on 
operations
  such as df.
  This also delays the system shutdown time since everything needs to be 
unmounted.

  [Test Case]

  *** Test Case 1 - During boot:

  The user that brought this issue to our attention would observe all autofs 
mounts
  be mounted at boot, because in their environment autofs would start first.

  In my environment snmpd starts first so to reproduce I had to add a small 
delay in
  snmpd init script.

  In /etc/init.d/snmp :
  @@ -36,6 +36,8 @@ cd /

   case "$1" in
     start)
  +# Delay snmp start
  +sleep 2
   log_daemon_msg "Starting SNMP services:"
   # remove old symlink with previous version
   if [ -L /var/run/agentx ]; then

  $cat /etc/auto.master
  /- /etc/auto.nfs --timeout=30

  $cat /etc/auto.nfs
  /home/test1 -fstype=nfs,hard,intr,nosuid,no-subtree-check,tcp :/srv/export/test1
  /home/test2 -fstype=nfs,hard,intr,nosuid,no-subtree-check,tcp :/srv/export/test2

  Reboot vm, syslog entries :

  # Autofs starts
  Jul 11 11:04:16 xenial-vm3 autofs[1295]:  * Starting automount...
  Jul 11 11:04:16 xenial-vm3 automount[1357]: Starting automounter version 
5.1.1, master map /etc/auto.master
  Jul 11 11:04:16 xenial-vm3 automount[1357]: using kernel protocol version 5.02
  # Mount triggers, now visible in mtab
  Jul 11 11:04:16 xenial-vm3 automount[1357]: mounted direct on /home/test1 
with timeout 300, freq 75 seconds
  Jul 11 11:04:16 xenial-vm3 automount[1357]: mounted direct on /home/test2 
with timeout 300, freq 75 seconds
  Jul 11 11:04:16 xenial-vm3 autofs[1295]:...done.
  ...
  # SNMP starts
  Jul 11 11:04:18 xenial-vm3 snmpd[1294]:  * Starting SNMP services:
  Jul 11 11:04:18 xenial-vm3 systemd[1]: proc-sys-fs-binfmt_misc.automount: Got 
automount request for /proc/sys/fs/binfmt_misc, triggered by 1394 (snmpd)
  Jul 11 11:04:18 xenial-vm3 systemd[1]: Mounting Arbitrary Executable File 
Formats File System...
  Jul 11 11:04:18 xenial-vm3 systemd[1]: Mounted Arbitrary Executable File 
Formats File System.
  Jul 11 11:04:18 xenial-vm3 automount[1357]: attempting to mount entry 
/home/test1 <==
  Jul 11 11:04:18 xenial-vm3 kernel: [8.880685] FS-Cache: Loaded
  Jul 11 11:04:18 xenial-vm3 kernel: [8.889318] FS-Cache: Netfs 'nfs' 
registered for caching
  Jul 11 11:04:18 xenial-vm3 kernel: [8.902672] NFS: Registering the 
id_resolver key type
  Jul 11 11:04:18 xenial-vm3 kernel: [8.902680] Key type id_resolver 
registered
  Jul 11 11:04:18 xenial-vm3 kernel: [8.902682] Key type id_legacy 
registered
  Jul 11 11:04:18 xenial-vm3 automount[1357]: mounted /home/test1  <==
  Jul 11 11:04:18 xenial-vm3 automount[1357]: attempting to mount entry 
/home/test2  <==
  Jul 11 11:04:18 xenial-vm3 kernel: [9.163011] random: nonblocking pool is 
initialized
  Jul 11 11:04:18 xenial-vm3 automount[1357]: mounted /home/test2  <===

  *** Test Case 2 - Restart snmpd :

  To reproduce this case, autofs mounts should not be mounted to begin with.
  (restart autofs or let it expire)

  #systemctl restart snmpd.service

  Syslog entries :

  Jul 11 11:15:40 xenial-vm3 systemd[1]: Stopping LSB: SNMP agents...
  Jul 11 11:15:40 xenial-vm3 snmpd[1668]:  * Stopping SNMP services:
  Jul 11 11:15:40 xenial-vm3 snmpd[1434]: Received TERM or STOP signal...  
shutting down...
  Jul 11 11:15:40 xenial-vm3 systemd[1]: Stopped LSB: SNMP agents.
  Jul 11 11:15:40 xenial-vm3 systemd[1]: Starting LSB: SNMP agents...
  Jul 11 11:15:42 xenial-vm3 snmpd[1677]:  * Starting SNMP services:
  Jul 11 11:15:42 xenial-vm3 automount[1357]: attempting to mount entry 
/home/test1 <===
  Jul 11 11:15:42 xenial-vm3 automount[1357]: mounted /home/test1 <===
  Jul 11 11:15:42 

[Sts-sponsors] [Bug 1835818] Re: snmpd causes autofs mount points to be mounted on service start/restart

2019-08-21 Thread Dan Streetman
** Tags added: sts-sponsor sts-sponsor-ddstreet

-- 
You received this bug notification because you are a member of STS
Sponsors, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/1835818

Title:
  snmpd causes autofs mount points to be mounted on service
  start/restart

Status in net-snmp package in Ubuntu:
  In Progress
Status in net-snmp source package in Xenial:
  In Progress
Status in net-snmp source package in Bionic:
  In Progress
Status in net-snmp source package in Cosmic:
  Won't Fix
Status in net-snmp source package in Disco:
  In Progress
Status in net-snmp source package in Eoan:
  In Progress
Status in net-snmp package in Debian:
  Unknown

Bug description:
  [Impact]

  Autofs direct map triggers are visible in /etc/mtab.
  On boot, when snmpd starts, it iterates over the entries in /etc/mtab and 
performs statfs() on them.
  This trigger automount to mount autofs mounts even if the user does not 
explicitly access them.

  However this happens only if autofs service is started before snmpd.
  If snmpd stars first /etc/mtab is not yet populated with autofs mounts and 
therefore
  are not mounted.

  When there a few autofs mount points the impact is insignificant.
  However when there are thousands of them, this causes unnecessary overhead on 
operations
  such as df.
  This also delays the system shutdown time since everything needs to be 
unmounted.

  [Test Case]

  *** Test Case 1 - During boot:

  The user that brought this issue to our attention would observe all autofs 
mounts
  be mounted at boot, because in their environment autofs would start first.

  In my environment snmpd starts first so to reproduce I had to add a small 
delay in
  snmpd init script.

  In /etc/init.d/snmp :
  @@ -36,6 +36,8 @@ cd /

   case "$1" in
     start)
  +# Delay snmp start
  +sleep 2
   log_daemon_msg "Starting SNMP services:"
   # remove old symlink with previous version
   if [ -L /var/run/agentx ]; then

  $cat /etc/auto.master
  /- /etc/auto.nfs --timeout=30

  $cat /etc/auto.nfs
  /home/test1 -fstype=nfs,hard,intr,nosuid,no-subtree-check,tcp :/srv/export/test1
  /home/test2 -fstype=nfs,hard,intr,nosuid,no-subtree-check,tcp :/srv/export/test2

  Reboot vm, syslog entries :

  # Autofs starts
  Jul 11 11:04:16 xenial-vm3 autofs[1295]:  * Starting automount...
  Jul 11 11:04:16 xenial-vm3 automount[1357]: Starting automounter version 
5.1.1, master map /etc/auto.master
  Jul 11 11:04:16 xenial-vm3 automount[1357]: using kernel protocol version 5.02
  # Mount triggers, now visible in mtab
  Jul 11 11:04:16 xenial-vm3 automount[1357]: mounted direct on /home/test1 
with timeout 300, freq 75 seconds
  Jul 11 11:04:16 xenial-vm3 automount[1357]: mounted direct on /home/test2 
with timeout 300, freq 75 seconds
  Jul 11 11:04:16 xenial-vm3 autofs[1295]:...done.
  ...
  # SNMP starts
  Jul 11 11:04:18 xenial-vm3 snmpd[1294]:  * Starting SNMP services:
  Jul 11 11:04:18 xenial-vm3 systemd[1]: proc-sys-fs-binfmt_misc.automount: Got 
automount request for /proc/sys/fs/binfmt_misc, triggered by 1394 (snmpd)
  Jul 11 11:04:18 xenial-vm3 systemd[1]: Mounting Arbitrary Executable File 
Formats File System...
  Jul 11 11:04:18 xenial-vm3 systemd[1]: Mounted Arbitrary Executable File 
Formats File System.
  Jul 11 11:04:18 xenial-vm3 automount[1357]: attempting to mount entry 
/home/test1 <==
  Jul 11 11:04:18 xenial-vm3 kernel: [8.880685] FS-Cache: Loaded
  Jul 11 11:04:18 xenial-vm3 kernel: [8.889318] FS-Cache: Netfs 'nfs' 
registered for caching
  Jul 11 11:04:18 xenial-vm3 kernel: [8.902672] NFS: Registering the 
id_resolver key type
  Jul 11 11:04:18 xenial-vm3 kernel: [8.902680] Key type id_resolver 
registered
  Jul 11 11:04:18 xenial-vm3 kernel: [8.902682] Key type id_legacy 
registered
  Jul 11 11:04:18 xenial-vm3 automount[1357]: mounted /home/test1  <==
  Jul 11 11:04:18 xenial-vm3 automount[1357]: attempting to mount entry 
/home/test2  <==
  Jul 11 11:04:18 xenial-vm3 kernel: [9.163011] random: nonblocking pool is 
initialized
  Jul 11 11:04:18 xenial-vm3 automount[1357]: mounted /home/test2  <===

  *** Test Case 2 - Restart snmpd :

  To reproduce this case, autofs mounts should not be mounted to begin with.
  (restart autofs or let it expire)

  #systemctl restart snmpd.service

  Syslog entries :

  Jul 11 11:15:40 xenial-vm3 systemd[1]: Stopping LSB: SNMP agents...
  Jul 11 11:15:40 xenial-vm3 snmpd[1668]:  * Stopping SNMP services:
  Jul 11 11:15:40 xenial-vm3 snmpd[1434]: Received TERM or STOP signal...  
shutting down...
  Jul 11 11:15:40 xenial-vm3 systemd[1]: Stopped LSB: SNMP agents.
  Jul 11 11:15:40 xenial-vm3 systemd[1]: Starting LSB: SNMP agents...
  Jul 11 11:15:42 xenial-vm3 snmpd[1677]:  * Starting SNMP services:
  Jul 11 11:15:42 xenial-vm3 automount[1357]: attempting to mount entry 
/home/test1 <===
  Jul 11 11:15:42 xenial-vm3 automount[1357]: mounted /home/test1 

[Sts-sponsors] [Bug 1835818] Re: snmpd causes autofs mount points to be mounted on service start/restart

2019-08-21 Thread Ioanna Alifieraki
** Bug watch added: Debian Bug tracker #935325
   https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=935325

** Also affects: net-snmp (Debian) via
   https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=935325
   Importance: Unknown
   Status: Unknown

** Description changed:

  [Impact]
  
  Autofs direct map triggers are visible in /etc/mtab.
  On boot, when snmpd starts, it iterates over the entries in /etc/mtab and 
performs statfs() on them.
  This trigger automount to mount autofs mounts even if the user does not 
explicitly access them.
  
  However this happens only if autofs service is started before snmpd.
  If snmpd stars first /etc/mtab is not yet populated with autofs mounts and 
therefore
  are not mounted.
  
  When there a few autofs mount points the impact is insignificant.
  However when there are thousands of them, this causes unnecessary overhead on 
operations
  such as df.
  This also delays the system shutdown time since everything needs to be 
unmounted.
  
  [Test Case]
  
  *** Test Case 1 - During boot:
  
  The user that brought this issue to our attention would observe all autofs 
mounts
  be mounted at boot, because in their environment autofs would start first.
  
  In my environment snmpd starts first so to reproduce I had to add a small 
delay in
  snmpd init script.
  
  In /etc/init.d/snmp :
  @@ -36,6 +36,8 @@ cd /
  
   case "$1" in
     start)
  +# Delay snmp start
  +sleep 2
   log_daemon_msg "Starting SNMP services:"
   # remove old symlink with previous version
   if [ -L /var/run/agentx ]; then
  
  $cat /etc/auto.master
  /- /etc/auto.nfs --timeout=30
  
  $cat /etc/auto.nfs
  /home/test1 -fstype=nfs,hard,intr,nosuid,no-subtree-check,tcp :/srv/export/test1
  /home/test2 -fstype=nfs,hard,intr,nosuid,no-subtree-check,tcp :/srv/export/test2
  
  Reboot vm, syslog entries :
  
  # Autofs starts
  Jul 11 11:04:16 xenial-vm3 autofs[1295]:  * Starting automount...
  Jul 11 11:04:16 xenial-vm3 automount[1357]: Starting automounter version 
5.1.1, master map /etc/auto.master
  Jul 11 11:04:16 xenial-vm3 automount[1357]: using kernel protocol version 5.02
  # Mount triggers, now visible in mtab
  Jul 11 11:04:16 xenial-vm3 automount[1357]: mounted direct on /home/test1 
with timeout 300, freq 75 seconds
  Jul 11 11:04:16 xenial-vm3 automount[1357]: mounted direct on /home/test2 
with timeout 300, freq 75 seconds
  Jul 11 11:04:16 xenial-vm3 autofs[1295]:...done.
  ...
  # SNMP starts
  Jul 11 11:04:18 xenial-vm3 snmpd[1294]:  * Starting SNMP services:
  Jul 11 11:04:18 xenial-vm3 systemd[1]: proc-sys-fs-binfmt_misc.automount: Got 
automount request for /proc/sys/fs/binfmt_misc, triggered by 1394 (snmpd)
  Jul 11 11:04:18 xenial-vm3 systemd[1]: Mounting Arbitrary Executable File 
Formats File System...
  Jul 11 11:04:18 xenial-vm3 systemd[1]: Mounted Arbitrary Executable File 
Formats File System.
  Jul 11 11:04:18 xenial-vm3 automount[1357]: attempting to mount entry 
/home/test1 <==
  Jul 11 11:04:18 xenial-vm3 kernel: [8.880685] FS-Cache: Loaded
  Jul 11 11:04:18 xenial-vm3 kernel: [8.889318] FS-Cache: Netfs 'nfs' 
registered for caching
  Jul 11 11:04:18 xenial-vm3 kernel: [8.902672] NFS: Registering the 
id_resolver key type
  Jul 11 11:04:18 xenial-vm3 kernel: [8.902680] Key type id_resolver 
registered
  Jul 11 11:04:18 xenial-vm3 kernel: [8.902682] Key type id_legacy 
registered
  Jul 11 11:04:18 xenial-vm3 automount[1357]: mounted /home/test1  <==
  Jul 11 11:04:18 xenial-vm3 automount[1357]: attempting to mount entry 
/home/test2  <==
  Jul 11 11:04:18 xenial-vm3 kernel: [9.163011] random: nonblocking pool is 
initialized
  Jul 11 11:04:18 xenial-vm3 automount[1357]: mounted /home/test2  <===
  
  *** Test Case 2 - Restart snmpd :
  
  To reproduce this case, autofs mounts should not be mounted to begin with.
  (restart autofs or let it expire)
  
  #systemctl restart snmpd.service
  
  Syslog entries :
  
  Jul 11 11:15:40 xenial-vm3 systemd[1]: Stopping LSB: SNMP agents...
  Jul 11 11:15:40 xenial-vm3 snmpd[1668]:  * Stopping SNMP services:
  Jul 11 11:15:40 xenial-vm3 snmpd[1434]: Received TERM or STOP signal...  
shutting down...
  Jul 11 11:15:40 xenial-vm3 systemd[1]: Stopped LSB: SNMP agents.
  Jul 11 11:15:40 xenial-vm3 systemd[1]: Starting LSB: SNMP agents...
  Jul 11 11:15:42 xenial-vm3 snmpd[1677]:  * Starting SNMP services:
  Jul 11 11:15:42 xenial-vm3 automount[1357]: attempting to mount entry 
/home/test1 <===
  Jul 11 11:15:42 xenial-vm3 automount[1357]: mounted /home/test1 <===
  Jul 11 11:15:42 xenial-vm3 automount[1357]: attempting to mount entry 
/home/test2 <===
  Jul 11 11:15:42 xenial-vm3 automount[1357]: mounted /home/test2 <===
  Jul 11 11:15:42 xenial-vm3 snmpd[1684]: /etc/snmp/snmpd.conf: line 145: 
Warning: Unknown token: defaultMonitors.
  Jul 11 11:15:42 xenial-vm3 snmpd[1684]: /etc/snmp/snmpd.conf: line 147: 
Warning: 

[Sts-sponsors] [Bug 1835818] Re: snmpd causes autofs mount points to be mounted on service start/restart

2019-08-21 Thread Ioanna Alifieraki
** Description changed:

  [Impact]
  
  Autofs direct map triggers are visible in /etc/mtab.
  On boot, when snmpd starts, it iterates over the entries in /etc/mtab and 
performs statfs() on them.
  This trigger automount to mount autofs mounts even if the user does not 
explicitly access them.
  
  However this happens only if autofs service is started before snmpd.
  If snmpd stars first /etc/mtab is not yet populated with autofs mounts and 
therefore
  are not mounted.
  
  When there a few autofs mount points the impact is insignificant.
  However when there are thousands of them, this causes unnecessary overhead on 
operations
  such as df.
  This also delays the system shutdown time since everything needs to be 
unmounted.
  
  [Test Case]
  
  *** Test Case 1 - During boot:
  
  The user that brought this issue to our attention would observe all autofs 
mounts
  be mounted at boot, because in their environment autofs would start first.
  
  In my environment snmpd starts first so to reproduce I had to add a small 
delay in
  snmpd init script.
  
  In /etc/init.d/snmp :
  @@ -36,6 +36,8 @@ cd /
-  
-  case "$1" in
-start)
+ 
+  case "$1" in
+    start)
  +# Delay snmp start
  +sleep 2
-  log_daemon_msg "Starting SNMP services:"
-  # remove old symlink with previous version
-  if [ -L /var/run/agentx ]; then
- 
+  log_daemon_msg "Starting SNMP services:"
+  # remove old symlink with previous version
+  if [ -L /var/run/agentx ]; then
  
  $cat /etc/auto.master
  /- /etc/auto.nfs --timeout=30
  
  $cat /etc/auto.nfs
  /home/test1 -fstype=nfs,hard,intr,nosuid,no-subtree-check,tcp :/srv/export/test1
  /home/test2 -fstype=nfs,hard,intr,nosuid,no-subtree-check,tcp :/srv/export/test2
  
  Reboot vm, syslog entries :
  
  # Autofs starts
  Jul 11 11:04:16 xenial-vm3 autofs[1295]:  * Starting automount...
  Jul 11 11:04:16 xenial-vm3 automount[1357]: Starting automounter version 
5.1.1, master map /etc/auto.master
  Jul 11 11:04:16 xenial-vm3 automount[1357]: using kernel protocol version 5.02
  # Mount triggers, now visible in mtab
  Jul 11 11:04:16 xenial-vm3 automount[1357]: mounted direct on /home/test1 
with timeout 300, freq 75 seconds
  Jul 11 11:04:16 xenial-vm3 automount[1357]: mounted direct on /home/test2 
with timeout 300, freq 75 seconds
  Jul 11 11:04:16 xenial-vm3 autofs[1295]:...done.
  ...
  # SNMP starts
  Jul 11 11:04:18 xenial-vm3 snmpd[1294]:  * Starting SNMP services:
  Jul 11 11:04:18 xenial-vm3 systemd[1]: proc-sys-fs-binfmt_misc.automount: Got 
automount request for /proc/sys/fs/binfmt_misc, triggered by 1394 (snmpd)
  Jul 11 11:04:18 xenial-vm3 systemd[1]: Mounting Arbitrary Executable File 
Formats File System...
  Jul 11 11:04:18 xenial-vm3 systemd[1]: Mounted Arbitrary Executable File 
Formats File System.
  Jul 11 11:04:18 xenial-vm3 automount[1357]: attempting to mount entry 
/home/test1 <==
  Jul 11 11:04:18 xenial-vm3 kernel: [8.880685] FS-Cache: Loaded
  Jul 11 11:04:18 xenial-vm3 kernel: [8.889318] FS-Cache: Netfs 'nfs' 
registered for caching
  Jul 11 11:04:18 xenial-vm3 kernel: [8.902672] NFS: Registering the 
id_resolver key type
  Jul 11 11:04:18 xenial-vm3 kernel: [8.902680] Key type id_resolver 
registered
  Jul 11 11:04:18 xenial-vm3 kernel: [8.902682] Key type id_legacy 
registered
  Jul 11 11:04:18 xenial-vm3 automount[1357]: mounted /home/test1  <==
  Jul 11 11:04:18 xenial-vm3 automount[1357]: attempting to mount entry 
/home/test2  <==
  Jul 11 11:04:18 xenial-vm3 kernel: [9.163011] random: nonblocking pool is 
initialized
  Jul 11 11:04:18 xenial-vm3 automount[1357]: mounted /home/test2  <===
  
- 
  *** Test Case 2 - Restart snmpd :
  
  To reproduce this case, autofs mounts should not be mounted to begin with.
  (restart autofs or let it expire)
  
  #systemctl restart snmpd.service
  
  Syslog entries :
  
  Jul 11 11:15:40 xenial-vm3 systemd[1]: Stopping LSB: SNMP agents...
  Jul 11 11:15:40 xenial-vm3 snmpd[1668]:  * Stopping SNMP services:
  Jul 11 11:15:40 xenial-vm3 snmpd[1434]: Received TERM or STOP signal...  
shutting down...
  Jul 11 11:15:40 xenial-vm3 systemd[1]: Stopped LSB: SNMP agents.
  Jul 11 11:15:40 xenial-vm3 systemd[1]: Starting LSB: SNMP agents...
  Jul 11 11:15:42 xenial-vm3 snmpd[1677]:  * Starting SNMP services:
  Jul 11 11:15:42 xenial-vm3 automount[1357]: attempting to mount entry 
/home/test1 <===
  Jul 11 11:15:42 xenial-vm3 automount[1357]: mounted /home/test1 <===
  Jul 11 11:15:42 xenial-vm3 automount[1357]: attempting to mount entry 
/home/test2 <===
  Jul 11 11:15:42 xenial-vm3 automount[1357]: mounted /home/test2 <===
  Jul 11 11:15:42 xenial-vm3 snmpd[1684]: /etc/snmp/snmpd.conf: line 145: 
Warning: Unknown token: defaultMonitors.
  Jul 11 11:15:42 xenial-vm3 snmpd[1684]: /etc/snmp/snmpd.conf: line 147: 
Warning: Unknown token: linkUpDownNotifications.
  Jul 11 11:15:42 xenial-vm3 snmpd[1684]: 

[Sts-sponsors] [Bug 1835818] Re: snmpd causes autofs mount points to be mounted on service start/restart

2019-08-21 Thread Thomas Ward
After discussion with slashd from the STS Sponsors team, I am
unsubscribing this from Sponsors as STS Sponsors will handle this, and
it does not need to be handled by the standard sponsors team.

-- 
You received this bug notification because you are a member of STS
Sponsors, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/1835818

Title:
  snmpd causes autofs mount points to be mounted on service
  start/restart

Status in net-snmp package in Ubuntu:
  In Progress
Status in net-snmp source package in Xenial:
  In Progress
Status in net-snmp source package in Bionic:
  In Progress
Status in net-snmp source package in Cosmic:
  Won't Fix
Status in net-snmp source package in Disco:
  In Progress
Status in net-snmp source package in Eoan:
  In Progress

Bug description:
  [Impact]

  Autofs direct map triggers are visible in /etc/mtab.
  On boot, when snmpd starts, it iterates over the entries in /etc/mtab and 
performs statfs() on them.
  This trigger automount to mount autofs mounts even if the user does not 
explicitly access them.

  However this happens only if autofs service is started before snmpd.
  If snmpd stars first /etc/mtab is not yet populated with autofs mounts and 
therefore
  are not mounted.

  When there a few autofs mount points the impact is insignificant.
  However when there are thousands of them, this causes unnecessary overhead on 
operations
  such as df.
  This also delays the system shutdown time since everything needs to be 
unmounted.

  [Test Case]

  *** Test Case 1 - During boot:

  The user that brought this issue to our attention would observe all autofs 
mounts
  be mounted at boot, because in their environment autofs would start first.

  In my environment snmpd starts first so to reproduce I had to add a small 
delay in
  snmpd init script.

  In /etc/init.d/snmp :
  @@ -36,6 +36,8 @@ cd /
   
   case "$1" in
 start)
  +# Delay snmp start
  +sleep 2
   log_daemon_msg "Starting SNMP services:"
   # remove old symlink with previous version
   if [ -L /var/run/agentx ]; then


  $cat /etc/auto.master
  /- /etc/auto.nfs --timeout=30

  $cat /etc/auto.nfs
  /home/test1 -fstype=nfs,hard,intr,nosuid,no-subtree-check,tcp :/srv/export/test1
  /home/test2 -fstype=nfs,hard,intr,nosuid,no-subtree-check,tcp :/srv/export/test2

  Reboot vm, syslog entries :

  # Autofs starts
  Jul 11 11:04:16 xenial-vm3 autofs[1295]:  * Starting automount...
  Jul 11 11:04:16 xenial-vm3 automount[1357]: Starting automounter version 
5.1.1, master map /etc/auto.master
  Jul 11 11:04:16 xenial-vm3 automount[1357]: using kernel protocol version 5.02
  # Mount triggers, now visible in mtab
  Jul 11 11:04:16 xenial-vm3 automount[1357]: mounted direct on /home/test1 
with timeout 300, freq 75 seconds
  Jul 11 11:04:16 xenial-vm3 automount[1357]: mounted direct on /home/test2 
with timeout 300, freq 75 seconds
  Jul 11 11:04:16 xenial-vm3 autofs[1295]:...done.
  ...
  # SNMP starts
  Jul 11 11:04:18 xenial-vm3 snmpd[1294]:  * Starting SNMP services:
  Jul 11 11:04:18 xenial-vm3 systemd[1]: proc-sys-fs-binfmt_misc.automount: Got 
automount request for /proc/sys/fs/binfmt_misc, triggered by 1394 (snmpd)
  Jul 11 11:04:18 xenial-vm3 systemd[1]: Mounting Arbitrary Executable File 
Formats File System...
  Jul 11 11:04:18 xenial-vm3 systemd[1]: Mounted Arbitrary Executable File 
Formats File System.
  Jul 11 11:04:18 xenial-vm3 automount[1357]: attempting to mount entry 
/home/test1 <==
  Jul 11 11:04:18 xenial-vm3 kernel: [8.880685] FS-Cache: Loaded
  Jul 11 11:04:18 xenial-vm3 kernel: [8.889318] FS-Cache: Netfs 'nfs' 
registered for caching
  Jul 11 11:04:18 xenial-vm3 kernel: [8.902672] NFS: Registering the 
id_resolver key type
  Jul 11 11:04:18 xenial-vm3 kernel: [8.902680] Key type id_resolver 
registered
  Jul 11 11:04:18 xenial-vm3 kernel: [8.902682] Key type id_legacy 
registered
  Jul 11 11:04:18 xenial-vm3 automount[1357]: mounted /home/test1  <==
  Jul 11 11:04:18 xenial-vm3 automount[1357]: attempting to mount entry 
/home/test2  <==
  Jul 11 11:04:18 xenial-vm3 kernel: [9.163011] random: nonblocking pool is 
initialized
  Jul 11 11:04:18 xenial-vm3 automount[1357]: mounted /home/test2  <===

  
  *** Test Case 2 - Restart snmpd :

  To reproduce this case, autofs mounts should not be mounted to begin with.
  (restart autofs or let it expire)

  #systemctl restart snmpd.service

  Syslog entries :

  Jul 11 11:15:40 xenial-vm3 systemd[1]: Stopping LSB: SNMP agents...
  Jul 11 11:15:40 xenial-vm3 snmpd[1668]:  * Stopping SNMP services:
  Jul 11 11:15:40 xenial-vm3 snmpd[1434]: Received TERM or STOP signal...  
shutting down...
  Jul 11 11:15:40 xenial-vm3 systemd[1]: Stopped LSB: SNMP agents.
  Jul 11 11:15:40 xenial-vm3 systemd[1]: Starting LSB: SNMP agents...
  Jul 11 11:15:42 xenial-vm3 snmpd[1677]:  * Starting SNMP services:
  Jul 11 11:15:42 xenial-vm3 automount[1357]: attempting to mount 

[Sts-sponsors] [Bug 1835818] Re: snmpd causes autofs mount points to be mounted on service start/restart

2019-08-21 Thread Ubuntu Foundations Team Bug Bot
The attachment "lp1835818_eoan.debdiff" seems to be a debdiff.  The
ubuntu-sponsors team has been subscribed to the bug report so that they
can review and hopefully sponsor the debdiff.  If the attachment isn't a
patch, please remove the "patch" flag from the attachment, remove the
"patch" tag, and if you are member of the ~ubuntu-sponsors, unsubscribe
the team.

[This is an automated message performed by a Launchpad user owned by
~brian-murray, for any issue please contact him.]

** Tags added: patch

-- 
You received this bug notification because you are a member of STS
Sponsors, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/1835818

Title:
  snmpd causes autofs mount points to be mounted on service
  start/restart

Status in net-snmp package in Ubuntu:
  In Progress
Status in net-snmp source package in Xenial:
  In Progress
Status in net-snmp source package in Bionic:
  In Progress
Status in net-snmp source package in Cosmic:
  Won't Fix
Status in net-snmp source package in Disco:
  In Progress
Status in net-snmp source package in Eoan:
  In Progress

Bug description:
  [Impact]

  Autofs direct map triggers are visible in /etc/mtab.
  On boot, when snmpd starts, it iterates over the entries in /etc/mtab and 
performs statfs() on them.
  This trigger automount to mount autofs mounts even if the user does not 
explicitly access them.

  However this happens only if autofs service is started before snmpd.
  If snmpd stars first /etc/mtab is not yet populated with autofs mounts and 
therefore
  are not mounted.

  When there a few autofs mount points the impact is insignificant.
  However when there are thousands of them, this causes unnecessary overhead on 
operations
  such as df.
  This also delays the system shutdown time since everything needs to be 
unmounted.

  [Test Case]

  *** Test Case 1 - During boot:

  The user that brought this issue to our attention would observe all autofs 
mounts
  be mounted at boot, because in their environment autofs would start first.

  In my environment snmpd starts first so to reproduce I had to add a small 
delay in
  snmpd init script.

  In /etc/init.d/snmp :
  @@ -36,6 +36,8 @@ cd /
   
   case "$1" in
 start)
  +# Delay snmp start
  +sleep 2
   log_daemon_msg "Starting SNMP services:"
   # remove old symlink with previous version
   if [ -L /var/run/agentx ]; then


  $cat /etc/auto.master
  /- /etc/auto.nfs --timeout=30

  $cat /etc/auto.nfs
  /home/test1 -fstype=nfs,hard,intr,nosuid,no-subtree-check,tcp :/srv/export/test1
  /home/test2 -fstype=nfs,hard,intr,nosuid,no-subtree-check,tcp :/srv/export/test2

  Reboot vm, syslog entries :

  # Autofs starts
  Jul 11 11:04:16 xenial-vm3 autofs[1295]:  * Starting automount...
  Jul 11 11:04:16 xenial-vm3 automount[1357]: Starting automounter version 
5.1.1, master map /etc/auto.master
  Jul 11 11:04:16 xenial-vm3 automount[1357]: using kernel protocol version 5.02
  # Mount triggers, now visible in mtab
  Jul 11 11:04:16 xenial-vm3 automount[1357]: mounted direct on /home/test1 
with timeout 300, freq 75 seconds
  Jul 11 11:04:16 xenial-vm3 automount[1357]: mounted direct on /home/test2 
with timeout 300, freq 75 seconds
  Jul 11 11:04:16 xenial-vm3 autofs[1295]:...done.
  ...
  # SNMP starts
  Jul 11 11:04:18 xenial-vm3 snmpd[1294]:  * Starting SNMP services:
  Jul 11 11:04:18 xenial-vm3 systemd[1]: proc-sys-fs-binfmt_misc.automount: Got 
automount request for /proc/sys/fs/binfmt_misc, triggered by 1394 (snmpd)
  Jul 11 11:04:18 xenial-vm3 systemd[1]: Mounting Arbitrary Executable File 
Formats File System...
  Jul 11 11:04:18 xenial-vm3 systemd[1]: Mounted Arbitrary Executable File 
Formats File System.
  Jul 11 11:04:18 xenial-vm3 automount[1357]: attempting to mount entry 
/home/test1 <==
  Jul 11 11:04:18 xenial-vm3 kernel: [8.880685] FS-Cache: Loaded
  Jul 11 11:04:18 xenial-vm3 kernel: [8.889318] FS-Cache: Netfs 'nfs' 
registered for caching
  Jul 11 11:04:18 xenial-vm3 kernel: [8.902672] NFS: Registering the 
id_resolver key type
  Jul 11 11:04:18 xenial-vm3 kernel: [8.902680] Key type id_resolver 
registered
  Jul 11 11:04:18 xenial-vm3 kernel: [8.902682] Key type id_legacy 
registered
  Jul 11 11:04:18 xenial-vm3 automount[1357]: mounted /home/test1  <==
  Jul 11 11:04:18 xenial-vm3 automount[1357]: attempting to mount entry 
/home/test2  <==
  Jul 11 11:04:18 xenial-vm3 kernel: [9.163011] random: nonblocking pool is 
initialized
  Jul 11 11:04:18 xenial-vm3 automount[1357]: mounted /home/test2  <===

  
  *** Test Case 2 - Restart snmpd :

  To reproduce this case, autofs mounts should not be mounted to begin with.
  (restart autofs or let it expire)

  #systemctl restart snmpd.service

  Syslog entries :

  Jul 11 11:15:40 xenial-vm3 systemd[1]: Stopping LSB: SNMP agents...
  Jul 11 11:15:40 xenial-vm3 snmpd[1668]:  * Stopping SNMP services:
  Jul 11 11:15:40 xenial-vm3 snmpd[1434]: Received