openssl: error while loading shared libraries: libssl.so.3
Solution 1
I solved it that time only by creating a symlink and rebuilding the ldconfig cache.
ln -s libssl.so.3 libssl.so
sudo ldconfig
Solution 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
Solution 3
ldconfig /usr/local/lib64/
with compilation from sourecs:
./Configure
make
make install
ldconfig /usr/local/lib64/
Solution 4
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)
Solution 5
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.
Related videos on Youtube

M. L.
Updated on December 16, 2021Comments
-
M. L. over 1 year
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.
-
mkUltra over 4 yearsLooks similar at your problem serverfault.com/questions/818445/…
-
-
Admin about 4 yearsThis is dangerous advice, and should not be followed. Files in
/usr/lib
should be managed by your operating system's package manager -- overwriting them will leave your system in an inconsistent state. -
Rauli Kumpulainen almost 4 yearsIt is a dirty hack, but it worked on my Ubuntu 16. I compiled and installed the current openssl and curl (which uses openssl). I think when building Openssl there is an option you can pass to configure for the install path, to usr/lib in this case.
-
Nick Dat Le almost 3 yearsI had a similar error installing openssl from stratch: openssl: error while loading shared libraries: libssl.so.48: cannot open shared object file: No such file or directory. This trick worked for me.
-
woodz over 1 yearwould be helpful if you can tell us the fully qualified paths to the .sos in your
ln
command; for me it was enough to just executesudo ldconfig
after compiling and installing openssl -
wolf about 1 yearI did this: # ln -s /usr/lib/x86_64-linux-gnu/libssl.so.3 /usr/local/lib64/libssl.so.3 and # ln -s /usr/local/lib64/libcrypto.so.3 /usr/lib/x86_64-linux-gnu/ (and then of course rebuild the cache with ldconfig)
-
Gareth about 1 yearWorking solution, works perfect. Thank you Eugene! Now, time to read into ldconfig, as I only mildy know what it does.