Ubuntu – How to stop using Anaconda’s Version of OpenSSL

18.04anacondacommand lineopenssl

I ran the following command:

sudo apt-get install --only-upgrade openssl

and the output was:

openssl is already the newest version (1.1.0g-2ubuntu4.1).

However, when I type openssl version -a into the terminal, the output is:

OpenSSL 1.0.2o  27 Mar 2018
built on: reproducible build, date unspecified
platform: linux-x86_64
options:  bn(64,64) rc4(16x,int) des(idx,cisc,16,int) idea(int) blowfish(idx) 
compiler: /tmp/build/80754af9/openssl_1522162531585/_build_env/bin/x86_64-conda_cos6-linux-gnu-cc -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -pipe -I/home/vedantroy/anaconda3/include -fdebug-prefix-map=/tmp/build/80754af9/openssl_1522162531585/work=/usr/local/src/conda/openssl-1.0.2o -fdebug-prefix-map=/home/vedantroy/anaconda3=/usr/local/src/conda-prefix -Wa,--noexecstack -I. -I.. -I../include  -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -m64 -DL_ENDIAN -O3 -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM
OPENSSLDIR: "/home/vedantroy/anaconda3/ssl"

Furthermore, typing which openssl outputs: /home/vedantroy/anaconda3/bin/openssl.

It seems my system is using the conda installation of "openssl" instead of the one installed by apt-get. How do I force my system to use the version of "openssl" that is installed by apt-get?

Best Answer

The openssl package installs an executable file called openssl as /usr/bin/openssl (see dpkg -L openssl).

You have openssl installed as /home/vedantroy/anaconda3/bin/openssl.

The directory /home/vedantroy/anaconda3/bin occurs in $PATH before /usr/bin appears.

Your $SHELL picks the first openssl it sees.

You have several choices:

  • Rearrange $PATH. However, if there are any other system binaries Anaconda wants to override, this will screw that up.
  • I assume that you own the directory /home/vedantroy/anaconda3/bin, so chmod -x /home/vedantroy/anaconda3/bin/openssl;rehash will let you use /usr/bin/openssl.
  • Add alias openssl="/usr/bin/openssl" to your ~/.bashrc. WIll only work for shells.
Related Question