← Back to team overview

group.of.nepali.translators team mailing list archive

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

 

** Changed in: net-snmp (Ubuntu Cosmic)
       Status: In Progress => Won't Fix

-- 
You received this bug notification because you are a member of नेपाली
भाषा समायोजकहरुको समूह, which is subscribed to Xenial.
Matching subscriptions: Ubuntu 16.04 Bugs
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 <NFS server IP>:/srv/export/test1
  /home/test2 -fstype=nfs,hard,intr,nosuid,no-subtree-check,tcp <NFS server IP>:/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]: Turning on AgentX master support.
  Jul 11 11:15:42 xenial-vm3 systemd[1]: Started LSB: SNMP agents.
  Jul 11 11:15:42 xenial-vm3 snmpd[1708]: NET-SNMP version 5.7.3

  
  [Regression Potential]
  TBD

  [Other]

  Similar problem : https://sourceforge.net/p/net-snmp/patches/1350/

  I built a test package with this patch.
  PPA : https://launchpad.net/~joalif/+archive/ubuntu/sf227130-test

  - The user reported back that the problem would still persist even with the test
  package.

  - Initially while testing it in my environment it would seem that the test package 
  would not solve the problem entirely.
  However, after further rigorous testing I doubt the integrity of my first test results.
  I had not taken into account the expiration of mounts.
  Autofs mount points were already mounted before installing the test package, the expiration
  time was long enough not to be unmounted and therefore when installing the test package
  autofs mounts were there which was misleading.

  Now after careful testing it seems that the test package is working.
  However, I would like more people to test as well to make sure whether the test
  package is actually working or not.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/net-snmp/+bug/1835818/+subscriptions