107

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

2
  • 4
    I would consider re-installing your virtual environment: the ssl module needs to be rebuilt using the updated system libraries.
    – larsks
    May 5, 2022 at 20:40
  • 3
    That's what I did, worked like a charm!
    – RobinFrcd
    May 5, 2022 at 20:44

14 Answers 14

233
+50

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

sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.19_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.19_amd64.deb

15
  • 3
    That gives me a 404. Jun 24, 2022 at 8:48
  • 6
    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).
    – Josh Honig
    Jul 24, 2022 at 15:04
  • 17
    This seems very sketchy - isn't there an official website / repo / way to do this?
    – niico
    Aug 17, 2022 at 19:52
  • 3
    @niico that is the official Ubuntu website
    – Goigle
    Sep 6, 2022 at 19:27
  • 3
    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 .deb
    – P.R.
    May 16 at 15:12
63

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.

4
  • 2
    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/…
    – Tashows
    Dec 21, 2022 at 12:29
  • 2
    This should really have more upvotes. Thanks for the answer, this is definitely the preferred way here!
    – JamesD
    Jan 11 at 14:17
  • 1
    At the time of writing, 1.1.1o as mentioned above fails to compile (certificate problem?) but 1.1.1t works.
    – paws
    Mar 17 at 19:05
  • 1
    @paws I've updated the answer based on your comment. Thanks!
    – A. K.
    Jun 11 at 2:51
13

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
    
13

Download & install libssl1.1

wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb
1
  • 2
    As of today 13/09/2022 THIS WORKS Sep 13, 2022 at 15:36
12

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
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.
    – Community Bot
    Jun 5, 2022 at 14:24
  • 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.) Jun 24, 2022 at 8:57
  • what's the path to cd openssl-1-1-1o - it can't find the folder
    – niico
    Aug 17, 2022 at 19:47
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.

2
  • 1
    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 2 Jun 11, 2022 at 19:17
  • 1
    what's the path to openssl-1.1.1o?
    – niico
    Aug 17, 2022 at 19:46
10

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

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.

2

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
1
  • Thanks! But it should be && sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.17_amd64.deb Feb 28 at 21:02
1

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

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.