Error while loading shared libraries libssl so

it doesn't matter what I type in combination with 'openssl', I always get the following error message: 'openssl: error while loading shared libraries: libssl.so.3: cannot open shared object file:...

it doesn’t matter what I type in combination with ‘openssl’, I always get the following error message:

'openssl: error while loading shared libraries: libssl.so.3: cannot open shared object file: No such file or directory'

I have no idea how to fix that issue after reading many questions asked in this and in other forums.

Naresh's user avatar

Naresh

16k6 gold badges105 silver badges112 bronze badges

asked Jan 10, 2019 at 8:53

M. L.'s user avatar

2

ldconfig /usr/local/lib64/

with compilation from sourecs:

./Configure
make
make install
ldconfig /usr/local/lib64/

You could add /usr/local/lib64/ path to your linker parmanently. In some linux distros it isn’t added. Check this ansver

answered Nov 8, 2021 at 7:49

Eugene Lopatkin's user avatar

4

I solved it that time only by creating a symlink and rebuilding the ldconfig cache.

ln -s libssl.so.3 libssl.so
sudo ldconfig

jncraton's user avatar

jncraton

8,9023 gold badges34 silver badges49 bronze badges

answered Feb 28, 2020 at 10:29

M. L.'s user avatar

M. L.M. L.

4291 gold badge4 silver badges8 bronze badges

2

I had the same issue after installing Openssl 3.0. I resolved the issue by copying the files libcrypto.so.3, libcrypto.a and libssl.so.3 from /usr/local/lib to /usr/lib.
After copying these files, you need to create some symbolic links.

ln -s libcrypto.so.3 libcrypto.so
ln -s libssl.so.3 libssl.so

Now rebuild the ldconfig cache:

sudo ldconfig

answered May 5, 2019 at 19:15

Stofkn's user avatar

StofknStofkn

1,41816 silver badges24 bronze badges

3

I compiled openssl from github: https://github.com/openssl/openssl.
Examining the Makefile generated (by ./config) the default install directory is /usr/local/lib64.

However, on RHEL, this directory is not in the load library path. The following worked for me on RHEL 7.9:

Edit ld.conf file to add a line containing /usr/local/lib64 :

$ sudo nano /etc/ld.so.conf.d/lib.conf
/usr/local/lib64

Sometimes, openssl is installed at /usr/local/ssl, and a file like /etc/ld.so.conf.d/openssl.conf is created. The path to libraries can be added here:

$ sudo nano /etc/ld.so.conf.d/openssl.conf
/usr/local/ssl/lib64

After adding the path to the file, update the library paths

$ sudo ldconfig

Sanity check

$ openssl version
Output: OpenSSL 3.0.0-alpha11 28 jan 2021 (Library: OpenSSL 3.0.0-alpha11 28 jan 2021)

Himanshu Tanwar's user avatar

answered Feb 4, 2021 at 15:56

kingaj's user avatar

kingajkingaj

5164 silver badges10 bronze badges

In my case it was related to Python 3.8 install on SLES 12.1. Pip install failed due to OpenSSL error.

Then I cloned the openssl repository and built it from source.

git clone https://github.com/openssl/openssl.git

./Configure
make
make install

Finally ldconfig is important and needed.

Then openssl version -a should show response without error. At least openssl 1.1 is needed to build Python 3.5+.

After this exercise the Python 3.8.5 build from the source was successful.

answered Sep 1, 2020 at 15:06

yImI's user avatar

yImIyImI

1111 silver badge5 bronze badges

Compile and run your code using sudo. It will work.

If it doesn’t work then follow the below steps

sudo apt-get update
sudo apt-get install libssl1.0.0 libssl-dev
cd /lib/x86_64-linux-gnu
sudo ln -s libssl.so.1.0.0 libssl.so.10
sudo ln -s libcrypto.so.1.0.0 libcrypto.so.10

Nima's user avatar

Nima

3,3016 gold badges27 silver badges44 bronze badges

answered May 22, 2019 at 5:07

Sidhartha's user avatar

After installing openssl-3.0.0 i noticed that libssl.so.3 and libcrypto.so.3 files were located in /usr/local/ssl/lib64.

