libssl.so.1.1: cannot open shared object file: No such file or directory
Asked Answered
A

15

119

I've just updated to Ubuntu 22.04 LTS and my libs using OpenSSL just stopped working. Looks like Ubuntu switched to the version 3.0 of OpenSSL.

For example, poetry stopped working:

Traceback (most recent call last):
  File "/home/robz/.local/bin/poetry", line 5, in <module>
    from poetry.console import main
  File "/home/robz/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/console/__init__.py", line 1, in <module>
    from .application import Application
  File "/home/robz/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/console/application.py", line 7, in <module>
    from .commands.about import AboutCommand
  File "/home/robz/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/console/commands/__init__.py", line 4, in <module>
    from .check import CheckCommand
  File "/home/robz/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/console/commands/check.py", line 2, in <module>
    from poetry.factory import Factory
  File "/home/robz/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/factory.py", line 18, in <module>
    from .repositories.pypi_repository import PyPiRepository
  File "/home/robz/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/repositories/pypi_repository.py", line 33, in <module>
    from ..inspection.info import PackageInfo
  File "/home/robz/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/inspection/info.py", line 25, in <module>
    from poetry.utils.env import EnvCommandError
  File "/home/robz/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/utils/env.py", line 23, in <module>
    import virtualenv
  File "/home/robz/.local/share/pypoetry/venv/lib/python3.9/site-packages/virtualenv/__init__.py", line 3, in <module>
    from .run import cli_run, session_via_cli
  File "/home/robz/.local/share/pypoetry/venv/lib/python3.9/site-packages/virtualenv/run/__init__.py", line 11, in <module>
    from ..seed.wheels.periodic_update import manual_upgrade
  File "/home/robz/.local/share/pypoetry/venv/lib/python3.9/site-packages/virtualenv/seed/wheels/__init__.py", line 3, in <module>
    from .acquire import get_wheel, pip_wheel_env_run
  File "/home/robz/.local/share/pypoetry/venv/lib/python3.9/site-packages/virtualenv/seed/wheels/acquire.py", line 12, in <module>
    from .bundle import from_bundle
  File "/home/robz/.local/share/pypoetry/venv/lib/python3.9/site-packages/virtualenv/seed/wheels/bundle.py", line 4, in <module>
    from .periodic_update import periodic_update
  File "/home/robz/.local/share/pypoetry/venv/lib/python3.9/site-packages/virtualenv/seed/wheels/periodic_update.py", line 10, in <module>
    import ssl
  File "/home/robz/.pyenv/versions/3.9.10/lib/python3.9/ssl.py", line 98, in <module>
    import _ssl             # if we can't import it, let the error propagate
ImportError: libssl.so.1.1: cannot open shared object file: No such file or directory

Is there an easy fix ? For example, having libssl.so.1.1 available without having to uninstall OpenSSL 3 (I don't know if it's even possible).

Apis answered 5/5, 2022 at 20:31 Comment(2)
I would consider re-installing your virtual environment: the ssl module needs to be rebuilt using the updated system libraries.Plutus
That's what I did, worked like a charm!Apis
J
253

This fixes it (a problem with packaging in 22.04):

wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.22_amd64.deb

sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.22_amd64.deb

PS: If the link is expired, check http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/?C=M;O=D for a valid one.

Current version is: libssl1.1_1.1.1f-1ubuntu2.22_amd64.deb

