openssl: error while loading shared libraries: libssl.so.3

Viewed 46397

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.

11 Answers

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

ln -s libssl.so.3 libssl.so
sudo ldconfig
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

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

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)

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.

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

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.

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)

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

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)

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)
Related