RobinFrcd
RobinFrcd

Reputation: 5446

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

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

Upvotes: 137

Views: 318915

Answers (16)

seventh
seventh

Reputation: 3106

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.23_amd64.deb

sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.23_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 (as of 2024-08-05) is: libssl1.1_1.1.1f-1ubuntu2.23_amd64.deb

Upvotes: 289

Cedric Keller
Cedric Keller

Reputation: 21

Avoid using libssl.so.1.1 (openssl 1.1) as it reached it's End-Of-Life (https://www.openssl.org/blog/blog/2023/03/28/1.1.1-EOL/index.html).

Instead upgrade to Version 3.

Upvotes: 1

danielassayag
danielassayag

Reputation: 941

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

Upvotes: 29

Sachith Muhandiram
Sachith Muhandiram

Reputation: 2972

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.

Upvotes: -1

QF D
QF D

Reputation: 171

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

Upvotes: 17

Cobertos
Cobertos

Reputation: 2253

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

Upvotes: 1

Tintin81
Tintin81

Reputation: 10215

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.

Upvotes: 1

A. K.
A. K.

Reputation: 38234

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.

Upvotes: 79

The proposed answer is outdated https://stackoverflow.com/a/72633324/8689619 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

Upvotes: 2

汤杭运
汤杭运

Reputation: 19

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

Upvotes: 1

Ershan
Ershan

Reputation: 861

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

Upvotes: 13

Вадим Ка
Вадим Ка

Reputation: 61

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

Upvotes: 6

Sylvain Lesage
Sylvain Lesage

Reputation: 981

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
    

Upvotes: 17

Julien Laurenceau
Julien Laurenceau

Reputation: 340

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.

Upvotes: 12

Chickenmarkus
Chickenmarkus

Reputation: 1161

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 -

Upvotes: 0

RobinFrcd
RobinFrcd

Reputation: 5446

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.

Upvotes: 3

Related Questions