Janicejanicki answered 15/6, 2022 at 14:36 Comment(15)
That gives me a 404.Complemental
This URL worked for me: nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/…Corticosteroid
This fixed multiple issues I was having after an upgrade from 21 to 22.04, thanks! Heads up: the file now appears to be named "libssl1.1_1.1.1f-1ubuntu2.16_amd64.deb". This file being missing prevented the upower daemon from running, which caused my laptop battery to appear unrecognized (journalctl -xe -u upower).Thermolabile
This seems very sketchy - isn't there an official website / repo / way to do this?Mme
@Mme that is the official Ubuntu websiteLindstrom
The filenames in the two lines of code don't match up anymore.Wardrobe
you can use synaptic package manager to do this in elegant way.in Search you need to give libssl and you would find some ubuntu tagged options which you need to select.Sw
the file name has changed * sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.16_amd64.deb *Apollyon
wget nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/… && sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.16_amd64.deb worked for me!Beatriz
as of 2/26/2023 this is the command wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.17_amd64.deb You then run sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.17_amd64.debAftercare
2.17 - already not actual... Who knows how to download exactly the latest version? The old one just disappearsIldaile
@Ildaile you can search this page nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/?C=M;O=D for libssl1.1_1.1.1f-1ubuntu2. and you will find an actual version. Now it libssl1.1_1.1.1f-1ubuntu2.18_amd64.debJanicejanicki
I think there is a general (unversioned) .deb available: http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb This worked for me and might be a perma-link to the most current version of the .debBaranowski
Another query: Is the above solution (commands) for paddlepaddle cpu version only? Because I ran both of the commands and it solved for the CPU but for the paddlepaddle-gpu cuda12 compatible ( mentioned here: paddlepaddle.org.cn/documentation/docs/en/install/pip/… ) did not work with the same commands. I am using two different conda environments one for cpu version and one for gpu version. Switching to CPU did not throw any error but GPU still has the same.Cerberus
As of 12 Nov 23 this work on ubuntu 22.04, wget nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/… and then install sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.20_amd64.debMedusa
I
74

It is risky to install openssl-1.1.1o on Ubuntu 22.04 as it supports openssl-3.0.2. A more preferable way would be to build and keep the libssl.so.1.1 and libcrypto.so.1.1 libraries away from root and export LD_LIBRARY_PATH as needed.

e.g.,

$ mkdir $HOME/opt && cd $HOME/opt
# Download a supported openssl version. e.g., openssl-1.1.1o.tar.gz or openssl-1.1.1t.tar.gz
$ wget https://www.openssl.org/source/openssl-1.1.1o.tar.gz
$ tar -zxvf openssl-1.1.1o.tar.gz
$ cd openssl-1.1.1o
$ ./config && make && make test
$ mkdir $HOME/opt/lib
$ mv $HOME/opt/openssl-1.1.1o/libcrypto.so.1.1 $HOME/opt/lib/
$ mv $HOME/opt/openssl-1.1.1o/libssl.so.1.1 $HOME/opt/lib/

and then

export LD_LIBRARY_PATH=$HOME/opt/lib:$LD_LIBRARY_PATH

as needed. You can also put this export in ~/.bashrc etc files if you need it enabled all the time.

The advantage of this approach is that if you need to remove openssl-1.1.1 from your machine, it is trivial. You can also pick and chose by just using the right LD_LIBRARY_PATH or providing the path to library during link.

Interstratify answered 5/9, 2022 at 3:46 Comment(4)
While this solved the error mentioned in the title I am now getting errors like SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get local issuer certificate), any clues? EDIT: I solved it combining your solution (the export in ~/.bashrc part) with this: deanpcmad.com/2022/…Chrysler
This should really have more upvotes. Thanks for the answer, this is definitely the preferred way here!Deification
At the time of writing, 1.1.1o as mentioned above fails to compile (certificate problem?) but 1.1.1t works.Milled
@Milled I've updated the answer based on your comment. Thanks!Interstratify
R
22

Download & install libssl1.1 latest version:

wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
Reserve answered 4/9, 2022 at 22:27 Comment(3)
As of today 13/09/2022 THIS WORKSArvizu
It worked as of 19/02/2024 tooRhinoscopy
It worked as of 31/03/2024.Mardis
B
16

I've had the issue when upgrading to Ubuntu 22.04.

I use pyenv.

The solution for me was to reinstall the already installed versions of Python:

  • list of installed versions:
    $ pyenv versions
    
  • reinstall every version, eg for 3.9.6:
    $ pyenv install 3.9.6
    
    pyenv: /home/slesage/.pyenv/versions/3.9.6 already exists
    continue with installation? (y/N) y
    Downloading Python-3.9.6.tar.xz...
    -> https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tar.xz
    Installing Python-3.9.6...
    Installed Python-3.9.6 to /home/slesage/.pyenv/versions/3.9.6
    
