[lug] A head scratcher for your weekend

Lee Woodworth blug-mail at duboulder.com
Thu May 24 01:54:33 MDT 2018


On 05/23/2018 10:02 PM, Matt Bidwell wrote:
> Sorry for the delay in replying. Going to reply to the last two emails in one email.
> OK, the suggestion to try another qt based program was a good one. Mythfrontend obviously 
> also didn't work. Installed k3b, and it also gave the same library message.
> 
> The output of ldd against /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.10.1 and 
> /usr/lib/x86_64-linux-gnu/libQt5Core.so.5  is the same run by root or non root users. 
> Nothing missing shows up.
> 
> I've rebooted a few times now. If only it could be that simple.
> 
> $ ls -alh /usr/lib/x86_64-linux-gnu/libQt5Core.so.5*
> lrwxrwxrwx 1 root root   20 May 20 15:57 /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 -> 
> libQt5Core.so.5.10.1
> lrwxrwxrwx 1 root root   20 May 20 15:57 /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.10 -> 
> libQt5Core.so.5.10.1
> -rw-r--r-- 1 root root 5.0M May 20 15:57 /usr/lib/x86_64-linux-gnu/libQt5Core.so.5.10.1

The first lookup pass for libQt5Core reads
     /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
and succeeds.

The second time the last open attempt is
     /usr/lib/libQt5Core.so.5
and
     /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
is not tried. It would help to know what triggered
the second lookup and why it doesn't include
    /usr/lib/x86_64-linux-gnu

I found some info on the lookup process is in man ld.so.
Did you already try setting LD_LIBRARY_PATH to include
/usr/lib/x86_64-linux-gnu?

-----------------------------------------------------

Do you know what multiarch means for debian(ish) distros?
   $ cat /etc/ld.so.conf.d/x86_64-linux-gnu.conf
   # Multiarch support
   /lib/x86_64-linux-gnu
   /usr/lib/x86_64-linux-gnu
Is this related to ABI_32 / ABI_64? It is curious that these
directories are not searched the second time.


