brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: ldconfig -p lists every shared library the system can find

Linux
~/tips/tip-linux-ldconfig-p-shared-libraries

ldconfig -p | grep libssl

Lists the shared libraries registered in the linker cache so you can search them.

“error while loading shared libraries” is one of those messages that sends you searching the whole disk. The dynamic linker keeps a list you can ask directly.

The man page describes ldconfig -p as printing the lists of directories and candidate libraries stored in the current cache. That cache is /etc/ld.so.cache by default, built from the directories in /etc/ld.so.conf, and the run-time linker uses it to find libraries:

ldconfig -p | grep libssl

The output has one line per library with its name, the architecture and the path it resolves to. If the library you need appears, the problem is probably a version or architecture mismatch, such as a 32-bit library where a 64-bit one is needed. If it does not appear, it is either not installed or it lives in a folder the linker does not know about.

For a folder the linker does not know, add its path to the list in /etc/ld.so.conf and rebuild the cache as root:

sudo ldconfig
ldconfig -p | grep libexample

The second line confirms the library is registered now. Add -v to the first command if you want to see each directory as it is scanned and the links that get created.

The list shows what the cache knows, not what is on the disk. A library you just copied into a folder will not show up until the cache is rebuilt. Also, running ldconfig without -p as root changes the cache, so type the -p when you only want to look.

Further reading: ldconfig(8) manual page

More Linux tips a2query -m rewrite renice -n 10 -p 4242 cat config.yml | xsel -ib xvfb-run -a your-program --some-flag dpkg --get-selections > packages.txt All Linux tips (261) All topics

Link