This worked for me :

  • I edited the openssl-X.y.z.conf file located in /etc/ld.so.conf.d/ and changed /usr/local/ssl/lib to /usr/local/ssl/lib64
  • I reloaded using ldconfig

Started runing these tow commands :

cd /etc/ld.so.conf.d/

sudo vim openssl-Z.y.z.config

Changed the file, saved it and exited from vim editor.

Ran

sudo ldconfig -v

I had output like :

#...
libssl3.so -> libssl3.so
#...

And make verification again

openssl version

My output:

OpenSSL 3.0.0 7 sep 2021 (Library: OpenSSL 3.0.0 7 sep 2021)

answered Oct 24, 2021 at 16:06

FATCHOLA's user avatar

FATCHOLAFATCHOLA

3432 silver badges4 bronze badges

On CentOS 7, for OpenSSL 3.0.0, this did the job for me

sudo ln -s /usr/local/lib64/libssl.so.3 /usr/lib64/libssl.so.3
sudo ln -s /usr/local/lib64/libcrypto.so.3 /usr/lib64/libcrypto.so.3

No system restart or ldcache config rebuild required.

answered Nov 20, 2021 at 19:34

Dave's user avatar

DaveDave

15.2k124 gold badges407 silver badges772 bronze badges

I initially had this issue on Fedora 22 (fc22.x86_64) (yes….old server). I was upgrading from an old version of OpenSSL (1.0.2) to OpenSSL 3.0.1. The following solution worked for me installing from the downloaded source openssl-3.0.1.tar.gz. I firstly uninstalled my previous version of OpenSSL which had not been installed from source, but rather DNF.

Uninstall previous version with DNF (OpenSSL 1.0.2)

dnf remove openssl openssl-devel

Install OpenSSL 3.0.1

$ cd /usr/src

$ tar zxvf openssl-3.0.1.tar.gz

$ cd /usr/src/openssl-3.0.1/

$ ./config

$ make

$ make install

$ ldconfig /usr/local/lib64/

$ openssl version

OpenSSL 3.0.1 14 Dec 2021 (Library: OpenSSL 3.0.1 14 Dec 2021)

benson23's user avatar

benson23

11.2k8 gold badges17 silver badges33 bronze badges

answered Mar 5, 2022 at 0:24

Jason Ryan's user avatar

Careful because if you upgrade on Manjaro you might destroy your system — Pacman and even Sudo rely on openssl-1.1, so you want to have the latest and the older both installed at the same time or you’ll need to mount from a boot and repair.

answered Nov 22, 2022 at 11:45

Michael Nolan's user avatar

Just simple:

ln -s /usr/lib/vmware/lib/libssl.so.1.0.2/libssl.so.1.0.2 /usr/lib64/libssl.so.1.0.2
ln -s /usr/lib/vmware/lib/libcrypto.so.1.0.2/libcrypto.so.1.0.2 /usr/lib64/libcrypto.so.1.0.2

answered Aug 7, 2021 at 1:27

vdTOG's user avatar

vdTOGvdTOG

231 silver badge6 bronze badges

Faced the similar issue with the alpine based images upon running the upgrade command apk --no-cache -U -a upgrade

So, had to adjust the Dockerfile in the following way:

# syntax=docker/dockerfile:1

FROM nginx:alpine

RUN apk add --update openssl 
    && apk --no-cache -U -a upgrade

. . .

answered Nov 22, 2022 at 19:28

Raktim Biswas's user avatar

Raktim BiswasRaktim Biswas

3,9715 gold badges26 silver badges32 bronze badges

Fixed this error by running:
apt install libffi7

answered Dec 7, 2022 at 6:59

Vishnu T's user avatar

This solution from kingaj (pasted below), also works for Ubuntu 20.04. I tested it and it worked perfectly:

«…I compiled openssl from github: https://github.com/openssl/openssl. Examining the Makefile generated (by ./config) the default install directory is /usr/local/lib64.

However, on RHEL, this directory is not in the load library path. The following worked for me on RHEL 7.9:…»

$ sudo touch /etc/ld.so.conf.d/lib.conf

# edit ld.conf file 
# add a line containing `/usr/local/lib64`
$ sudo nano /etc/ld.so.conf.d/lib.conf

# update the library paths
$ sudo ldconfig

