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...
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).
15 Answers
This fixes it (a problem with packaging in 22.04):
wget
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.19_amd64.deb
PS: If the link is expired, check for a valid one.
Current version is: libssl1.1_1.1.1f-1ubuntu2.19_amd64.deb
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
$ 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.
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... -> Installing Python-3.9.6... Installed Python-3.9.6 to /home/slesage/.pyenv/versions/3.9.6
Download & install libssl1.1
wget
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb
I solved it by:
wget
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
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
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.
update 2022/11/09
fast way to install libssl1.1
$ echo "deb 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 && \
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
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
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
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 | 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.
the url provided by the topest recommend answer is out of fashion, here is the newest one.
wget && sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.16_amd64.deb
The proposed answer is outdated as the deb file location was changed, the new script to fix that would be:
wget
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.17_amd64.deb
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
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 | python3 -
Just for the record, since most of the URLs on this page seem to be outdated. These commands worked for me today:
wget
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
I sincerely hope the link in line 1 is a permalink.
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.