Benn answered 22/8, 2022 at 14:14 Comment(0)
A
15

I solved it by:

wget https://www.openssl.org/source/openssl-1.1.1o.tar.gz
tar -zxvf openssl-1.1.1o.tar.gz
cd openssl-1.1.1o
./config
make
make test
sudo make install
find / -name libssl.so.1.1
ln -s /usr/local/lib64/libssl.so.1.1  /usr/lib64/libssl.so.1.1
ln -s /usr/local/lib64/libssl.so.1.1  /usr/lib/libssl.so.1.1
find / -name libcrypto.so.1.1
ln -s /home/ubuntu/openssl-1.1.1o/libcrypto.so.1.1    /usr/lib64/libcrypto.so.1.1
ln -s /home/ubuntu/openssl-1.1.1o/libcrypto.so.1.1     /usr/lib/libcrypto.so.1.1
Agha answered 5/6, 2022 at 13:49 Comment(3)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Militant
I had to similarly create symlinks in /usr/lib, so this was what solved it for me. (Still missing a tar command at the top, though.)Complemental
what's the path to cd openssl-1-1-1o - it can't find the folderMme
G
11

I had the same problem using nodejs in a nvm env. I did not find any deb packages with libopenssl1.1 for ubuntu jammy and finally get to the point I manually installed it :

wget https://www.openssl.org/source/openssl-1.1.1o.tar.gz
tar -zxvf openssl-1.1.1o.tar.gz
cd openssl-1.1.1o
./config
make
make test
sudo make install

Note: The latest openssl version can be downloaded from OpenSSL. The version used above is for example only.

Godbeare answered 24/5, 2022 at 17:4 Comment(2)
I had this when switching to ubuntu 22.04 with makemkv. installing openssl as described and recompiling makemkv did the trick. although I miss the tar -xzf openssl-1.1.1o.tar.gz before line 2Misanthrope
what's the path to openssl-1.1.1o?Mme
S
11

update 2022/11/09

fast way to install libssl1.1

$ echo "deb http://security.ubuntu.com/ubuntu focal-security main" | sudo tee /etc/apt/sources.list.d/focal-security.list
$ apt-get update && \
    apt-get install libssl1.1
$ dpkg -L libssl1.1
/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/engines-1.1
/usr/lib/x86_64-linux-gnu/engines-1.1/afalg.so
/usr/lib/x86_64-linux-gnu/engines-1.1/capi.so
/usr/lib/x86_64-linux-gnu/engines-1.1/padlock.so
/usr/lib/x86_64-linux-gnu/libcrypto.so.1.1      <---
/usr/lib/x86_64-linux-gnu/libssl.so.1.1         <---
/usr/share
/usr/share/doc
/usr/share/doc/libssl1.1
/usr/share/doc/libssl1.1/NEWS.Debian.gz
/usr/share/doc/libssl1.1/changelog.Debian.gz
/usr/share/doc/libssl1.1/copyright


update 2022/11/06

# /usr/local/bin/mysql -uroot -h127.0.0.1 -p
/usr/local/bin/mysql: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory
$ ldd /usr/local/bin/mysql
    linux-vdso.so.1 (0x00007fff1e576000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f7e6db3e000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f7e6db39000)
    libcrypto.so.1.1 => not found
    libssl.so.1.1 => not found
    libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f7e6db25000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f7e6db1e000)
    libncurses.so.5 => /lib/x86_64-linux-gnu/libncurses.so.5 (0x00007f7e6daf8000)
    libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f7e6dac9000)
    libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f7e6d89d000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f7e6d7b6000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f7e6d796000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7e6d56c000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f7e6db4b000)
