5

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.

iOS
  • 11,881
  • 4
  • 71
  • 92
M. L.
  • 101
  • 1
  • 2
  • 6
  • 1
    Looks similar at your problem https://serverfault.com/questions/818445/error-while-loading-shared-libraries-libcrypto-so-1-1 – mkUltra Jan 10 '19 at 08:59
  • Yes I have seen this before. But nevertheless looking at it twice helped me and I fixed my problem. Thanks. – M. L. Jan 10 '19 at 09:59

5 Answers5

5

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
  • 8,444
  • 3
  • 29
  • 48
M. L.
  • 101
  • 1
  • 2
  • 6
3

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

Stofkn
  • 1,298
  • 14
  • 21
  • 1
    This 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. – duskwuff -inactive- May 05 '19 at 19:38
  • 1
    It 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. – Rauli Kumpulainen Jun 02 '19 at 06:22
  • I 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. – Nick Dat Le Jun 05 '20 at 03:46
2

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.

yImI
  • 51
  • 4
1

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
  • 2,807
  • 6
  • 22
  • 36
Sidhartha
  • 19
  • 3
0

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)
kingaj
  • 111
  • 8