Karel Kulhavy wrote on Mon, Nov 27, 2006 at 12:03:34PM +0100:
> If someone comes to OpenBSD from Linux he is likely to fall into
> a nasty trap in OpenBSD.  He runs "ldconfig"
without any arguments
> after compiling some program as he was used to on Linux.  This will
> destroy his linker cache and he won't be able to execute any program
> anymore.

Don't panic.  /usr/lib will not be removed from the list of
configured directories.  So all of the base system except X
will still be useable.  Even if it weren't, you could still use
/bin and /sbin like after boot(8) -s.  Besides, ldconfig(8) is
statically linked, so repairing the damage is quite simple.

> What is worse, he will not be sure if the linker cache is
> regenerated on boot

Huh?

[EMAIL PROTECTED] # ldconfig              
[EMAIL PROTECTED] # /usr/X11R6/bin/xterm  
/usr/X11R6/bin/xterm: can't load library 'libSM.so.8.0'
[EMAIL PROTECTED] # grep ldconfig /etc/rc
if [ -f /sbin/ldconfig ]; then
        ldconfig $shlib_dirs

Good reason to relax, isn't it?

> or not and scared that if he reboots the machine, he will not be able
> to reboot it anymore.

When things are badly screwed things up, just boot(8) -s into single
user mode.  But destroying the hints file for the runtime linker is not
even that dangerous and easily repaired without rebooting into single
user mode, indeed without rebooting at all.

[EMAIL PROTECTED] # which which 
/usr/bin/which
[EMAIL PROTECTED] # rm -f /var/run/ld.so.hints 
[EMAIL PROTECTED] # ldconfig -r                
ldconfig: /var/run/ld.so.hints: No such file or directory
[EMAIL PROTECTED] # which which                
/usr/bin/which
[EMAIL PROTECTED] # ldconfig                   
[EMAIL PROTECTED] # ldconfig -U /usr/lib       
[EMAIL PROTECTED] # which which          
Floating point exception (core dumped) 
[EMAIL PROTECTED] # ldconfig             
[EMAIL PROTECTED] # which which 
/usr/bin/which
[EMAIL PROTECTED] # ldconfig -r | head -n2     
/var/run/ld.so.hints:
        search directories: /usr/lib

> So he may start fiddling with LD_LIBRARY_PATH to be able to launch
> some program to fix the cache. He won't be able to view even manual
> pages in such case.

You appear to have broken your system in more ways than you are
revealing to us:

[EMAIL PROTECTED] # ldconfig
[EMAIL PROTECTED] # man ldconfig | head -n1
LDCONFIG(8)             OpenBSD System Manager's Manual            LDCONFIG(8)
[EMAIL PROTECTED] # rm -f /var/run/ld.so.hints
[EMAIL PROTECTED] # man ldconfig | head -n1    
LDCONFIG(8)             OpenBSD System Manager's Manual            LDCONFIG(8)

Even killing ld.so.hints outright is not always sufficient for blocking
acces to man(1).

> This consumes a lot of time and creates a lot of frustration.
> What I suggest is:

[EMAIL PROTECTED] # . /etc/rc.conf                                              
     
[EMAIL PROTECTED] # ldconfig /usr/local/lib /usr/X11R6/lib $shlib_dirs          
     
[EMAIL PROTECTED] # exit

And don't panic.  ;-)

Reply via email to