$ wget -c https://www.openssl.org/source/openssl-1.1.1s.tar.gz && \
    tar xf openssl-1.1.1s.tar.gz && \
    cd openssl-1.1.1s/ && \
    ./config --prefix="/usr/local/openssl" && \
    make && \
    make test && \
    make install && \
    export LD_LIBRARY_PATH=/usr/local/openssl/lib:$LD_LIBRARY_PATH" >> /etc/profile.d/startEnv.sh && \
    echo "export LD_LIBRARY_PATH=/usr/local/openssl/lib:$LD_LIBRARY_PATH" >> /etc/profile.d/startEnv.sh && \
    echo $LD_LIBRARY_PATH
Saleme answered 6/11, 2022 at 2:0 Comment(0)
S
6

Resuming all.

Solution for ubuntu 22.04

Env before problem: pyenv -> poetry

Don't try to fix by pyenv, poetry, pip, etc. its ssl lib! Just

wget https://www.openssl.org/source/openssl-1.1.1o.tar.gz
tar -zxvf openssl-1.1.1o.tar.gz
cd openssl-1.1.1o
./config
make
make test      (failed 2 tests)
sudo make install (on this moment you can't install python by pyenv)
sudo find / -name libssl.so.1.1
sudo ln -s /usr/local/lib/libssl.so.1.1  /usr/lib/libssl.so.1.1
sudo find / -name libcrypto.so.1.1
sudo ln -s /usr/local/lib/libcrypto.so.1.1 /usr/lib/libcrypto.so.1.1

now you can install python by pyenv and needed package must work

Szabo answered 24/8, 2022 at 14:51 Comment(0)
A
3

Well, luckily I'm using pyenv to manage python versions on my system. I was using python 3.9.10 before, and had a bug with ssl on ubuntu 22.04.

I just removed Python 3.9.10 and installed 3.9.12, made it global, it fixed my problem.

pyenv uninstall 3.9.10
pyenv install 3.9.12
pyenv global 3.9.12

curl -sSL https://install.python-poetry.org | python3 -

As @larsks suggested, just re-installing the environment should be enough (it's not even needed to upgrade the Python version). Reinstall the environment will use currently installed system libs.

Apis answered 5/5, 2022 at 20:43 Comment(0)
D
2

The proposed answer is outdated https://mcmap.net/q/181759/-libssl-so-1-1-cannot-open-shared-object-file-no-such-file-or-directory as the deb file location was changed, the new script to fix that would be:

wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.17_amd64.deb

sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.17_amd64.deb

Doorjamb answered 2/3, 2023 at 5:56 Comment(0)
S
1

the url provided by the topest recommend answer is out of fashion, here is the newest one.

wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.17_amd64.deb && sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.16_amd64.deb
Sitra answered 22/2, 2023 at 5:26 Comment(1)
Thanks! But it should be && sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.17_amd64.debAlcibiades
S
1

In my case, I'm using asdf and Python and I had just upgraded my OS (copying my entire home directory). I had to asdf uninstall python 3.10.12 and then asdf install python 3.10.12 to get it to rebuild python against the updated dependencies on my system

Selfacting answered 6/9, 2023 at 5:41 Comment(0)
B
0

I had to replace the local version of poetry by the latest version. First attempt of re-installation asked for python3-venv so that the final two commands were:

sudo apt-get install python3-venv
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3 -
Bechler answered 4/7, 2022 at 13:6 Comment(0)
C
0

Just for the record, since most of the URLs on this page seem to be outdated. These commands worked for me today:

wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb

I sincerely hope the link in line 1 is a permalink.

Cohette answered 18/8, 2023 at 16:37 Comment(0)
R
-1

I faced the same issue when I try to run an Erlang application. I tried installing openssl-1 related packages using various methods, but all failed.

Then I found related libcrypto.so.1.1 file from an old Ubuntu server's following path : /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 and moved it to Ubuntu 22.04 /usr/lib/x86_64-linux-gnu/

This helped to solve my issue. Now Ubuntu 22.04 has both libcrypto.so.1.1 and libcrypto.so.3.

Receptive answered 22/12, 2023 at 13:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.