shooting oneself in the foot with "ldconfig -v"

Erik Trulsson ertr1013 at
Wed Oct 10 15:34:47 PDT 2007

On Wed, Oct 10, 2007 at 05:41:29PM -0400, Jonathan Noack wrote:
> Hey folks,
> I'm running 6.2-p8 and was trying to clean up my "portsclean -L" output
> today.  It was reporting tons of duplicate libraries in /usr/X11R6 and
> /usr/local even though X11R6 is an alias to /usr/local.  I tracked the
> problem to portclean's use of `ldconfig -elf -r` which was reporting
> directories and libraries in /usr/X11R6.  I read the ldconfig manpage in
> an attempt to understand more and saw this line:
>      -v      Switch on verbose mode.
> I told myself, "Self, the '-v' option may allow you to determine what's
> going on.  It can't help knowing more!"  Alas, the "-v" option doesn't
> behave as advertised.  Instead it clears the shared library cache
> (reference:  An empty shared library
> cache means all dynamically-linked programs fail.  This has the wonderful
> side-effect of preventing me from logging into the box to fix it (I logged
> off before I figured this out).  "Reboot and all will be well," you say? 
> Yes, on boot /etc/rc.d/ldconfig is run and it builds the shared library
> cache.  Unfortunately, the box is 1,000 miles away in my apartment.  :(
> This brings me to the question:
> Is the "-v" option broken or is the documentation out of date?

No, the '-v' option behaves as documented and is not broken.
It is, however, intended to be used in conjunction with some other option.

You see, running ldconfig(8) without any arguments at all will clear the
shared library cache.  (Actually it will replace the cache with the files
found in the specified directories, but since none were specified...)
Adding '-v' will not change what ldconfig does, except possibly letting
it be a bit more verbose about what happens.

ldconfig is behaving as designed and documented, so the bug, such as it is,
is in the design of ldconfig that lets you screw up the machine by simply
running ldconfig without any option.

<Insert your favourite quote here.>
Erik Trulsson
ertr1013 at

More information about the freebsd-questions mailing list