External command error: /usr/local/bin/snmpget: error while loading shared libraries: libnetsnmp.so.20: cannot open shared object file

19,772

The below procedure is helpful, if libnetsnmp.so.XX is in your system.

First search for library libnetsnmp.so.XX

sudo find / -name libnetsnmp.so*

So you will get output like below

/usr/lib/libnetsnmp.so.30
/usr/lib/libnetsnmp.so.15
/usr/lib/libnetsnmp.so.15.1.2
/usr/local/lib/libnetsnmp.so.30
/usr/local/lib/libnetsnmp.so
/usr/local/lib/libnetsnmp.so.30.0.2
/usr/local/lib/libnetsnmp.so.20
...

Now link that libnetsnmp.so.XX to /usr/lib/

sudo ln -s /usr/local/lib/libnetsnmp.so.XX /usr/lib/libnetsnmp.so.XX
Share:
19,772
Enigma
Author by

Enigma

Updated on June 26, 2022

Comments

  • Enigma
    Enigma almost 2 years

    I'm able to do a snmpget/snmpwalk and check_snmp through command line. But, when I do it through Nagios (creating a host & services entry in the config files), I see this error in the "Status Information" of the services under specific host:

    External command error: /usr/local/bin/snmpget: error while loading shared libraries: libnetsnmp.so.20: cannot open shared object file: No such file or directory

    OS: SLES 11

  • Enigma
    Enigma almost 12 years
    ldd /usr/local/bin/snmpget linux-vdso.so.1 => (0x00007fffc33ff000) libnetsnmp.so.20 => /usr/local/lib/libnetsnmp.so.20 (0x00007fefca658000) libm.so.6 => /lib64/libm.so.6 (0x00007fefca402000) libc.so.6 => /lib64/libc.so.6 (0x00007fefca0a4000) /lib64/ld-linux-x86-64.so.2 (0x00007fefca929000)
  • Enigma
    Enigma almost 12 years
    There ain't any missing lib !
  • Enigma
    Enigma almost 12 years
    I have already set LD_LIBRARY_PATH to /usr/local/lib, where all the libraries are. Still not working !
  • Igor Chubin
    Igor Chubin almost 12 years
    may be libnetsnmp.so.20 is a 32bit library. please check it using file command. just run file /path/to/lib.so
  • Igor Chubin
    Igor Chubin almost 12 years
    no, when ldd finds all dependency, LD_LIBRARY_PATH will not help you of course.
  • Enigma
    Enigma almost 12 years
    This is what I get: /usr/local/lib/libnetsnmp.so.20.0.2: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped It is a 64bit lib only
  • Igor Chubin
    Igor Chubin almost 12 years
    can you please install ltrace and run ltrace /usr/local/bin/snmpget and see what happens?
  • Enigma
    Enigma almost 12 years
    This is what I get at the end... fwrite(" -C APPOPTS\t\tSet various applic"..., 1, 59, 0x7f5d6d51d860 -C APPOPTS Set various application specific behaviours: ) = 59 fwrite("\t\t\t f: do not fix errors and r"..., 1, 49, 0x7f5d6d51d860 f: do not fix errors and retry the request ) = 49 exit(1 <unfinished ...> +++ exited (status 1) +++