I have noticed that /sbin/ldconfig runs at each boot and that it adds
a bit of time to the bootup process. I checked the man page but I
don't really understand what is happening.
Does this have to be run at each bootup AND can someone give me a
description of what it does?
Thanks
> I have noticed that /sbin/ldconfig runs at each boot and that it adds a
> bit of time to the bootup process. I checked the man page but I don't
> really understand what is happening.
The man page is well written. What part do you not understand?
> Does this have to be run at each bootup AND can someone give me a
> description of what it does?
You can disable it in /etc/rc.d/rc.M if you wish and find out for
yourself what it does.
When you run a program your computer reads code from the binary file that
is the program itself, e g /bin/ls is read and executed every time you
execute the command "ls".
However, in most cases not only the single binary executable file is
enough but also some other files are needed. Those files also containing
executable code are called dynamic libraries. You can see if a program
depends on any dynamic libraries by using the ldd program, e g:
$ ldd /bin/ls
librt.so.1 => /lib/librt.so.1 (0x4002d000) libc.so.6 =>
/lib/libc.so.6 (0x40040000) libpthread.so.0 =>
/lib/libpthread.so.0 (0x40176000) /lib/ld-linux.so.2 =>
/lib/ld-linux.so.2 (0x40000000)
In this case ls depends on four different dynamic libraries.
It is also possible to build static executable files that contain all the
code needed in a single file but those executable files will then be a lot
bigger. With the command "file" you can see if a binary executable is a
statically linked or dynamically linked.
Some more examples:
$ file /bin/ls
/bin/ls: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
dynamically linked (uses shared libs), stripped
$ file /usr/local/bin/wine-preloader
/usr/local/bin/wine-preloader: ELF 32-bit LSB executable, Intel 80386,
version 1 (SYSV), statically linked, stripped
$ ldd /usr/local/bin/wine-preloader
not a dynamic executable
Dynamic libaries are files that contain a version string in the file name,
and when executables are linked not all sub versions are specified. To
find the right library symbolic links are created from the right files
with complete version numbers to files which can be found by executables.
Some more examples:
$ ldd /bin/ls
librt.so.1 => /lib/librt.so.1 (0x4002d000) libc.so.6 =>
/lib/libc.so.6 (0x40040000) libpthread.so.0 =>
/lib/libpthread.so.0 (0x40176000) /lib/ld-linux.so.2 =>
/lib/ld-linux.so.2 (0x40000000)
$ file /lib/libpthread.so.0
/lib/libpthread.so.0: symbolic link to libpthread-0.10.so
$ file /lib/libpthread-0.10.so
/lib/libpthread-0.10.so: ELF 32-bit LSB shared object, Intel 80386,
version 1 (SYSV), not stripped
Those symbolic links are created by ldconfig. Each time a new dynamic
library is installed ldconfig should be run.
In theory, it could be possible that you have booted from a CD or from
another partition and installed libraries on your Slackware installation
since last reboot. For that reason it is a rather good idea to run
ldconfig in the bootup scripts.
regards Henrik
--
The address in the header is only to prevent spam. My real address is:
hc3(at)poolhem.se Examples of addresses which go to spammers:
root@localhost postmaster@localhost
ldconfig check new libraries installed and wirte in al list to find easily
to other program.
If you prefer you can install anacron and perform this check every xx days.
Max
--
Cerchi informazioni su Linux?
Linuxpedia: http://maxint.dynalias.org
Most programs use shared libraries (dlls in Windows-land). As a
performance optimization, ldconfig searches the paths listed in
/etc/ld.so.conf and makes a list of what it finds in /etc/ld.so.cache.
Thus the linker doesn't have to search the paths each time a program
loads.
Really, ldconfig only needs to be called after installing a library
into one of these paths. However, new users don't know to do that;
but they have picked up this bad habit (who knows where) of rebooting
whenever something doesn't work. Hence ldconfig (and a couple other
caching programs) got added to the startup sequence.
Look in /etc/rc.d for the startup scripts.
- Daniel
That really answers the question as I interpret it. I didn't read it as
"what does it do" but "why does it need to run on every boot".
It hasn't bothered me, but since I thought I understood ldconfig, it
didn't really make sense that it ran on every boot.
Michael
If it is the time that bothers you, edit /etc/rc.d/rc.M and "background"
ldconfig. You do that by appending an ampersand at the end of the command,
like this:
/sbin/ldconfig &
or (as I do)
( /sbin/ldconfig ) &
rc.M will execute the next instruction immediately rather than waiting for
ldconfig to finish. If you're careful, there may be some other things in
the startup that would make the boot faster if backgrounded. Just don't
get carried away.
--
buck
Thanks everybody! That clarifies a lot.
Henrik, thanks especially for your elaborate illustration.
Where could you get a better understanding of the Linux OS
interrnals....not from a programming perspective, but from all the
aspects of the OS & how they work together?
Maybe in a book like "Linux in a Nutshell" or at
http://www.tldp.org/LDP/sag/html/index.html
However, to really understand most internals it also helps to have some C
programming knowledge. A system that comes with complete source code can
also be said to be completely and correctly documented. However this
"documentation" is not allways so easy to read and understand.
Crond and atd are good for server, but not for desktop. Desktop usually
stays turned off the most part of the day.
Just as unnecessary as anacron.
It only needs to be done when a new library is added.
It makes sense to have it done at boot time, but it
doesn't make a lick of sense to have it done
periodically on a running system. If a library is
added, the only sensible thing is to _immediately_ run
ldconfig to allow it to be accessed. There should never
be a time when a periodically invoked instance of
ldconfig would actually be useful...
--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) fl...@apaflo.com
It therefore runs ldconfig every time anyone turns it on
to use it, so why would it make sense to run it again
with anacron (never mind crond or atd)??
BTW, regularly shutting down a desktop Linux box isn't a
great idea. But the comment does apply to laptops.