snmptrapd.service uses MIBSDIR instead of MIBDIRS

Bug #1847377 reported by a1291762
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
net-snmp (Ubuntu)
Fix Released
Undecided
Unassigned
Bionic
Won't Fix
Undecided
Unassigned
Eoan
Won't Fix
Undecided
Unassigned

Bug Description

The snmptrapd.service file (which comes from net-snmp_5.7.3+dfsg-1.8ubuntu3.1.debian.tar.xz rather than upstream) has this line:

Environment="MIBSDIR=/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:/usr/share/mibs/site:/usr/share/snmp/mibs:/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp"

However, snmptrapd expects to see the MIBDIRS rather than MIBSDIR so this line is not having the intended effect.

This seems to be an upstream Debian packaging issue, but when I looked at their bug tracker they said to use the reportbug program. And when I installed and ran it, it said to use ubuntu-bug.

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: snmptrapd 5.7.3+dfsg-1.8ubuntu3.3
ProcVersionSignature: Ubuntu 4.15.0-65.74-generic 4.15.18
Uname: Linux 4.15.0-65-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.20.9-0ubuntu7.7
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Wed Oct 9 09:38:51 2019
InstallationDate: Installed on 2019-02-11 (239 days ago)
InstallationMedia: Ubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725)
SourcePackage: net-snmp
UpgradeStatus: No upgrade log present (probably fresh install)
modified.conffile..etc.snmp.snmptrapd.conf: [modified]
mtime.conffile..etc.snmp.snmptrapd.conf: 2019-09-04T14:08:11.370359

Revision history for this message
a1291762 (a1291762) wrote :
Revision history for this message
Bryce Harrington (bryce) wrote :

Yes, it does appear to be a typo, you're right. Grepping the source tree shows "MIBSDIR" only appears in ./debian/snmptrapd.service and ./debian/snmpd.service, whereas "MIBDIRS" shows up 144 times in the main source tree.

The issue appears to be present in both bionic (5.7.3+dfsg-1.8ubuntu3) and eoan (5.7.3+dfsg-5ubuntu5). Looks like it should probably also affect xenial and disco.

I notice, however, that none of these mibs directories actually exist, at least not with just snmptrapd installed (are there any packages that install mibs to any of these dirs?) The service itself seems to function identically with the typo'd env var and with the fixed one. I.e.:

$ sudo apt-get install -y snmptrapd
$ service snmptrapd status

● snmptrapd.service - Simple Network Management Protocol (SNMP) Trap Daemon.
   Loaded: loaded (/lib/systemd/system/snmptrapd.service; disabled; vendor preset: enabled)
   Active: active (running) since Wed 2019-10-09 22:21:50 UTC; 7s ago
 Main PID: 2276 (snmptrapd)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/snmptrapd.service
           └─2276 /usr/sbin/snmptrapd -Lsd -f

Oct 09 22:21:51 triage-bionic snmptrapd[2276]: Cannot adopt OID in UCD-SNMP-MIB: laErrorFlag ::= { laEntry 100 }
Oct 09 22:21:51 triage-bionic snmptrapd[2276]: Cannot adopt OID in UCD-SNMP-MIB: laLoadFloat ::= { laEntry 6 }
Oct 09 22:21:51 triage-bionic snmptrapd[2276]: Cannot adopt OID in UCD-SNMP-MIB: laLoadInt ::= { laEntry 5 }
Oct 09 22:21:51 triage-bionic snmptrapd[2276]: Cannot adopt OID in UCD-SNMP-MIB: laConfig ::= { laEntry 4 }
Oct 09 22:21:51 triage-bionic snmptrapd[2276]: Cannot adopt OID in UCD-SNMP-MIB: laLoad ::= { laEntry 3 }
Oct 09 22:21:51 triage-bionic snmptrapd[2276]: Cannot adopt OID in UCD-SNMP-MIB: laNames ::= { laEntry 2 }
Oct 09 22:21:51 triage-bionic snmptrapd[2276]: Cannot adopt OID in UCD-SNMP-MIB: laIndex ::= { laEntry 1 }
Oct 09 22:21:51 triage-bionic snmptrapd[2276]: NET-SNMP version 5.7.3 AgentX subagent connected
Oct 09 22:21:51 triage-bionic snmptrapd[2276]: Warning: no access control information configured.
                                                 (Config search path: /etc/snmp:/usr/share/snmp:/usr/lib/x86_64-linux-gnu/snmp)
                                               This receiver will *NOT* accept any incoming notifications.
Oct 09 22:21:51 triage-bionic snmptrapd[2276]: NET-SNMP version 5.7.3