> 
> 
> If you've read this far, you really wanted to see the redelf output
> $ readelf -e /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
> ELF Header:
>    Magic:   7f 45 4c 46 02 01 01 03 00 00 00 00 00 00 00 00
>    Class:                             ELF64
>    Data:                              2's complement, little endian
>    Version:                           1 (current)
>    OS/ABI:                            UNIX - GNU
>    ABI Version:                       0
>    Type:                              DYN (Shared object file)
>    Machine:                           Advanced Micro Devices X86-64
>    Version:                           0x1
>    Entry point address:               0x96740
>    Start of program headers:          64 (bytes into file)
>    Start of section headers:          5222704 (bytes into file)
>    Flags:                             0x0
>    Size of this header:               64 (bytes)
>    Size of program headers:           56 (bytes)
>    Number of program headers:         11
>    Size of section headers:           64 (bytes)
>    Number of section headers:         32
>    Section header string table index: 31
> 
> Section Headers:
>    [Nr] Name              Type             Address           Offset
>         Size              EntSize          Flags  Link  Info  Align
>    [ 0]                   NULL             0000000000000000  00000000
>         0000000000000000  0000000000000000           0     0     0
>    [ 1] .note.gnu.build-i NOTE             00000000000002a8  000002a8
>         0000000000000024  0000000000000000   A       0     0     4
>    [ 2] .gnu.hash         GNU_HASH         00000000000002d0  000002d0
>         00000000000088a8  0000000000000000   A       3     0     8
>    [ 3] .dynsym           DYNSYM           0000000000008b78  00008b78
>         00000000000232f8  0000000000000018   A       4     1     8
>    [ 4] .dynstr           STRTAB           000000000002be70  0002be70
>         0000000000036080  0000000000000000   A       0     0     1
>    [ 5] .gnu.version      VERSYM           0000000000061ef0  00061ef0
>         0000000000002eea  0000000000000002   A       3     0     2
>    [ 6] .gnu.version_d    VERDEF           0000000000064de0  00064de0
>         00000000000001e0  0000000000000000   A       4    14     8
>    [ 7] .gnu.version_r    VERNEED          0000000000064fc0  00064fc0
>         0000000000000210  0000000000000000   A       4     7     8
>    [ 8] .rela.dyn         RELA             00000000000651d0  000651d0
>         0000000000017850  0000000000000018   A       3     0     8
>    [ 9] .rela.plt         RELA             000000000007ca20  0007ca20
>         0000000000001bc0  0000000000000018  AI       3    27     8
>    [10] .init             PROGBITS         000000000007e5e0  0007e5e0
>         0000000000000017  0000000000000000  AX       0     0     4
>    [11] .plt              PROGBITS         000000000007e600  0007e600
>         0000000000001290  0000000000000010  AX       0     0     16
>    [12] .plt.got          PROGBITS         000000000007f890  0007f890
>         0000000000000008  0000000000000008  AX       0     0     8
>    [13] .text             PROGBITS         000000000007f8a0  0007f8a0
>         00000000002c0b82  0000000000000000  AX       0     0     16
>    [14] .fini             PROGBITS         0000000000340424  00340424
>         0000000000000009  0000000000000000  AX       0     0     4
>    [15] .rodata           PROGBITS         0000000000340440  00340440
>         000000000012f888  0000000000000000   A       0     0     32
>    [16] .interp           PROGBITS         000000000046fcd0  0046fcd0
>         000000000000001c  0000000000000000   A       0     0     16
>    [17] .eh_frame_hdr     PROGBITS         000000000046fcec  0046fcec
>         000000000000eeac  0000000000000000   A       0     0     4
>    [18] .eh_frame         PROGBITS         000000000047eb98  0047eb98
>         000000000005a0b0  0000000000000000   A       0     0     8
>    [19] .gcc_except_table PROGBITS         00000000004d8c48  004d8c48
>         0000000000014ed7  0000000000000000   A       0     0     4
>    [20] .note.ABI-tag     NOTE             00000000004edb20  004edb20
>         0000000000000020  0000000000000000   A       0     0     4
>    [21] .tbss             NOBITS           00000000006ee750  004ee750
>         0000000000000010  0000000000000000 WAT       0     0     8
>    [22] .init_array       INIT_ARRAY       00000000006ee750  004ee750
>         0000000000000020  0000000000000008  WA       0     0     8
>    [23] .fini_array       FINI_ARRAY       00000000006ee770  004ee770
>         0000000000000010  0000000000000008  WA       0     0     8
>    [24] .data.rel.ro      PROGBITS         00000000006ee780  004ee780
>         000000000000ac60  0000000000000000  WA       0     0     32
>    [25] .dynamic          DYNAMIC          00000000006f93e0  004f93e0
>         00000000000002b0  0000000000000010  WA       4     0     8
>    [26] .got              PROGBITS         00000000006f9690  004f9690
>         0000000000000958  0000000000000008  WA       0     0     8
>    [27] .got.plt          PROGBITS         00000000006fa000  004fa000
>         0000000000000958  0000000000000008  WA       0     0     8
>    [28] .data             PROGBITS         00000000006fa960  004fa960
>         0000000000000664  0000000000000000  WA       0     0     32
>    [29] .bss              NOBITS           00000000006fb000  004fafc4
>         0000000000004000  0000000000000000  WA       0     0     64
>    [30] .gnu_debuglink    PROGBITS         0000000000000000  004fafc4
>         0000000000000034  0000000000000000           0     0     4
>    [31] .shstrtab         STRTAB           0000000000000000  004faff8
>         0000000000000131  0000000000000000           0     0     1
> Key to Flags:
>    W (write), A (alloc), X (execute), M (merge), S (strings), I (info),
>    L (link order), O (extra OS processing required), G (group), T (TLS),
>    C (compressed), x (unknown), o (OS specific), E (exclude),
>    l (large), p (processor specific)
> 
> Program Headers:
>    Type           Offset             VirtAddr           PhysAddr
>                   FileSiz            MemSiz              Flags  Align
>    PHDR           0x0000000000000040 0x0000000000000040 0x0000000000000040
>                   0x0000000000000268 0x0000000000000268  R      0x8
>    INTERP         0x000000000046fcd0 0x000000000046fcd0 0x000000000046fcd0
>                   0x000000000000001c 0x000000000000001c  R      0x10
>        [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
>    LOAD           0x0000000000000000 0x0000000000000000 0x0000000000000000
>                   0x00000000004edb40 0x00000000004edb40  R E    0x200000
>    LOAD           0x00000000004ee750 0x00000000006ee750 0x00000000006ee750
>                   0x000000000000c874 0x00000000000108b0  RW     0x200000
>    DYNAMIC        0x00000000004f93e0 0x00000000006f93e0 0x00000000006f93e0
>                   0x00000000000002b0 0x00000000000002b0  RW     0x8
>    NOTE           0x00000000000002a8 0x00000000000002a8 0x00000000000002a8
>                   0x0000000000000024 0x0000000000000024  R      0x4
>    NOTE           0x00000000004edb20 0x00000000004edb20 0x00000000004edb20
>                   0x0000000000000020 0x0000000000000020  R      0x4
>    TLS            0x00000000004ee750 0x00000000006ee750 0x00000000006ee750
>                   0x0000000000000000 0x0000000000000010  R      0x8
>    GNU_EH_FRAME   0x000000000046fcec 0x000000000046fcec 0x000000000046fcec
>                   0x000000000000eeac 0x000000000000eeac  R      0x4
>    GNU_STACK      0x0000000000000000 0x0000000000000000 0x0000000000000000
>                   0x0000000000000000 0x0000000000000000  RW     0x10
>    GNU_RELRO      0x00000000004ee750 0x00000000006ee750 0x00000000006ee750
>                   0x000000000000b8b0 0x000000000000b8b0  R      0x1
> 
>   Section to Segment mapping:
>    Segment Sections...
>     00
>     01     .interp
>     02     .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_d 
> .gnu.version_r .rela.dyn .rela.plt .init .plt .plt.got .text .fini .rodata .interp 
> .eh_frame_hdr .eh_frame .gcc_except_table .note.ABI-tag
>     03     .init_array .fini_array .data.rel.ro .dynamic .got .got.plt .data .bss
>     04     .dynamic
>     05     .note.gnu.build-id
>     06     .note.ABI-tag
>     07     .tbss
>     08     .eh_frame_hdr
>     09
>     10     .init_array .fini_array .data.rel.ro .dynamic .got
> 
> You will all be happy to know both the library and executable little endian.
> 
> 
> I thought the beginning of the strace was pretty interesting:
> execve("/usr/bin/mythbackend", ["/usr/bin/mythbackend"], 0x7fffc6393f30 /* 19 vars */) = 0
> brk(NULL)                               = 0x7faff5f4e000
> access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
> access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
> 
> .....
> And here's the first appearance of the libQt library to the end of the end of the strace:
> openat(AT_FDCWD, "/lib/libQt5Core.so.5", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or 
> directory)
> openat(AT_FDCWD, "/usr/lib/tls/libQt5Core.so.5", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such 
> file or directory)
> openat(AT_FDCWD, "/usr/lib/libQt5Core.so.5", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file 
> or directory)
> openat(AT_FDCWD, "/usr/local/lib/libQt5Core.so.5", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No 
> such file or directory)
> openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libQt5Core.so.5", O_RDONLY|O_CLOEXEC) = 3
> read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 at g\t\0\0\0\0\0"..., 832) = 832
> lseek(3, 5167904, SEEK_SET)             = 5167904
> read(3, "\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\3\0\0\0\21\0\0\0\0\0\0\0", 32) = 32
> close(3)                                = 0
> access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
> openat(AT_FDCWD, "/lib/x86_64-linux-gnu/tls/x86_64/x86_64/libQt5Core.so.5", 
> O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
> stat("/lib/x86_64-linux-gnu/tls/x86_64/x86_64", 0x7fff9b396bc0) = -1 ENOENT (No such file 
> or directory)
> openat(AT_FDCWD, "/lib/x86_64-linux-gnu/tls/x86_64/libQt5Core.so.5", O_RDONLY|O_CLOEXEC) = 
> -1 ENOENT (No such file or directory)
> stat("/lib/x86_64-linux-gnu/tls/x86_64", 0x7fff9b396bc0) = -1 ENOENT (No such file or 
> directory)
> openat(AT_FDCWD, "/lib/x86_64-linux-gnu/tls/x86_64/libQt5Core.so.5", O_RDONLY|O_CLOEXEC) = 
> -1 ENOENT (No such file or directory)
> stat("/lib/x86_64-linux-gnu/tls/x86_64", 0x7fff9b396bc0) = -1 ENOENT (No such file or 
> directory)
> openat(AT_FDCWD, "/lib/x86_64-linux-gnu/tls/libQt5Core.so.5", O_RDONLY|O_CLOEXEC) = -1 
> ENOENT (No such file or directory)
> stat("/lib/x86_64-linux-gnu/tls", 0x7fff9b396bc0) = -1 ENOENT (No such file or directory)
> openat(AT_FDCWD, "/lib/x86_64-linux-gnu/x86_64/x86_64/libQt5Core.so.5", 
> O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
> stat("/lib/x86_64-linux-gnu/x86_64/x86_64", 0x7fff9b396bc0) = -1 ENOENT (No such file or 
> directory)
> openat(AT_FDCWD, "/lib/x86_64-linux-gnu/x86_64/libQt5Core.so.5", O_RDONLY|O_CLOEXEC) = -1 
> ENOENT (No such file or directory)
> stat("/lib/x86_64-linux-gnu/x86_64", 0x7fff9b396bc0) = -1 ENOENT (No such file or directory)
> openat(AT_FDCWD, "/lib/x86_64-linux-gnu/x86_64/libQt5Core.so.5", O_RDONLY|O_CLOEXEC) = -1 
> ENOENT (No such file or directory)
> stat("/lib/x86_64-linux-gnu/x86_64", 0x7fff9b396bc0) = -1 ENOENT (No such file or directory)
> openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libQt5Core.so.5", O_RDONLY|O_CLOEXEC) = -1 ENOENT 
> (No such file or directory)
> stat("/lib/x86_64-linux-gnu", {st_mode=S_IFDIR|0755, st_size=16384, ...}) = 0
> openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libQt5Core.so.5", O_RDONLY|O_CLOEXEC) = 3
> read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 at g\t\0\0\0\0\0"..., 832) = 832
> lseek(3, 5167904, SEEK_SET)             = 5167904
> read(3, "\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\3\0\0\0\21\0\0\0\0\0\0\0", 32) = 32
> close(3)                                = 0
> openat(AT_FDCWD, "/lib/libQt5Core.so.5", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or 
> directory)
> openat(AT_FDCWD, "/usr/lib/tls/libQt5Core.so.5", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such 
> file or directory)
> openat(AT_FDCWD, "/usr/lib/libQt5Core.so.5", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file 
> or directory)
> writev(2, [{iov_base="/usr/bin/mythbackend", iov_len=20}, {iov_base=": ", iov_len=2}, 
> {iov_base="error while loading shared libra"..., iov_len=36}, {iov_base=": ", iov_len=2}, 
> {iov_base="libQt5Core.so.5", iov_len=15}, {iov_base=": ", iov_len=2}, {iov_base="cannot 
> open shared object file", iov_len=30}, {iov_base=": ", iov_len=2}, {iov_base="No such file 
> or directory", iov_len=25}, {iov_base="\n", iov_len=1}], 10) = 135
> exit_group(127)                         = ?
> +++ exited with 127 +++
> 
> 
> Sorry for the length. Thanks for the help. -Matt
> 
> 
> 
> On 05/21/2018 06:49 PM, Louis Krupp wrote:
>> On the off chance that there's something in the library that the system doesn't like, 
>> can you do this?
>>
>> readelf -e <path to library>
>>
>> And would it be too much trouble to capture more of the stat calls?
>>
>> And -- last -- on the off chance that something has changed, what does this do now?:
>>
>> ls -alh /usr/lib/x86_64-linux-gnu/libQt5Core.so.5*
>>
>> Louis
>>
>>
>>
>> On Mon, May 21, 2018 at 5:34 AM, Matt Bidwell <mbidwell at gmail.com 
>> <mailto:mbidwell at gmail.com>> wrote:
>>
>>     It appears to stat it many times. Here's the last one:
>>     stat("/lib/x86_64-linux-gnu", {st_mode=S_IFDIR|0755, st_size=16384,
>>     ...}) = 0
>>     openat(AT_FDCWD, "/usr/lib/x86_64-linux-gnu/libQt5Core.so.5",
>>     O_RDONLY|O_CLOEXEC) = 3
>>     read(3,
>>     "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 at g\t\0\0\0\0\0"...,
>>     832) = 832
>>     lseek(3, 5167904, SEEK_SET)             = 5167904
>>     read(3,
>>     "\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\3\0\0\0\21\0\0\0\0\0\0\0",
>>     32) = 32
>>     close(3)                                = 0
>>
>>     Here's wht ldconfig -p get's me.
>>     # ldconfig -p | grep libQt5Core.so.5
>>              libQt5Core.so.5 (libc6,x86-64, OS ABI: Linux 3.17.0) =>
>>     /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
>>
>>     I really do appreciate the help. There were some Qt package updates
>>     this morning including libqt5core5a. Updating them didn't fix
>>     anything but I may dig through the change logs later. -Matt
>>
>>
>>     On 05/20/2018 08:30 PM, Davide Del Vento wrote:
>>
>>         In the strace output, is there any attempt to load any of the
>>         /usr/lib/x86_64-linux-gnu/libQt5Core.so.5* ?
>>         If so, you should get the clue we're after.
>>         If not, that's the weirdness, especially if it shows (succeeding)
>>         attempts to load /usr/lib/x86_64-linux-gnu/libQt5Script.so.5 as the
>>         ldd suggests.
>>
>>         On Sun, May 20, 2018 at 6:49 PM, Zan Lynx <zlynx at acm.org
>>         <mailto:zlynx at acm.org>> wrote:
>>
>>             On 5/20/2018 4:46 PM, Matt Bidwell wrote:
>>
>>
>>                 openat(AT_FDCWD, "/usr/lib/libQt5Core.so.5",
>>                 O_RDONLY|O_CLOEXEC) = 3
>>
>>
>>
>>             This one is not in the 64-bit library location so it is
>>             rejected for loading
>>             into a 64-bit program. At least if it is following the usual
>>             Linux
>>             distribution file locations.
>>
>>             --
>>                               Knowledge is Power -- Power Corrupts
>>                                       Study Hard -- Be Evil
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: irc.hackingsociety.org port=6667 channel=#hackingsociety



More information about the LUG mailing list