While playing with a binary, which happened to be
openvpn, I discovered that I
can't run it, for a very misterious reason:
libcrypto.so.1.1: cannot open shared object file: No such file or directory
Obviously that means that a dynamic library the binary was linked went missing, but I needed more info about the matter.
Turns out there's a tool that is able to tell you everything there is to know
about a binary and the libraries it's using. It's called
ldd and it's great.
With a simple
ldd ./openvpn I was able to infer that much of useful insights
about the issue that forced me to dig deeply:
$> ldd ./openvpn linux-vdso.so.1 => (0x00007ffd291c7000) liblzo2.so.2 => /lib/x86_64-linux-gnu/liblzo2.so.2 (0x00007f0932f11000) liblz4.so.1 => /usr/lib/x86_64-linux-gnu/liblz4.so.1 (0x00007f0932cf9000) libcrypto.so.1.1 => not found libssl.so.1.1 => not found libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007f0933571000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f0932af5000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f093272b000) libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007f0932509000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f0932301000) liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f09320df000) libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007f0931dfe000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f0931be1000) /lib64/ld-linux-x86-64.so.2 (0x00007f09333eb000) libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f0931971000) libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007f093175d000)
With its help I discovered that I have to missing libraries
libcrypto.so.1.1. Turns out they're both provided by OpenSSL 1.1. Because I
was not able to rely on
openssl=1.1 being available on a lot of systems -- I
had to re-compile openvpn against OpenSSL 1.0.0 (also that was because
statically linking openssl and openvpn is
ldd was able to infer that the new binary uses openssl 1.0!
$> ldd ./openvpn linux-vdso.so.1 => (0x00007ffebbd73000) liblzo2.so.2 => /lib/x86_64-linux-gnu/liblzo2.so.2 (0x00007f7933703000) liblz4.so.1 => /usr/lib/x86_64-linux-gnu/liblz4.so.1 (0x00007f79334eb000) libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007f79330a6000) libssl.so.1.0.0 => /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007f7932e3d000) ------------^ libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7932a73000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f793286f000) /lib64/ld-linux-x86-64.so.2 (0x00007f7933925000)
What a small and great utility, do use it, it won't ever lie to you.
Also, note that
ldd is Linux only, but there's a similar utility available on
MacOS -- it's called