openssl: error while loading shared libraries: libssl.so.3
Asked Answered
F

16

31

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.

Frazzled answered 10/1, 2019 at 8:53 Comment(2)
Looks similar at your problem serverfault.com/questions/818445/…Unmoral
Yes I have seen this before. But nevertheless looking at it twice helped me and I fixed my problem. Thanks.Frazzled
F
16

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

ln -s libssl.so.3 libssl.so
sudo ldconfig
Frazzled answered 28/2, 2020 at 10:29 Comment(2)
would 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 execute sudo ldconfig after compiling and installing opensslLuanaluanda
I 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)Madsen
M
44
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 answer

Macrospore answered 8/11, 2021 at 7:49 Comment(7)
Working solution, works perfect. Thank you Eugene! Now, time to read into ldconfig, as I only mildy know what it does.Erb
somehow it's not persistent for me. The error came again after reboot or logoutEvin
@Ragtime, meybe you should try to add /usr/local/lib64/ to your linker permanently? askubuntu.com/questions/334365/…Macrospore
Thanks so much! I did echo "/usr/local/lib64" > /etc/ld.so.conf.d/openssl.conf after your command and it's now working perfectly!Evin
Could you share any info on what this answer actually does?Cary
@Cary you just need to read aswer attentively.Macrospore
@EugeneLopatkin I have, many times :) There's a fair bit of context that would be helpful for beginners like myself, for example: 1) What is ldconfig? 2) Why are these particular sources necessary in order to solve the original issue? 3) how does one determine when this of solution is appropriate for a given error? You could expect readers to do their own research, but the technical documentation on this point is a bit overwhelming. Since people are often eager to share knowledge on SO, I figured I'd ask.Cary
I
19

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)
Ironbound answered 4/2, 2021 at 15:56 Comment(2)
on ubuntu i had to adjust the path in /etc/ld.so.conf.d/openssl-3.0.2.confSocialite
Thanks I added my installation path and it worked straightawayGiblet
F
16

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

ln -s libssl.so.3 libssl.so
sudo ldconfig
Frazzled answered 28/2, 2020 at 10:29 Comment(2)
would 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 execute sudo ldconfig after compiling and installing opensslLuanaluanda
I 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)Madsen
K
12

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

Kaleena answered 5/5, 2019 at 19:15 Comment(3)
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.Hour
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.Holst
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.Ennoble
T
4

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.

Ten answered 1/9, 2020 at 15:6 Comment(0)
S
3

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.

Staghound answered 20/11, 2021 at 19:34 Comment(0)
S
3

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)
Squireen answered 5/3, 2022 at 0:24 Comment(0)
M
2

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
Manvil answered 22/5, 2019 at 5:7 Comment(0)
Z
2

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.

Zannini answered 22/11, 2022 at 11:45 Comment(0)
J
1

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)
Journeywork answered 24/10, 2021 at 16:6 Comment(0)
U
1

In my case it was caused by some mamba/conda transaction, which has upgraded openssl to 3.0, version not present on the computer I did not have root to. When it is your situation calm down and simply downgrade

mamba install openssl=1.1.1t

or

conda install openssl=1.1.1t
Usquebaugh answered 28/3, 2023 at 16:34 Comment(0)
O
1

For RedHat 7.9 after installing OpenSSL 3.1.0, I was able to see the version as root but not as regular user, so I sent this commands that finally helped me

$ sudo ln -s /usr/local/lib64/libssl.so.3 /usr/lib
$ sudo ln -s /usr/local/lib64/libcrypto.so.3 /usr/lib
$ sudo ldconfig
$ openssl version
OpenSSL 3.1.0 14 Mar 2023 (Library: OpenSSL 3.1.0 14 Mar 2023)

finally problem solved.

Ochoa answered 30/3, 2023 at 5:44 Comment(0)
B
0

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
Besnard answered 7/8, 2021 at 1:27 Comment(0)
H
0

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

. . .
Homeward answered 22/11, 2022 at 19:28 Comment(0)
A
0

Fixed this error by running: apt install libffi7

Alten answered 7/12, 2022 at 6:59 Comment(0)
D
-1

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)
Dode answered 15/12, 2021 at 0:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.