error while loading shared libraries: libssl.so.1.1 (and libcrypto.so.1.1)

30,623

Solved.

Problem is that if you install non-Ubuntu version of openssl (unpatched) you get the "error while loading shared libraries" error, because this is something that was added by Ubuntu devs to their distribution (and I still don't know why and makes no sense and makes lots of trouble). Source: https://askubuntu.com/a/830532/676863

So, mostly you will run into this if you compiled an official version from https://www.openssl.org/source/ e.g. the openssl-1.0.2m.tar.gz version. While official Ubuntu patched (million times according to the guys at #ubuntu on Freenode) version is still openssl-1.0.2g and is the one you want to patch, compile and install to make it working.

Solution (edited from https://stackoverflow.com/a/22634441/3108268):

  1. I used this build https://launchpad.net/ubuntu/+source/openssl/1.0.2g-1ubuntu13 because it was most up-to-date.
  2. wget https://launchpad.net/ubuntu/+archive/primary/+files/openssl_1.0.2g.orig.tar.gz (might need to add --no-check-certificate)
  3. tar -xvf openssl_1.0.2g.orig.tar.gz
  4. wget https://launchpad.net/ubuntu/+archive/primary/+files/openssl_1.0.2g-1ubuntu13.debian.tar.xz
  5. tar -xvf openssl_1.0.2g-1ubuntu13.debian.tar.xz and mv debian openssl_1.0.2g-1ubuntu13
  6. whereis openssl locate current openssl and delete/remove/backup it.
  7. cd openssl_1.0.2g/ and patch -p1 < ../openssl_1.0.2g-1ubuntu13/patches/version-script.patch
  8. make clean and ./config shared --prefix=/usr/local --openssldir=/usr/local/ssl -Wl,--enable-new-dtags,-rpath,'$(LIBRPATH)' (or maybe you just need plain .config, doesn't work for me)
  9. make and make test and make install
  10. openssl version

I also needed to reboot to be able to connect back in via SSH. All these commands were executed via web console on a cloud server. Downloaded file directory names might be different, I didn't check, so do ls -l.

Share:
30,623

Related videos on Youtube

user3108268
Author by

user3108268

Updated on September 18, 2022

Comments

  • user3108268
    user3108268 over 1 year

    enter image description here

    As you can see I'm missing libcrypto and libssl files. I locked out myself from my server after running apt-update and apt-upgrade, I'm running this from web console, because ssh nor any other program won't work because of missing SSL files.

    enter image description here

    I tried removing and installing apt install openssl so did libssl-dev and/or compiling own openssl from a distro. None of these create the needed .so files, I ran locate, those files are not present anywhere on the server.

    There's also libssl1.0.0 which cannot be reinstalled and removing it would cause removal of 700MB of packages that would literally kill server and delete all data.

  • fkraiem
    fkraiem over 4 years
    Please, people, DO NOT DO THIS unless you know exactly what you are doing (and if you are reading this, you probably don't). Additionally, consider downvoting.
  • user3108268
    user3108268 over 4 years
    Do not do this why?