user1578872
user1578872

Reputation: 9018

Error while loading shared libraries: libssl.so.10: cannot open shared object file in Docker

I am trying to build an image with stunnel.

My base image OS is,

Linux 2338b11efbe1 4.9.93-linuxkit-aufs #1 SMP Wed Jun 6 16:55:56 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Installing libssl as below.

RUN apt-get -y update
RUN apt-get -y install libssl1.0.0 libssl-dev && \
    ln -s libssl.so.1.0.0 libssl.so.10 && \
    ln -s libcrypto.so.1.0.0 libcrypto.so.10

Below command lists the libs.

RUN ls libssl.so.* libcrypto.so*

Output ------>>>

libcrypto.so.10
libssl.so.10

Still, below command fails.

RUN ./stunnel

Error :-

./stunnel: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory

Am i missing any other instruction here.

Here is my complete dockerfile.

from <BASE_IMAGE>
COPY stunnel .
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get -y update && \
    apt-get -y install libssl1.0.0 libssl-dev && \
    ln -s libssl.so.1.0.0 libssl.so.10 && \
    ln -s libcrypto.so.1.0.0 libcrypto.so.10
RUN ./stunnel

Upvotes: 2

Views: 29046

Answers (3)

Dawood F.M Kaundama
Dawood F.M Kaundama

Reputation: 111

I had a similar error when I installed RStudio on Ubuntu 19.10. It complained not finding libssl.so.1.0.0 and libcrypto.so.1.0.0. After sometime, I tried to locate if these files where installed on my system as trying to install them manually never worked. I used the locate command like so: locate libssl

This image shows the output of the locate command

The output showed that the 'missing' libraries were actually installed on my system. Then I tried to look in the lib (that is /lib/ directory) folder but never found these files. So I tried to copy them inferring their paths from the output of the locate command into the /lib/ directory as follows:

$sudo cp /snap/core/7917/lib/x86_64-linux-gnu/libssl.so.1.0.0 /lib/

I did the same for the libcrypto.so.1.0.0 lib file.

Then I tried to run RStudio again and it worked.

I hope this helps you. But be careful that you don't overwrite any files, otherwise you may end up with an unstable system.

Upvotes: 1

lyrax
lyrax

Reputation: 1

Just download the binary package file from this link https://rosa.pkgs.org/2014.1/rosa-main-updates-x86_64/lib64crypto1.0.0-1.0.2q-1-rosa2014.1.x86_64.rpm.html and copy the libcrypto.so.1.0.0 file to /usr/lib That solves the problem!

Upvotes: 0

user268396
user268396

Reputation: 11966

The failure mode suggests that your libssl.so.10 is a broken symlink. Meaning the file libssl.so.1.0.0 does not exist.

A command such as ln -s libssl.so.1.0.0 libssl.so.10 will succeed even if the target of the symlink does not (yet) exist. Plain ls on the broken symlinks will not report anything untoward either.

If you want to be sure the symlinks are not broken, check each symlink with test -e.

More specifically using ln -s libssl.so.1.0.0 libssl.so.10 as some kind of 'fix' indicates you have other issues: the version component of a soname consists of abi-version.patch-level.backwards-compatibility fields and this is used by the loader to determine whether or not a given library file (symlinked or otherwise) could possibly match the library requested by the application. As you can see, using ln you are claiming that ABI version 1 is the same as ABI version 10. That may not work as expected.

Finally, your ln commands use relative paths so you are probably working in the wrong directory -- hence why you end up creating broken symlinks. On Debian based systems libssl.so can typically be found in /usr/lib/x86_64-linux-gnu/. The x86_64-linux-gnu bit depends on architecture (as defined by Debian multi arch support), this particular example is valid for 64 bit x86 code.

Upvotes: 1

Related Questions