Linux Shared Library Dependencies: Fix Missing Libraries

Quick Linux Tip #97:

Question: My binary exists but Linux says 'command not found'. What's wrong?

Try: file /usr/local/bin/mytool && ldd /usr/local/bin/mytool

Info: "No such file or directory" when executing an existing binary typically points to a missing dynamic loader/interpreter or missing shared libraries (.so). ldd reveals unresolvable dependencies.

Examples:

  • $ file /path/to/binary  # Verify binary type, architecture, and executable status
  • $ ldd /path/to/binary | grep 'not found'  # Quickly filter missing shared library dependencies
  • $ sudo ldconfig -p | grep libfoo  # Query system shared library cache for missing libraries

Note: Also verify architecture compatibility (e.g., 32-bit execution on a 64-bit kernel), invalid shebang paths in scripts (#!/bin/python when missing), or missing execute flags (chmod +x).




LinuxTeck.com
linuxteck:~$ file /usr/local/bin/mytool && ldd /usr/local/bin/mytool
/usr/local/bin/mytool: ELF 64-bit LSB executable, x86-64, dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, stripped
        linux-vdso.so.1 (0x00007ffd5abcdefg)
        libfoo.so.3 => not found
        libbar.so.1 => not found
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8a12345000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f8a56789000)
linuxteck:~$

PREVIOUS ARTICLE Quick Linux Tip #96: Linux File Access Auditing: Track Who Accessed /etc/shadow NEXT ARTICLE Quick Linux Tip #98: Linux Process Monitoring: Catch Hidden Processes in Real Time
About John Britto

John Britto Founder & Chief-Editor @LinuxTeck. A Computer Geek and Linux Intellectual having more than 20+ years of experience in Linux and Open Source technologies.

View all posts by John Britto →

Leave a Reply

Your email address will not be published.