# sanity check
$ openssl version
OpenSSL 3.0.0-alpha11 28 jan 2021 (Library: OpenSSL 3.0.0-alpha11 28 jan 2021)

Aindriú's user avatar

Aindriú

3,4007 gold badges38 silver badges53 bronze badges

answered Dec 15, 2021 at 0:45

pauloalchemist's user avatar

@richsalz Thanks. I followed the OpenSSL INSTALL document and ended up changing the code in the Dockerfile to the following, which works:

FROM ubuntu:trusty
RUN apt-get update
RUN apt-get install -y wget
RUN apt-get install -y build-essential
RUN apt-get install -y zlib1g-dev

# Setup Python
ARG PYTHON_VERSION=3.6.3
RUN wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz
RUN tar xf Python-${PYTHON_VERSION}.tgz && cd Python-${PYTHON_VERSION} && ./configure && make && make install
RUN echo 'PATH="$HOME/bin/python3:$PATH"; export PATH' >> ~/.bash_profile && . ~/.bash_profile
RUN echo 'export PYTHONDONTWRITEBYTECODE=1' >> ~/.bash_profile && . ~/.bash_profile

# Setup OpenSSL
ARG OPENSSL_VERSION=1.1.0g
RUN wget https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz
RUN tar xvfz openssl-${OPENSSL_VERSION}.tar.gz
# Fix error `openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory`. Reference: https://github.com/openssl/openssl/issues/3993
RUN cd openssl-${OPENSSL_VERSION} && 
    ./config 
    --debug 
    --prefix=/usr/local 
    --libdir=/lib 
    --openssldir=/usr/local/ssl && 
    make && make install
# Add /usr/local/openssl/lib to /etc/ld.so.conf and then run the command `ldconfig`
RUN echo '/usr/local/ssl/lib' >> /etc/ld.so.conf
RUN cat /etc/ld.so.conf
RUN ldconfig
RUN echo 'export LD_LIBRARY_PATH=/usr/local/ssl/lib' >> ~/.bash_profile && . ~/.bash_profile
RUN openssl version

But then when I add additional code that uses OpenSSL at the bottom of the Dockerfile as follows:

# Setup Microraiden
ARG MICRORAIDEN_VERSION=0.1.0
# https://pip.pypa.io/en/stable/reference/pip_install/#vcs-support
RUN pip3 install http://github.com/raiden-network/microraiden/archive/v${MICRORAIDEN_VERSION}.zip

