-1

I wanted to remove the symlink to openssl, but I accidentally did a rm openssl in /usr/bin instead of in the directory of the symlink.

How can I recover so openssl is active again? I tried sudo apt-get update and upgrade but it's not working.

For now I copy the openssl from the symlink directory to /usr/bin, but there must be some easier way to do this.

Thanks for the help.

6
  • 3
    There is no must be at all. When you copied the file did you fix the problem. If not exactly what messages are you seeing ?.
    – user9517
    Jan 6, 2016 at 7:49
  • Okay, this might be unrelated problem, but my server is Ubuntu 13.10. I run dpkg -s openssl and it shows 1.0.1e-3ubuntu1.1. So to patch it to fix Heartbleed, I run apt-get update and apt-get upgrade, rebooted, but it still shows that version. So I decided to install the latest openssl version from source and symlink to the /usr/bin. Now openssl version shows the latest version but dpkg -s openssl still shows the 1.0.1e-3ubuntu1.1 version. That's when I accidentally removed the openssl in the /usr/bin folder.
    – Henson
    Jan 6, 2016 at 8:02
  • Installing a program from source does not change the information in the package manager. So apt still thinks you have the old version installed. There is nothing wrong with that, except that apt will overwrite your manually installed program when an updated package becomes available. Jan 6, 2016 at 8:06
  • With such an old version of Ubuntu there will be no updates in this case, so you are safe in this instance, but the prudent way would be to upgrade to a newer version of Ubuntu, the support for 13.10 ended in 2014. Jan 6, 2016 at 8:07
  • @GeraldSchneider But from the documentation, it said that the latest openssl 13.10 is 1.0.1e-3ubuntu1.2, but why do I only get 1.0.1e-3ubuntu1.1? I plan on upgrading, but not before I am confident it will not affect anything on my server first.
    – Henson
    Jan 6, 2016 at 8:33

2 Answers 2

4

sudo apt-get update and sudo apt-get upgrade don't work because apt doesn't know the file is missing, it only knows that the package is installed.

Generally speaking there are some options to restore the file:

  • Restore the file from a backup
  • Copy the file over from an identical system (same version and architecture)
  • Reinstall the package with sudo apt-get install --reinstall <package>

It is quite possible that OpenSSL is necessary for apt to run, so the last point might fail, can't test that right now. If that is the case, it should still be possible to download the OpenSSL .deb file from a mirror (or maybe you even have it on your local disk in the apt cache) and install it via dpkg -i <.deb-file>.

The official .deb package for your Ubuntu version that fixes the heartbleed bug is available here:

https://launchpad.net/~ubuntu-security/+archive/ubuntu/ppa/+build/5887002

But normally you should get this package with a normal update. If you don't, it may be possible that the mirror you are using is outdated. If you use a local mirror, change it to one of the official ones (as described here).

In your case, with openssl being self compiled, I'd just recompile and reinstall it.

10
  • 1
    In case the OP needs it, apt packages cache is here: /var/cache/apt/archives. Jan 6, 2016 at 8:29
  • 1
    Just checked in a VM - apt-get works without /usr/bin/openssl so reinstalling openssl by using your command should do the trick!
    – Anubioz
    Jan 6, 2016 at 8:35
  • There's no openssl in the apt cache. And when I tried to reinstall, it said "Reinstallation of openssl is not possible, it cannot be downloaded". Is there any problem if I just use the self-compiled version openssl and put it in usr/bin?
    – Henson
    Jan 6, 2016 at 8:35
  • Also you can download the package manually from packages.ubuntu.com/wily/amd64/openssl/download and run dpkg -i openssl*
    – Anubioz
    Jan 6, 2016 at 8:37
  • 1
    @kasperd exactly: sudo apt-get install --reinstall openssl
    – Henson
    Jan 6, 2016 at 19:41
1

In case anyone runs into this on RHEL or CENTOS, and doesn't have access to the appropriate repositories. I ended up having to find which package I had installed.

> rpm -qa | grep openssl
openssl-devel-1.0.1e-42.el7.9.x86_64
openssl-1.0.1e-42.el7.9.x86_64

Download the correct RPM from the internet, and then used RPM to fix it

> rpm --replacefiles --replacepkgs openssl-1.0.1e-42.el7.9.x86_64

I know this is old and not directly relevant to the OP's question. but when searching for this problem this was the first answer to come up. I hope this saves a few minutes for the next guy who stumbles across this.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .