[SOLVED] ldconfig - Is this command present on all distros per default?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a hard time seeing precisely where it fits into the Linux architecture. Can I trust this program to be present on any distribution?
I seem to remember having to install it manually as a libc6-tools package or something after a fresh install of Debian, which fits badly with it having to keep track of .so files.
ldconfig is part of libc as are one or two other commands (ldd comes to mind). However most binary distros put these utility commands into a separate package, usually called libc-bin.
Yes. libc-bin was the one. So I cannot just assume it is always present. I find that a little funny given the documentation saying it is run automatically on boot and when installing new libraries.
brian@slackdesk2:~$ ldconfig -V
bash: ldconfig: command not found
brian@slackdesk2:~$ su -
Password:
root@slackdesk2:~# ldconfig -V
ldconfig (GNU libc) 2.23
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Andreas Jaeger.
That's because it's not on your path. If you give the full pathname, you can run it as yourself.
Code:
$ ldconfig -V
bash: ldconfig: command not found
$ /sbin/ldconfig -V
ldconfig (GNU libc) 2.27
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Andreas Jaeger.
Mind you, that doesn't work if you want it to actually configure something.
The only time it would be necessary to run it manually, maybe, is if you installed a library in an unusual place (e.g. /opt), and edited /etc/ld.so.conf to show that.
You can find several references/examples to ldconfig. Just do a search on the LDP with 'ldconfig' as your key and you will find loads of information. Heck, even 'man ldconfig';
DESCRIPTION
ldconfig creates the necessary links and cache to the most recent shared libraries found in the directories specified on the command line, in the file
/etc/ld.so.conf, and in the trusted directories, /lib and /usr/lib (on some 64-bit architectures such as x86-64, lib and /usr/lib are the trusted directories
for 32-bit libraries, while /lib64 and /usr/lib64 are used for 64-bit libraries).
The cache is used by the run-time linker, ld.so or ld-linux.so. ldconfig checks the header and filenames of the libraries it encounters when determining which
versions should have their links updated.
ldconfig will attempt to deduce the type of ELF libraries (i.e., libc5 or libc6/glibc) based on what C libraries, if any, the library was linked against.
Some existing libraries do not contain enough information to allow the deduction of their type. Therefore, the /etc/ld.so.conf file format allows the specifi‐
cation of an expected type. This is used only for those ELF libraries which we can not work out. The format is "dirname=TYPE", where TYPE can be libc4,
libc5, or libc6. (This syntax also works on the command line.) Spaces are not allowed. Also see the -p option. ldconfig should normally be run by the supe‐
ruser as it may require write permission on some root owned directories and files.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.