Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

/sbin/ldconfig at each boot

748 views
Skip to first unread message

ahme...@gmail.com

unread,
Apr 16, 2008, 1:46:25 PM4/16/08
to

Hi guys,

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

Dave Uhring

unread,
Apr 16, 2008, 1:58:15 PM4/16/08
to
On Wed, 16 Apr 2008 10:46:25 -0700, ahmedaden wrote:

> 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.

Henrik Carlqvist

unread,
Apr 16, 2008, 2:11:38 PM4/16/08
to
ahme...@gmail.com wrote:

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

Massimiliano Vessi

unread,
Apr 16, 2008, 5:52:14 PM4/16/08
to

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

D Herring

unread,
Apr 16, 2008, 9:00:52 PM4/16/08
to

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

Michael Black

unread,
Apr 16, 2008, 11:44:34 PM4/16/08
to

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

buck

unread,
Apr 17, 2008, 1:13:12 AM4/17/08
to
ahme...@gmail.com wrote in news:9a5f8ccc-dd4a-4c5a-a67e-71c246ac2c38
@u69g2000hse.googlegroups.com:


> Hi guys,
>
> I have noticed that /sbin/ldconfig runs at each boot and that it adds
> a bit of time to the bootup process.

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

ahme...@gmail.com

unread,
Apr 17, 2008, 2:25:39 PM4/17/08
to

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?

Henrik Carlqvist

unread,
Apr 17, 2008, 4:35:42 PM4/17/08
to
ahme...@gmail.com wrote:
> 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.

goarilla <"kevin

unread,
Apr 17, 2008, 4:54:33 PM4/17/08
to
Massimiliano Vessi wrote:
> ahme...@gmail.com il 19:46, mercoledě 16 aprile 2008 ha scritto:
>
>> Hi guys,
>>
>> 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?
>>
>
> 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
>
whats wrong with crond or atd for that ?

Massimiliano Vessi

unread,
Apr 17, 2008, 8:18:56 PM4/17/08
to

> Massimiliano Vessi wrote:

>> ahme...@gmail.com il 19:46, mercoled� 16 aprile 2008 ha scritto:
>>
>>> Hi guys,
>>>
>>> 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?
>>>
>>
>> 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
>>
> whats wrong with crond or atd for that ?

Crond and atd are good for server, but not for desktop. Desktop usually
stays turned off the most part of the day.


Floyd L. Davidson

unread,
Apr 17, 2008, 9:24:58 PM4/17/08
to
"goarilla <\"kevin<punt>paulus|\"@|skynet" <"punt> wrote:

>Massimiliano Vessi wrote:
>> 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
>>
>whats wrong with crond or atd for that ?

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

Floyd L. Davidson

unread,
Apr 17, 2008, 11:24:24 PM4/17/08
to

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.

0 new messages