95

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

user438383
  • 5,716
  • 8
  • 28
  • 43
RobinFrcd
  • 4,439
  • 4
  • 25
  • 49

13 Answers13

207

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

andyw
  • 3,505
  • 2
  • 30
  • 44
seventh
  • 2,294
  • 1
  • 9
  • 8
  • 3
    That gives me a 404. – Gert Sønderby Jun 24 '22 at 08:48
  • This URL worked for me: http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1l-1ubuntu1_amd64.deb – Element Green Jul 06 '22 at 15:53
  • 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 '22 at 15:04
  • 13
    This seems very sketchy - isn't there an official website / repo / way to do this? – niico Aug 17 '22 at 19:52
  • 2
    @niico that is the official Ubuntu website – Goigle Sep 06 '22 at 19:27
  • The filenames in the two lines of code don't match up anymore. – matthme Sep 15 '22 at 07:32
  • 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. – Vatsal Desai Sep 19 '22 at 13:47
  • 1
    the file name has changed * sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.16_amd64.deb * – Adam111p Sep 24 '22 at 14:18
  • wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.16_amd64.deb && sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.16_amd64.deb worked for me! – Zach Nov 09 '22 at 19:27
  • 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.deb``` – Wayne Feb 26 '23 at 20:42
  • 2.17 - already not actual... Who knows how to download exactly the latest version? The old one just disappears – Avraam Apr 27 '23 at 08:23
  • 2
    @Avraam you can search this page http://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.deb – seventh Apr 28 '23 at 14:11
  • 2
    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 '23 at 15:12
46

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.

A. K.
  • 34,395
  • 15
  • 52
  • 89
  • 1
    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: https://deanpcmad.com/2022/installing-older-ruby-versions-on-ubuntu-22-04/ – Tashows Dec 21 '22 at 12:29
  • 1
    This should really have more upvotes. Thanks for the answer, this is definitely the preferred way here! – JamesD Jan 11 '23 at 14:17
  • 1
    At the time of writing, `1.1.1o` as mentioned above fails to compile (certificate problem?) but [`1.1.1t`](https://www.openssl.org/source/openssl-1.1.1t.tar.gz) works. – paws Mar 17 '23 at 19:05
  • 1
    @paws I've updated the answer based on your comment. Thanks! – A. K. Jun 11 '23 at 02:51
12

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
    
Sylvain Lesage
  • 831
  • 2
  • 12
  • 17
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.

S3DEV
  • 8,768
  • 3
  • 31
  • 42
  • 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 – rominator007 Jun 11 '22 at 19:17
  • 1
    what's the path to openssl-1.1.1o? – niico Aug 17 '22 at 19:46
11

I solved it by:

wget https://www.openssl.org/source/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
QF D
  • 111
  • 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](/help/how-to-answer). – Community Jun 05 '22 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.) – Gert Sønderby Jun 24 '22 at 08:57
  • what's the path to cd openssl-1-1-1o - it can't find the folder – niico Aug 17 '22 at 19:47
10

Download & install libssl1.1

wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.18_amd64.deb
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.18_amd64.deb
assayag.org
  • 709
  • 10
  • 24
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
Ershan
  • 623
  • 8
  • 9
4

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.

RobinFrcd
  • 4,439
  • 4
  • 25
  • 49
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
汤杭运
  • 21
  • 1
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

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 -
Chickenmarkus
  • 1,131
  • 11
  • 25
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.

Tintin81
  • 9,821
  • 20
  • 85
  • 178