LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-24-2020, 12:44 PM   #1
BCarey
Senior Member
 
Registered: Oct 2005
Location: New Mexico
Distribution: Slackware
Posts: 1,639

Rep: Reputation: Disabled
problem with ldconfig


Hi,

So a while back I was having problems with installpkg hanging. I finally got back to this and isolated the problem to the ldconfig part of installpkg. Lo and behold running ldconfig hung. So I tried the various directories in ldconfig.conf with -n and all of them ran fine except one, /usr/lib64, which hangs. Any ideas where I can go from here?

Thanks
 
Old 01-24-2020, 01:35 PM   #2
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-14.2.1.2 on Lenovo Thinkpad W520
Posts: 9,218

Rep: Reputation: Disabled
Is ldconfig.conf a file you wrote or do you actually mean the file /etc/ld.so.conf? Anyway I don't observe this behavior here, ldconfig runs usually instantly.
 
Old 01-24-2020, 01:38 PM   #3
BCarey
Senior Member
 
Registered: Oct 2005
Location: New Mexico
Distribution: Slackware
Posts: 1,639

Original Poster
Rep: Reputation: Disabled
Sorry, I meant ld.so.conf.

Last edited by BCarey; 01-24-2020 at 01:47 PM.
 
Old 01-24-2020, 03:55 PM   #4
volkerdi
Slackware Maintainer
 
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 1,856

Rep: Reputation: 5998Reputation: 5998Reputation: 5998Reputation: 5998Reputation: 5998Reputation: 5998Reputation: 5998Reputation: 5998Reputation: 5998Reputation: 5998Reputation: 5998
This is just a shot in the dark, but maybe your ld.so.cache has become corrupted?

You could try this:
Code:
rm /etc/ld.so.cache
ldconfig
 
Old 01-24-2020, 04:03 PM   #5
volkerdi
Slackware Maintainer
 
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 1,856

Rep: Reputation: 5998Reputation: 5998Reputation: 5998Reputation: 5998Reputation: 5998Reputation: 5998Reputation: 5998Reputation: 5998Reputation: 5998Reputation: 5998Reputation: 5998
Another thought is that perhaps a library in /usr/lib64 has become corrupted. While this one-liner can't guarantee there are no corrupted files, it would at least point out any that are corrupted enough that "file" no longer sees them as ELF objects:

Code:
file /usr/lib64/*.so.* | grep -v ELF | grep -v symbolic | grep -v Python
 
Old 01-25-2020, 11:59 AM   #6
BCarey
Senior Member
 
Registered: Oct 2005
Location: New Mexico
Distribution: Slackware
Posts: 1,639

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by volkerdi View Post
This is just a shot in the dark, but maybe your ld.so.cache has become corrupted?

You could try this:
Code:
rm /etc/ld.so.cache
ldconfig
Thank you so much for responding to this. Unfortunately I already tried this and it did not help.
 
Old 01-25-2020, 12:03 PM   #7
BCarey
Senior Member
 
Registered: Oct 2005
Location: New Mexico
Distribution: Slackware
Posts: 1,639

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by volkerdi View Post
Another thought is that perhaps a library in /usr/lib64 has become corrupted. While this one-liner can't guarantee there are no corrupted files, it would at least point out any that are corrupted enough that "file" no longer sees them as ELF objects:

Code:
file /usr/lib64/*.so.* | grep -v ELF | grep -v symbolic | grep -v Python
Again thanks for your help (I'm honored really). I ran this and there was no output. I've been manually testing groups of these libraries but haven't come up yet with any that hang, but I'm not done.
 
Old 01-25-2020, 05:13 PM   #8
crts
Senior Member
 
Registered: Jan 2010
Posts: 1,845

Rep: Reputation: 629Reputation: 629Reputation: 629Reputation: 629Reputation: 629Reputation: 629
Here are a few more ideas.
First, please ensure that the harddisk is not failing and the delay is caused by some faulty I/O operation. You probably would have noticed during normal operation but let us get this out of the way, anyway.
Second, are you by any chance in a VM? I do recall some time ago to have experienced a similar issue when running slackware in virtualbox.

With the above out of the way I came up with three scripts that may help you diagnose the problem. For a better overview I will post them in three separate posts instead of making one huge bulky post.

All scripts must NOT be run as root. All scripts expect the library directory to check as parameter $1. All scripts will produce a logfile which will store the library name and the elapsed time (milliseconds) it took to process aforementioned library.

You can use the elapsed time to determine which libraries take the longest to process and possibly cause 'ldconfig' to hang.

Last edited by crts; 01-25-2020 at 05:16 PM.
 
Old 01-25-2020, 05:13 PM   #9
crts
Senior Member
 
Registered: Jan 2010
Posts: 1,845

Rep: Reputation: 629Reputation: 629Reputation: 629Reputation: 629Reputation: 629Reputation: 629
Script number #1

Script number #1 will run 'ldconfig' on every library in the folder specified in parameter $1.
I *think* when the -l option is passed to 'ldfonfig' then it will not update the cache, however, it will try to update the links. In addition to running the script as normal user the '-NX' option will ensure that neither happens, so nothing should be updated and/or break.
The resuls will be stored in a file called 'ldconf.log' in the current folder (see below for sample output).

Code:
#!/bin/bash

if (( $(id -u) == 0 || $(id -g) == 0 ));then
        echo "Please do NOT run this script as root or any priviledged user"
        exit 1
fi

if [[ ! -d "$1" ]];then
        echo "Please specify a directory to check"
        exit 2
fi

declare -i millis

update_millis() {
        local -i nanos=$(date '+%s%N')
        # nanos to millis
        millis=${nanos:0:${#nanos}-6}
}

delta_stamp() {
        local -r last=$millis
        update_millis
        echo "=== $1 Elapsed: $(( millis - last )) ms ==="
}

exec &>ldconf.log

update_millis
while read l;do
        /sbin/ldconfig -vNXl "$l"
        delta_stamp "$l"
done < <(find "$1" -type f -name '*.so.*')
Sample output:
Code:
        libsmartcols.so.1 -> libsmartcols.so.1.1.0
=== /lib64/libsmartcols.so.1.1.0 Elapsed: 21 ms ===
        libpcreposix.so.0 -> libpcreposix.so.0.0.4
=== /lib64/libpcreposix.so.0.0.4 Elapsed: 13 ms ===
        libulockmgr.so.1 -> libulockmgr.so.1.0.1
=== /lib64/libulockmgr.so.1.0.1 Elapsed: 13 ms ===
...
It simply lists the symbolic link it would have created.
 
Old 01-25-2020, 05:14 PM   #10
crts
Senior Member
 
Registered: Jan 2010
Posts: 1,845

Rep: Reputation: 629Reputation: 629Reputation: 629Reputation: 629Reputation: 629Reputation: 629
Script number #2

Script number #2 will use the dynamic linker to verify the library and try to list its dependencies. If the library is corrupted then this might diagnose it. The results will be stored in a logfile called 'ld.so.log' in the current directory.

Code:
#!/bin/bash

if (( $(id -u) == 0 || $(id -g) == 0 ));then
        echo "Please do NOT run this script as root or any priviledged user"
        exit 1
fi

if [[ ! -d "$1" ]];then
        echo "Please specify a directory to check"
        exit 2
fi

declare -i millis

update_millis() {
        local -i nanos=$(date '+%s%N')
        # nanos to millis
        millis=${nanos:0:${#nanos}-6}
}

delta_stamp() {
        local -r last=$millis
        update_millis
        echo "=== $1 Elapsed: $(( millis - last )) ms ==="
}

exec &>ld.so.log

LDSO="/lib64/ld-linux-x86-64.so.2"
if [[ ! -x $LDSO ]];then
        echo "Sorry, $LDSO was not found." >&2
        exit 1
fi

update_millis
while read l;do
        $LDSO --verify "$l"
        echo -n "$l             "
        [[ $? = [02] ]] && echo "OK" || echo "UNVERIFIED"
        $LDSO --list "$l"
        [[ $? = [0] ]] || echo "FAILED to list shared libs."
        delta_stamp "$l"
done < <(find "$1" -type f -name '*.so.*')
Sample output:

Code:
/lib64/libsmartcols.so.1.1.0            OK
        linux-vdso.so.1 (0x00007ffc25fc3000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fc08abdf000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fc08b1cb000)
=== /lib64/libsmartcols.so.1.1.0 Elapsed: 18 ms ===
/lib64/libpcreposix.so.0.0.4            OK
        linux-vdso.so.1 (0x00007fff1c88d000)
        libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f39e80c8000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f39e7eab000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f39e7ae2000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f39e853d000)
=== /lib64/libpcreposix.so.0.0.4 Elapsed: 9 ms ===
...
The result of the verification check and a list of dependencies for each checked library are logged.

Last edited by crts; 01-25-2020 at 05:41 PM.
 
Old 01-25-2020, 05:14 PM   #11
crts
Senior Member
 
Registered: Jan 2010
Posts: 1,845

Rep: Reputation: 629Reputation: 629Reputation: 629Reputation: 629Reputation: 629Reputation: 629
Script number #3

Script number #3 uses 'ldd' to check the dependencies of each library. The results will be stored in a logfile called 'ldd.log' in the current folder.

IMPORTANT:
Here is a verbatim warning from the manpage of 'ldd':
Quote:
Security
In the usual case, ldd invokes the standard dynamic linker (see ld.so(8)) with the
LD_TRACE_LOADED_OBJECTS environment variable set to 1, which causes the linker to
display the library dependencies. Be aware, however, that in some circumstances,
some versions of ldd may attempt to obtain the dependency information by directly
executing the program. Thus, you should never employ ldd on an untrusted executable,
since this may result in the execution of arbitrary code.
Since we may be dealing with potentially corrupted libraries, there is a small chance the execution of such library may damage the system. Even though that chance may be practically negligible and a corrupted library will most probably just segfault, it is still something to be aware of before proceeding.

Code:
#!/bin/bash

if (( $(id -u) == 0 || $(id -g) == 0 ));then
        echo "Please do NOT run this script as root or any priviledged user"
        exit 1
fi

if [[ ! -d "$1" ]];then
        echo "Please specify a directory to check"
        exit 2
fi

declare -i millis

update_millis() {
        local -i nanos=$(date '+%s%N')
        # nanos to millis
        millis=${nanos:0:${#nanos}-6}
}

delta_stamp() {
        local -r last=$millis
        update_millis
        echo "=== $1 Elapsed: $(( millis - last )) ms ==="
}

exec &>ldd.log

update_millis
while read l;do
        ldd "$l"
        [[ $? = [0] ]] || echo "FAILED to list shared libs."
        delta_stamp "$l"
done < <(find "$1" -type f -name '*.so.*')
Sample output:

Code:
        linux-vdso.so.1 (0x00007fff0b3b6000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fe4fd986000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fe4fdf72000)
=== /lib64/libsmartcols.so.1.1.0 Elapsed: 29 ms ===
        linux-vdso.so.1 (0x00007ffef144a000)
        libpcre.so.1 => /lib64/libpcre.so.1 (0x00007ff481aa5000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007ff481888000)
        libc.so.6 => /lib64/libc.so.6 (0x00007ff4814bf000)
        /lib64/ld-linux-x86-64.so.2 (0x00007ff481f1a000)
=== /lib64/libpcreposix.so.0.0.4 Elapsed: 23 ms ===
Just the dependencies of each library.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
strange problem: libstdc++-libc6.1-2.so.3 not able to be shown in ldconfig -p output? quokkas Linux - Software 10 04-01-2010 10:54 PM
ldconfig problem redhatanirban Linux - Newbie 4 12-12-2009 11:30 PM
ldconfig problem - no config file!! 3saul Programming 2 08-23-2006 05:44 PM
ldconfig problem ag20 Slackware 4 01-13-2006 05:27 PM
ldconfig problem don_dimo Linux - Software 2 06-17-2004 12:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration