One more note about this... this morning I had an itch I could not scratch, about why the entire issue resulted.  So, I completely uninstalled net-snmp-5.9 via make uninstall, deleted the source directory, then I installed the existing official net-snmp package for Debian 10 buster (which is 5.7.1 if memory serves), I validated snmp was working as expected.  I then uninstalled the official package via apt remove --purge.  Copied down a clean copy of net-snmp 5.9 and proceeded following my notes, running configure, make, and make install.  I confirmed that /usr/local/sbin is the default path, I confirmed that /usr/local/sbin, was in libc.conf under /etc/ld.so.conf.d/, and then ran ldd.  This time ldd did not report any missing libraries?  That strikes me as odd!  So I guess the next step is a completely clean Debian 10 buster OS install, and see if I can get any consistency for the issue or not.  Clearly this issue occurs because there is enough communication about it via Google search. And clearly I did trip over it yesterday.  But it is a bit of mystery at this point how or why.

-DD

On 5/14/2021 09:39, Dachshund Digital wrote:

Actually I figured this out... not completely sure why it happens on my system, and I found a few references to it happening for others via google as well... so it is not a one off issue per se.

One odd quirk is that my install of net-snmp defaults on Debian 10 /usr/local/sbin, not /usr/sbin/, I ran ./configure with no added options for not sure why this delta emerges.   But this is only an issue for the unit file (systemd) default file that needs to be tweaked for the different path.  It is this difference in path that resulted that is at the heart of the issue.  But I digress, to fix the 'not found' (they do exist, just not found) libraries issue there are two options to that I have found that work.

Option 1:

    Edit the hidden bashrc file for the user that will run snmpd, add the the following line...

        export LD_LIBRARY_PATH=/usr/local/lib

    Logout and login to invoke bashrc execution.

Option 2, which I like better is to do the following...

   Check for or Create /etc/ld.so.conf.d/libc.conf.   Some systems I reviewed had libc.conf with the needed path, some did not.  One google reference created a local.conf file with the same path as well.

        # nano /etc/ld.so.conf.d/libc.conf

            /usr/local/lib

    Then run ldconfig

After the above changes...

# ldd /usr/local/sbin/snmpd
        linux-gate.so.1 (0xb7fa8000)
        libnetsnmpagent.so.40 => /usr/local/lib/libnetsnmpagent.so.40 (0xb7f1c000)         libnetsnmpmibs.so.40 => /usr/local/lib/libnetsnmpmibs.so.40 (0xb7cc7000)
        libnetsnmp.so.40 => /usr/local/lib/libnetsnmp.so.40 (0xb7be5000)
        libperl.so.5.28 => /usr/lib/i386-linux-gnu/libperl.so.5.28 (0xb787d000)
        libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb7877000)
        libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb7856000)
        libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb7678000)
        libcrypt.so.1 => /lib/i386-linux-gnu/libcrypt.so.1 (0xb7645000)
        libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb753f000)
        /lib/ld-linux.so.2 (0xb7faa000)

The libraries that were not found are now found!  This should let snmpd fine the libraries as expected, via direct run or via systemd unit file for same.  Providing you update the unit file for the path delta as noted above.Just for reference, the tweaked unit file is below...  For my test, I did not create a specific user, used root.  This is not a best practice, the current Debian 10 package (based on 5.7.1) uses 'Debian-snmp' as execution user, you should consider doing this if moving to 5.9 when compiled from source.

# cat /lib/systemd/system/snmpd.service
[Unit]
Description=Simple Network Management Protocol (SNMP) daemon.
After=syslog.target network.target

[Service]
Type=simple
ExecStartPre=/bin/mkdir -p /var/run/agentx
#ExecStart=/usr/local/sbin/snmpd -LS6d -Lf /dev/null -u Debian-snmp -g Debian-snmp -I -smux,mteTrigger,mteTriggerConf -f -p /run/snmpd.pid ExecStart=/usr/local/sbin/snmpd -LS6d -Lf /dev/null -I -smux,mteTrigger,mteTriggerConf -f -p /run/snmpd.pid
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

-DD