It returns the following errors:

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting http://github.com/raiden-network/microraiden/archive/v0.1.0.zip
Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/adapters.py", line 423, in send
    timeout=timeout
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 583, in urlopen
    conn = self._get_conn(timeout=pool_timeout)
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 257, in _get_conn
    return conn or self._new_conn()
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 808, in _new_conn
    raise SSLError("Can't connect to HTTPS URL because the SSL "
pip._vendor.requests.packages.urllib3.exceptions.SSLError: Can't connect to HTTPS URL because the SSL module is not available.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/local/lib/python3.6/site-packages/pip/commands/install.py", line 324, in run
    requirement_set.prepare_files(finder)
  File "/usr/local/lib/python3.6/site-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/usr/local/lib/python3.6/site-packages/pip/req/req_set.py", line 620, in _prepare_file
    session=self.session, hashes=hashes)
  File "/usr/local/lib/python3.6/site-packages/pip/download.py", line 821, in unpack_url
    hashes=hashes
  File "/usr/local/lib/python3.6/site-packages/pip/download.py", line 659, in unpack_http_url
    hashes)
  File "/usr/local/lib/python3.6/site-packages/pip/download.py", line 853, in _download_http_url
    stream=True,
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 488, in get
    return self.request('GET', url, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/pip/download.py", line 386, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 617, in send
    history = [resp for resp in gen] if allow_redirects else []
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 617, in <listcomp>
    history = [resp for resp in gen] if allow_redirects else []
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 177, in resolve_redirects
    **adapter_kwargs
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 596, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/cachecontrol/adapter.py", line 47, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/adapters.py", line 497, in send
    raise SSLError(e, request=request)
pip._vendor.requests.exceptions.SSLError: Can't connect to HTTPS URL because the SSL module is not available.
ERROR: Service 'sandbox' failed to build: The command '/bin/sh -c pip3 install http://github.com/raiden-network/microraiden/archive/v${MICRORAIDEN_VERSION}.zip' returned a non-zero code: 2

Do you know I can add the Python SSL module?
So far I’ve tried adding the following before the line of code that tries to install the Pip dependency from its Github (i.e. before RUN pip3 install ...), but without any luck

1. The purpose of this post

After install openssl, we run the openssl version to verity the installation, but sometimes we would get this error:

[[email protected] openssl-1.1.0f]# openssl version
openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

2. Environments

The linux system is:

[[email protected] openssl-1.0.0f]# uname -a
Linux node1 3.10.0-862.14.4.el7.x86_64 #1 SMP Wed Sep 26 15:12:11 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

3. Debug

We try to find the file named libssl.so.1.1 as follows:

[[email protected] openssl-1.1.0f]# ll /usr/lib64/libssl*
-rwxr-xr-x. 1 root root 315096 8m   7 2017 /usr/lib64/libssl3.so
lrwxrwxrwx. 1 root root     16 7m   9 2009 /usr/lib64/libssl.so.10 -> libssl.so.1.0.2k
-rwxr-xr-x. 1 root root 470336 8m   4 2017 /usr/lib64/libssl.so.1.0.2k
[[email protected] openssl-1.1.0f]# ll /usr/local/lib64
Total 8984
drwxr-xr-x. 2 root root      39 11m  8 11:30 engines-1.1
-rw-r--r--. 1 root root 4967326 11m  8 11:30 libcrypto.a
lrwxrwxrwx. 1 root root      16 11m  8 11:30 libcrypto.so -> libcrypto.so.1.1
-rwxr-xr-x. 1 root root 2934272 11m  8 11:30 libcrypto.so.1.1
-rw-r--r--. 1 root root  766182 11m  8 11:30 libssl.a
lrwxrwxrwx. 1 root root      13 11m  8 11:30 libssl.so -> libssl.so.1.1
-rwxr-xr-x. 1 root root  521384 11m  8 11:30 libssl.so.1.1
drwxr-xr-x. 2 root root      61 11m  8 11:22 pkgconfig

We can find that the ‘libcrypto.so.1.1’ is located in the /usr/local/lib64,
But openssl try to find the .so libraries in the LD_LIBRARY_PATH

[[email protected] ~]# echo $LD_LIBRARY_PATH
/usr/lib64:/usr/local/lib64

So the solution is try to tell openssl where the library is.

4. Solve it

There are two methods to solve the problem:

4.1 Method 1: Change the LD_LIBRARY_PATH

export LD_LIBRARY_PATH = /usr/local/lib64:$LD_LIBRARY_PATH

4.2 Method 2: Create a linke to the file

[[email protected] openssl-1.1.0f]# ln -s /usr/local/lib64/libssl.so.1.1 /usr/lib64/libssl.so.1.1
[[email protected] openssl-1.1.0f]# ln -s /usr/local/lib64/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1

5. The LD_LIBRARY_PATH

As the linux documents shown:

You can temporarily substitute a different library for this particular execution. In Linux, the environment variable LD_LIBRARY_PATH is a colon-separated set of directories where libraries should be searched for first, before the standard set of directories; this is useful when debugging a new library or using a nonstandard library for special purposes. The environment variable LD_PRELOAD lists shared libraries with functions that override the standard set, just as /etc/ld.so.preload does. These are implemented by the loader /lib/ld-linux.so. I should note that, while LD_LIBRARY_PATH works on many Unix-like systems, it doesn’t work on all; for example, this functionality is available on HP-UX but as the environment variable SHLIB_PATH, and on AIX this functionality is through the variable LIBPATH (with the same syntax, a colon-separated list).

LD_LIBRARY_PATH is handy for development and testing, but shouldn’t be modified by an installation process for normal use by normal users; see «Why LD_LIBRARY_PATH is Bad’’ at http://www.visi.com/~barr/ldpath.html for an explanation of why. But it’s still useful for development or testing, and for working around problems that can’t be worked around otherwise. If you don’t want to set the LD_LIBRARY_PATH environment variable, on Linux you can even invoke the program loader directly and pass it arguments. For example, the following will use the given PATH instead of the content of the environment variable LD_LIBRARY_PATH, and run the given executable:
/lib/ld-linux.so.2 –library-path PATH EXECUTABLE
Just executing ld-linux.so without arguments will give you more help on using this, but again, don’t use this for normal use — these are all intended for debugging.

You can find the full linux shared libary documents on Linux documents

  • Linux shared libraries documents

The symlink libssl.so.6 shows up in /usr/lib/x86_64-linux-gnu, and I ran ldconfig but I still get this error:

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

Is it a permissions issue or the link is not properly defined?

Update after running ldd on the binary:

    linux-vdso.so.1 =>  (0x00007fff1efe2000)
    libssl.so.6 => not found
    libcrypto.so.6 => not found
    libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007feb2a3c4000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007feb2a1bb000)
    libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007feb29f82000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007feb29d65000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007feb29b60000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007feb297a1000)
    /lib64/ld-linux-x86-64.so.2 (0x00007feb2b159000)

asked Feb 24, 2015 at 16:38

blueseal's user avatar

bluesealblueseal

1631 gold badge1 silver badge9 bronze badges

1

From the ldd command it looks like the binary is looking in /lib/x86_64-linux-gnu and not /usr/lib/x86_64-linux-gnu where you found the symlink.

Try running these and see if you still get the same error:

sudo ln -s /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 /lib/x86_64-linux-gnu/libcrypto.so.6
sudo ln -s /lib/x86_64-linux-gnu/libssl.so.1.0.0 /lib/x86_64-linux-gnu/libssl.so.6

answered Feb 24, 2015 at 19:18

devnull's user avatar

devnulldevnull

5,23520 silver badges35 bronze badges

5

By
Published September 2, 2022
Linux/Unix

Today in this post, we will see one of the common error and its solution.

This error comes to me when i upgraded and ran openssl binary on my linux system, RHEL 7.

Lets see the error message and its solution.

I. Error Message

[user@ngelinux001{none}]/cds/palladium/tools/openssl/bin$ ./openssl 
./openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

II. Analysis

### Try to locate the binary on your system.
# locate libssl.so.1.1

### If not found download it and install on your system.
# wget https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/o/openssl11-libs-1.1.1k-4.el7.x86_64.rpm
# yum install ./openssl11-libs-1.1.1k-4.el7.x86_64.rpm

III. Solution

[root@ngelinux001 openssl]# yum install ./openssl11-libs-1.1.1k-4.el7.x86_64.rpm
Loaded plugins: aliases, changelog, kabi, langpacks, product-id, search-disabled-repos, subscription-manager, tmprepo, verify,
              : versionlock
This system is not registered with an entitlement server. You can use subscription-manager to register.
Loading support for Red Hat kernel ABI
Examining ./openssl11-libs-1.1.1k-4.el7.x86_64.rpm: 1:openssl11-libs-1.1.1k-4.el7.x86_64
Marking ./openssl11-libs-1.1.1k-4.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package openssl11-libs.x86_64 1:1.1.1k-4.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================================================================
 Package                    Arch               Version                    Repository                                       Size
================================================================================================================================
Installing:
 openssl11-libs             x86_64             1:1.1.1k-4.el7             /openssl11-libs-1.1.1k-4.el7.x86_64             3.6 M

Transaction Summary
================================================================================================================================
Install  1 Package

Total size: 3.6 M
Installed size: 3.6 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:openssl11-libs-1.1.1k-4.el7.x86_64                                                                         1/1
base/productid                                                                                           | 1.6 kB  00:00:00
base2/productid                                                                                          | 1.6 kB  00:00:00
  Verifying  : 1:openssl11-libs-1.1.1k-4.el7.x86_64                                                                         1/1

Installed:
  openssl11-libs.x86_64 1:1.1.1k-4.el7

Complete!
[root@ngelinux001 openssl]#

[root@ngelinux001 openssl]# ./openssl
OpenSSL>

Tags: 7binarycentoserrorerror libsslinstalllibrarylibssl.so.1.1linuxopensslpackagerhelsslunixupdateversion

Понравилась статья? Поделить с друзьями:
  • Error while loading shared libraries libpng12 so 0
  • Error while loading shared libraries libpcre so 1
  • Error while loading shared libraries libopencl so 1
  • Error while loading shared libraries libnss3 so
  • Error while loading shared libraries libncurses so 5