I analyze with "ldd -v" the same shared library (copied it on NFS) from two different build hosts. Both are Ubuntu 16.04 and have as it seems the same version of ldd.
I am expecting of course to see the same output, however it differs not just a little bit. On the first build host GLIBC_2.18 is not shown in the output, but on the second one it is.
Build host #1.
$ uname -a
Linux build-nodejs01 4.4.0-174-generic #204-Ubuntu SMP Wed Jan 29 06:41:01 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
$ ldd --version
ldd (Ubuntu GLIBC 2.23-0ubuntu11) 2.23
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
$ strings /media/nfs/libtesseract.so | grep -e '^GLIBC_'
GLIBC_2.2.5
GLIBC_2.7
GLIBC_2.14
GLIBC_2.3
$ ldd -v /media/nfs/libtesseract.so | grep libc.so.
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff784308000)
libc.so.6 (GLIBC_2.7) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.14) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.3) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.14) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.3.2) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_PRIVATE) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.14) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.3) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.3.2) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_PRIVATE) => /lib/x86_64-linux-gnu/libc.so.6
/lib/x86_64-linux-gnu/libc.so.6:
libc.so.6 (GLIBC_2.14) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libc.so.6
Build host #2.
$ uname -a
Linux build-linux64-viewer04 4.4.0-143-generic #169-Ubuntu SMP Thu Feb 7 07:56:38 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
$ ldd --version
ldd (Ubuntu GLIBC 2.23-0ubuntu10) 2.23
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
$ strings /media/nfs/libtesseract.so | grep -e '^GLIBC_'
GLIBC_2.2.5
GLIBC_2.7
GLIBC_2.14
GLIBC_2.3
$ ldd -v /media/nfs/libtesseract.so | grep libc.so.
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fdb02ddd000)
libc.so.6 (GLIBC_2.7) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.14) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.3) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.14) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.3.2) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_PRIVATE) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.14) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.4) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.18) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.3.4) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.3) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.17) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.3.2) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_PRIVATE) => /lib/x86_64-linux-gnu/libc.so.6
/lib/x86_64-linux-gnu/libc.so.6:
libc.so.6 (GLIBC_2.14) => /lib/x86_64-linux-gnu/libc.so.6
libc.so.6 (GLIBC_2.2.5) => /lib/x86_64-linux-gnu/libc.so.6
The binary /usr/bin/ldd differs in md5sum on both hosts, but it should not be the cause. I have proven it this way. I copied /usr/bin/ldd from each host on NFS as /media/nfs/ldd_1, /media/nfs/ldd_2 and run both ldds from both hosts. Both ldds don't show GLIBC_2.18 on the first host, but show it on another host.
The strings output looks more reliable(host-independent) as we can see from my examples and I will use only strings from now. But I still would like to know what is the reason ldd shows different output? Is it correct?
I am expecting of course to see the same output,
You shouldn't: you have different versions of GLIBC installed: GLIBC 2.23-0ubuntu10 vs. GLIBC 2.23-0ubuntu11.
To understand the version output better, read this and/or this answer.
But how do you explain that ...
If you check the ldd you are invoking, you'll discover that it's a shell script, which sets LD_TRACE_LOADED_OBJECTS environment variable and invokes dynamic loader /lib64/ld-linux-x86-64.so.2 to do the actual work. The dynamic loader is part of GLIBC.
Different GLIBC versions installed on the two machines -> different dynamic loaders load different versions of libc-so.6 (and other parts of GLIBC) -> different output. There is nothing surprising here.
Related
I need to package a Scala app that handles REST API call and in some cases launches FireFox browser with help of Selenium WebDriver. I use sbt-native-packager, since it's convenient and simple. As a base image I use own Dockerfile:
# https://hub.docker.com/_/debian
FROM openjdk:8-jre-alpine3.9
ARG firefox_ver=70.0
ARG geckodriver_ver=0.26.0
# Download and install deps
RUN apk update && apk add curl curl-dev
# Download and install Firefox
RUN curl -fL -o /tmp/firefox.tar.bz2 https://ftp.mozilla.org/pub/firefox/releases/${firefox_ver}/linux-x86_64/en-GB/firefox-${firefox_ver}.tar.bz2 \
&& tar -xjf /tmp/firefox.tar.bz2 -C /tmp/ && mv /tmp/firefox /usr/local/bin/
# Download and install geckodriver
RUN curl -fL -o /tmp/geckodriver.tar.gz \
https://github.com/mozilla/geckodriver/releases/download/v${geckodriver_ver}/geckodriver-v${geckodriver_ver}-linux64.tar.gz \
&& tar -xzf /tmp/geckodriver.tar.gz -C /tmp/ && chmod +x /tmp/geckodriver && mv /tmp/geckodriver /usr/local/bin/
ENV PATH="/usr/local/bin/firefox:${PATH}"
And then in build.sbt I use following command in order to provide an appropriate access level to the firefox binary:
...
dockerAdditionalPermissions += (DockerChmodType.UserGroupPlusExecute, "/usr/local/bin/firefox/firefox")
...
But unfortunately when I connect to the running docker container and try to call the firefox, I get this:
/opt/docker $ firefox
sh: firefox: Permission denied
As a result, the Scala app is not able to launch FireFox as well :(
Here is permission of the firefox:
-rwxr-xr-x 1 root root 14656 Oct 16 17:55 firefox
It seems you cannot run (this version of) firefox on Alpine:
# ldd firefox
/lib64/ld-linux-x86-64.so.2 (0x7fcc15ef4000)
libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7fcc15ef4000)
libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7fcc15ef4000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7fcc15d9f000)
libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fcc15ef4000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7fcc15d8b000)
libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fcc15ef4000)
Error relocating firefox: __fprintf_chk: symbol not found
This seems to be caused by Alpine being based on musl instead of GNU libc.
To work around, you could use the firefox package available from Alpine itself (but you would still need the geckodriver to work too)... Alternatively, switch to the non-alpine Docker image.
In the process of trying to rescue an unbootable Debian Jessie system, I get the following error when trying to chroot:
chroot: failed to run command ‘/bin/bash’: No such file or directory
I have been googling around and it's supposedly related to a 64bit/32bit clash (chrooting from a 32bit into 64bit or vis a versa), yet I don't see how that could apply here since I am rescuing a 64bit system with a 64bit live-hybrid-Debian-USB-stick.
/bin/bash is in the chroot directory and so are the library depenencies, as per ldd.
Does anyone have an idea what is causing the error?
Below are my mount points, and an ls:
# mount |grep mnt
/dev/mapper/centos_vh200-root on /mnt/vh2 type ext4 (rw,relatime,data=ordered)
/dev/sda1 on /mnt/vh2/boot type ext4 (rw,relatime,data=ordered)
none on /mnt/vh2/proc type proc (rw,relatime)
devtmpfs on /mnt/vh2/dev type devtmpfs (rw,nosuid,size=10240k,nr_inodes=414264,mode=755)
sys on /mnt/vh2/sys type sysfs (rw,relatime)
# ls -l /mnt/vh2/bin/bash
-rwxr-xr-x 1 root root 1029624 Nov 12 2014 /mnt/vh2/bin/bash
This is ldd output for bash:
# ldd /mnt/vh2/bin/bash
linux-vdso.so.1 (0x00007ffd49bcc000)
libncurses.so.5 => /lib/x86_64-linux-gnu/libncurses.so.5 (0x00007fad99f1a000)
libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007fad99cf0000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fad99aec000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fad99743000)
/lib64/ld-linux-x86-64.so.2 (0x00007fad9a13f000)
Terminal session:
# mount /dev/centos_vh200/root /mnt/vh2
# mount /dev/sda1 /mnt/vh2/boot/
# mount -t proc none /mnt/vh2/proc/
# mount -o bind /dev /mnt/vh2/dev/
# mount -t sysfs sys /mnt/vh2/sys/
# chroot /mnt/vh2/ /bin/bash
chroot: failed to run command ‘/bin/bash’: No such file or directory
ldd /mnt/vh2/bin/bash is done outside chroot so it finds your live system libraries. Look for libraries in /mnt/vh2/ not in /.
I try to use mex some toolbox using matlab. But I got these errors: /usr/bin/ld: cannot find -lgfortran
I used Ubuntu 14.04. I installed gfortran. Could any one help ?
this is the output of : ldconfig -p | grep fortran
xiaoma#laptop:~$ ldconfig -p | grep fortran
libhdf5hl_fortran.so.7 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libhdf5hl_fortran.so.7
libhdf5_fortran.so.7 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libhdf5_fortran.so.7
libgfortran.so.3 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libgfortran.so.3
sudo apt-get remove postgresql
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package postgresql is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 35 not upgraded.
5 not fully installed or removed.
After this operation, 0B of additional disk space will be used.
Could not exec dpkg!
E: Sub-process /usr/bin/dpkg returned an error code (100)
It seems to be problem with dpkg. Can you try explore, if dpkg have an execute bit:
ls -l /usr/bin/dpkg
It must be like this:
-rwxr-xr-x 1 root root 249328 2011-10-06 10:04 /usr/bin/dpkg
If it have not this rights, try:
chmod 655 /usr/bin/dpkg
You can see, if there is not some missing libraries for dpkg. Try this command:
ldd /usr/bin/dpkg
You have to seen somethink like this:
ldd /usr/bin/dpkg
linux-vdso.so.1 => (0x00007fff179ff000)
libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007ff8f8439000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff8f809a000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ff8f7e95000)
/lib64/ld-linux-x86-64.so.2 (0x00007ff8f8671000)
If you have another same system as this, you can try to copy /usr/bin/dpkg from this good system...
Or you can try to check, if you have dpkg*.deb on filesystem, and try this:
cp /var/cache/apt/archives/dpkg*deb /tmp
cd /tmp
ar x dpkg*deb data.tar.gz
tar xzf data.tar.gz
cp ./usr/bin/dpkg /usr/bin/
If you will don't have a dpkg*deb file ind /var/cache/apt/archives , you will need to fetch it from repository...
Any tips how to solve this missing library problem?
In this case I'm using Sunfreeware packages, instead of compiling from source.
$ /usr/local/ssl/bin/openssl version
ld.so.1: openssl: fatal: libgcc_s.so.1: open failed: No such file or directory
Killed
$ ldd /usr/local/ssl/bin/openssl
libssl.so.1.0.0 => /usr/local/ssl/lib/libssl.so.1.0.0
libcrypto.so.1.0.0 => /usr/local/ssl/lib/libcrypto.so.1.0.0
libsocket.so.1 => /lib/libsocket.so.1
libnsl.so.1 => /lib/libnsl.so.1
libdl.so.1 => /lib/libdl.so.1
libc.so.1 => /lib/libc.so.1
libgcc_s.so.1 => (file not found)
libgcc_s.so.1 => /usr/local/lib/libgcc_s.so.1
libmp.so.2 => /lib/libmp.so.2
libmd.so.1 => /lib/libmd.so.1
libscf.so.1 => /lib/libscf.so.1
libdoor.so.1 => /lib/libdoor.so.1
libuutil.so.1 => /lib/libuutil.so.1
libgen.so.1 => /lib/libgen.so.1
libm.so.2 => /lib/libm.so.2
--- more info ---
$ uname -a
SunOS sunws04 5.10 Generic_144489-04 i86pc i386 i86pc
$ pkginfo -l SMCossl
PKGINST: SMCossl
NAME: openssl
CATEGORY: application
ARCH: x86
VERSION: 1.0.0d
BASEDIR: /usr/local
VENDOR: The OpenSSL Group
PSTAMP: Steve Christensen
INSTDATE: Jun 02 2011 12:20
EMAIL: steve#smc.vnet.net
STATUS: completely installed
FILES: 1864 installed pathnames
1 shared pathnames
43 directories
32 executables
28209 blocks used (approx)
$ echo $LD_LIBRARY_PATH
$ grep libgcc_s.so.1 /var/sadm/install/contents
/usr/local/lib/libgcc_s.so=libgcc_s.so.1 s none SMCgcc SMClgcc346
/usr/local/lib/libgcc_s.so.1 f none 0644 bin bin 158940 21764 1160370299 SMCgcc SMClgcc346
$ ldd -s /usr/local/ssl/bin/openssl
...
find object=libgcc_s.so.1; required by openssl
search path=/usr/local/ssl/lib (RPATH from file openssl)
trying path=/usr/local/ssl/lib/libgcc_s.so.1
search path=/lib:/usr/lib (default)
trying path=/lib/libgcc_s.so.1
trying path=/usr/lib/libgcc_s.so.1
libgcc_s.so.1 => (file not found)
...
find object=libgcc_s.so.1; required by /usr/local/ssl/lib/libssl.so.1.0.0
search path=/usr/local/lib:/usr/local/ssl/lib (RPATH from file /usr/local/ssl/lib/libssl.so.1.0.0)
trying path=/usr/local/lib/libgcc_s.so.1
libgcc_s.so.1 => /usr/local/lib/libgcc_s.so.1
--- grungy workaround ---
$ setrpath /usr/local/ssl/bin/openssl /usr/local/lib
Old RPATH: /usr/local/ssl/lib
New RPATH set to: /usr/local/lib
$ /usr/local/ssl/bin/openssl version
ld.so.1: openssl: fatal: libssl.so.1.0.0: open failed: No such file or directory
Killed
$ export LD_LIBRARY_PATH=/usr/local/ssl/lib
$ /usr/local/ssl/bin/openssl version
OpenSSL 1.0.0d 8 Feb 2011
--- another attempt fails ---
$ unset LD_LIBRARY_PATH
$ setrpath /usr/local/ssl/bin/openssl /usr/local/lib:/usr/local/ssl/lib
Old RPATH: /usr/local/lib
New RPATH would be longer than current RPATH.
(Use -f to use any extra space in string table)
$ setrpath -f /usr/local/ssl/bin/openssl /usr/local/lib:/usr/local/ssl/lib
Old RPATH: /usr/local/lib
New RPATH set to: /usr/local/lib:/usr/local/ssl/lib
$ /usr/local/ssl/bin/openssl version
ld.so.1: openssl: fatal: relocation error: file openssl: symbol /local/ssl/lib: referenced symbol not found
Killed
or
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/csw/lib:/usr/local/lib:/usr/sfw/lib
export LD_LIBRARY_PATH
in /etc/profile
the correct order of the library-Paths playes a role for all programms.
Check the functionality like:
ldd /usr/local/ssl/bin/openssl
libssl.so.1.0.0 => /usr/local/ssl/lib/libssl.so.1.0.0
libcrypto.so.1.0.0 => /usr/local/ssl/lib/libcrypto.so.1.0.0
libsocket.so.1 => /lib/libsocket.so.1
libnsl.so.1 => /lib/libnsl.so.1
libdl.so.1 => /lib/libdl.so.1
libc.so.1 => /lib/libc.so.1
libgcc_s.so.1 => /usr/local/lib/libgcc_s.so.1
libmp.so.2 => /lib/libmp.so.2
libmd.so.1 => /lib/libmd.so.1
libscf.so.1 => /lib/libscf.so.1
libdoor.so.1 => /lib/libdoor.so.1
libuutil.so.1 => /lib/libuutil.so.1
libgen.so.1 => /lib/libgen.so.1
libm.so.2 => /lib/libm.so.2
/lib/libm/libm_hwcap1.so.2
/platform/SUNW,SPARC-Enterprise/lib/libc_psr.so.1
or you can:
ln -s /usr/local/lib/libgcc_s.so.1 /usr/lib/libgcc_s.so.1
Works for me :)
# /usr/local/ssl/bin/openssl version
OpenSSL 1.0.0d 8 Feb 2011
I had the exact same issue with sudo. I tried and had no luck. I was actually to the point of being ready to install a patch to get this corrected. Then I found out that I was using two different versions of the sudo package that I downloaded from sunfreeware.com. The 1.8.1p2 vs the 1.8.3p2. I deleted the file, transferred out the new file and was good to go. I know this answer sounds dumb, but I was stuck without an answer for about a week or so only to find out it was my bad.