On 5/13/2021 20:25, Bart Van Assche wrote:

I can't reproduce this. If I build and install Net-SNMP from the v5.9 branch, the installed binary runs fine:

|./configure --enable-developer --enable-ipv6 --prefix=/home/bart/net-snmp-V5-9-patches --with-cflags=-g -O1 -pipe -DNETSNMP_USE_ASSERT -D_FORTIFY_SOURCE=2 -fno-strict-aliasing -fno-inline -fno-inline-functions -fno-inline-functions- called-once -fno-early-inlining -Wno-inline -fno-inline-small-functions -DNETSN MP_USE_ASSERT --with-defaults --enable-new-features --with-perl-modules --with- default-snmp-version=2 --with-transports=IPX STD DTLSUDP TLSTCP --with-security -modules=usm tsm --with-mib-modules=agent/extend examples/data_set examples/del ayed_instance examples/example examples/notification examples/scalar_int exampl es/ucdDemoPublic examples/watched smux disman/event disman/expression disman/mt eEventNotificationTable disman/mteEventTable disman/mteObjectsTable disman/mteT riggerBooleanTable disman/mteTriggerDeltaTable disman/mteTriggerExistenceTable disman/mteTriggerTable disman/mteTriggerThresholdTable disman/nslookup-mib dism an/ping-mib disman/schedule disman/traceroute-mib examples/netSnmpHostsTable ha rdware/cpu hardware/memory host ip-forward-mib ip-mib/inetNetToMediaTable ip-mi b/ipv4InterfaceTable ip-mib/ipv6InterfaceTable mibII/mta_sendmail misc/ipfwacc snmp-notification-mib tcp-mib testhandler tunnel ucd-snmp/diskio ucd-snmp/exten sible udp-mib Rmon Rmon/alarm snmp-usm-dh-objects-mib tlstm-mib tsm-mib --with- ldflags=-L/usr/local/lib CFLAGS=-g -O1 -pipe -DNETSNMP_USE_ASSERT -D_FORTIFY_SO URCE=2 -fno-strict-aliasing -fno-inline -fno-inline-functions -fno-inline-func tions-called-once -fno-early-inlining -Wno-inline -fno-inline-small-functions C PPFLAGS=-g -O1 -pipe -DNETSNMP_USE_ASSERT -D_FORTIFY_SOURCE=2 -fno-strict-aliasing -fno-inline -fno-inline-functions -fno-inline-functions-called-once -fno-early-inlining -Wno-inline -fno-inline-small-functions LDFLAGS= && make && make install |

From the installation directory (/home/bart/net-snmp-V5-9-patches):

|$ ldd sbin/snmpd linux-vdso.so.1 (0x00007ffd7f3d8000) libnetsnmpagent.so.40 => /home/bart/net-snmp-V5-9-patches/lib/libnetsnmpagent.so.40 (0x00007fd958ca7000) libnetsnmpmibs.so.40 => /home/bart/net-snmp-V5-9-patches/lib/libnetsnmpmibs.so.40 (0x00007fd95899d000) libnetsnmp.so.40 => /home/bart/net-snmp-V5-9-patches/lib/libnetsnmp.so.40 (0x00007fd9588c0000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fd958897000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd9586d2000) libperl.so.5.32 => /lib/x86_64-linux-gnu/libperl.so.5.32 (0x00007fd958344000) libcrypto.so.1.1 => /lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007fd95804e000) libpci.so.3 => /lib/x86_64-linux-gnu/libpci.so.3 (0x00007fd95803d000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fd958037000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd957ef3000) libssl.so.1.1 => /lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007fd957e60000) /lib64/ld-linux-x86-64.so.2 (0x00007fd958d27000) libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007fd957e25000) libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fd957e06000) libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007fd957dec000) libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007fd957dc4000) $ ./sbin/snmpd -f -Lo -c ~/software/tools/snmpd.conf -r :1161 [ snmpd runs fine ] |

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <https://github.com/net-snmp/net-snmp/issues/289#issuecomment-840979684>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AALK3TMVCJFBCYSG3F6L5DTTNSJYZANCNFSM443BOCOQ>.



_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to