By chance, did you discover this error by it causing an actual issue for you? If so, it'd help in SRUing this to know more about how you triggered it and what the impact was.

Meanwhile, I believe you can use 'reportbug --bts debian' to force reporting the error to debian. You can include a link to this bug report (and please let us know the debian bug report so we can link to it from here).

Changed in net-snmp (Ubuntu):
status: New → Confirmed
Revision history for this message
a1291762 (a1291762) wrote :

I noticed this while trying to add a directory to the list (custom MIBs).

The snmp-mibs-downloader package populates the directories in the list.

a1291762 (a1291762)
summary: - snmptrapd.service uses MIBSDIRS instead of MIBDIRS
+ snmptrapd.service uses MIBSDIR instead of MIBDIRS
Revision history for this message
a1291762 (a1291762) wrote :
Revision history for this message
a1291762 (a1291762) wrote :

For a longer description of what I was doing...

I have a device that sends SNMP traps and it was sending them to my desktop. I was monitoring snmptrapd using sudo journalctl -f -u snmptrapd.

Originally, this provided only numeric OIDs. Installing snmp-mibs-downloader fixed up many of the OIDs but not the custom ones.

In order to get the custom MIBS working, I had to add the directory they were in to MIBDIRS and add -m ALL to the snmptrapd.service file (well... I don't know if the commandline change was needed, I was following a co-worker's suggestions). I have attached the modified snmptrapd.service file to this bug. On my system, this file is /etc/systemd/system/snmptrapd.service.

This is a command that works to send a trap to my local snmptrapd (running on the same box):

MIBDIRS=/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:/usr/share/mibs/site:$HOME/work/git/ogtrapd/mibs /usr/bin/snmptrap -mALL -v 2c -c log 127.0.0.1:162 "0" OG-TEST-MIB::ogTESTMessage ogTESTMessageStatus s 'test message'

I'll attach the custom MIBS needed to make this work too. That should allow you to complete reproduce the issue and fix.

Revision history for this message
a1291762 (a1291762) wrote :
Revision history for this message
a1291762 (a1291762) wrote :
Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

Thank you!

From the Debian bug:

Format: 1.8
Date: Wed, 23 Oct 2019 08:56:17 +1100
Source: net-snmp
Architecture: source
Version: 5.8+dfsg-2
Distribution: unstable
Urgency: medium
Maintainer: Net-SNMP Packaging Team <email address hidden>
Changed-By: Craig Small <email address hidden>
Closes: 942151 942284
Changes:
 net-snmp (5.8+dfsg-2) unstable; urgency=medium
 .
   * All MIB directory values removed and just use the default compile-time
     options, which is usually ok. Admins can add their own environment
     settings or options to change. Closes: #942151
   * Do not do parallel builds Closes: #942284
   * Correct sedscript CPPFLAGS and libnetsnmptrapd LDFLAGS
   * Also use default flags for restart on init scripts

We see that Ubuntu Focal is Fix Released and Eoan/Bonic should be flagged as Confirmed.

Changed in net-snmp (Ubuntu Bionic):
status: New → Incomplete
status: Incomplete → Confirmed
Changed in net-snmp (Ubuntu Eoan):
status: New → Confirmed
Changed in net-snmp (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote :

The Eoan Ermine has reached end of life, so this bug will not be fixed for that release

Changed in net-snmp (Ubuntu Eoan):
status: Confirmed → Won't Fix
tags: added: bitesize
Changed in net-snmp (Ubuntu Bionic):
assignee: nobody → Michał Małoszewski (michal-maloszewski99)
Revision history for this message
Michał Małoszewski (michal-maloszewski99) wrote :

Move one for now. It's a minor problem.

Revision history for this message
Michał Małoszewski (michal-maloszewski99) wrote :

I've started working on this bug, and I have found the commit that would fix the bug: https://salsa.debian.org/debian/net-snmp/-/commit/ff38701294deaa4af1b6cf557d6223b5dd8e5ee2, but I've spotted that there is a big discrepancy in code between one specific file in Focal and Bionic. Using git blame I have found the fix for that gap, but the fix is too complex for that bug, which seems to be Low priority. Moreover, Bionic will reach the EOSS in June, that's why I am going to unassign myself and move on.

Changed in net-snmp (Ubuntu Bionic):
assignee: Michał Małoszewski (michal-maloszewski99) → nobody
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Bionic has reached its End of Standard Support, so I'm marking this bug as Won't Fix.

Changed in net-snmp (Ubuntu Bionic):
status: Confirmed → Won't Fix
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.