Linux – Accidentally deleted openssl lib packages and can’t get yum or wget to work again

centoslinuxssl

So I was trying to upgrade openssl and decided to remove the existing openssl packages because it was from a different repository.

Once removed, I can't no longer get either yum or wget to work again because they all seem to rely on ssl

I'm missing the files

libssl.so.10
libcrypto.so.10

I was able to recover libssl.so.10 by using libssl3.so that existed locally, but not with libcrypto.so.10 yet (since this file probably need to be downloaded from a remote location).

yum:

The error leading to this problem was:
libcrypto.so.10: cannot open shared object file: No such file or directory

wget:

wget: error while loading shared libraries: libcrypto.so.10:

In other words, I'm now in a catch-22; I can't use yum, wget, curl, rpm (with url), or rsync (by connecting to a backup server instance) because they all require ssl lib files.

I can't even open a new SSH to the problematic server since SSL lib files is now gone. (can only access with existing Putty prompt).

I try "copy and paste" the file content with VIM editor using another snapshot backup but doesn't seem working.

I'm thinking if there is a way to download a rpm or even a single file over plain http using existing tools not listed above…

Best Answer

NOT SO GOOD. Try and avoid --force in RPM command unless you know what you're doing.

To try and recover to a decent state so you can attempt proper recovery, run from the backup or another identical server:

# tar cfz - $(rpm -ql openssl) | base64 > oh_my_god_what_did_I_do

Copy the output of that (in the oh_my_god_what_did_I_do file) into the clipboard and paste it into the other server:

# cat > oh_my_god_what_did_I_do
(paste here)
^D
# cd /; base64 -d < oh_my_god_what_did_I_do | tar xfz -

Good luck.

(if you're savvy, you can come up with other ways to move that file. NFS, netcat, it's not hard to find something)