20

Trying to install libssl-dev on ubuntu 14.04.2

$ make
fatal error: openssl/sha.h: No such file or directory
compilation terminated.

$ sudo apt-get install libssl-dev
The following packages have unmet dependencies:
 libssl-dev : Depends: zlib1g-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

$ sudo apt-get install zlib1g-dev
The following packages have unmet dependencies:
 zlib1g-dev : Depends: zlib1g (= 1:1.2.3.4.dfsg-3ubuntu4) but 1:1.2.8.dfsg-1ubuntu1 is to be installed
E: Unable to correct problems, you have held broken packages.

How can I remove the held package and install the correct?

  • When's the last time you ran sudo apt update and/or sudo apt upgrade? – DopeGhoti Aug 29 '17 at 20:24
  • Hi, I have done both between each steps. – Sam Healey Aug 29 '17 at 20:31
17

First, try entering this: sudo dpkg --configure -a

This will go a long way toward fixing broken dependencies. If that does not suffice, try: sudo apt-get install -f

Then clean and update: sudo apt-get clean && sudo apt-get update

Then upgrade: sudo apt-get upgrade (say 'y' to upgrades)

If you get a message saying some packages are "held back", do this:

sudo apt-get dist-upgrade

Now do these two commands:

sudo apt-get purge zlib1g-dev
sudo apt-get autoremove

Then see what happens when you enter: sudo apt-get install libssl-dev

If it still doesn't work, try this:

sudo aptitude install libssl-dev zliblg-dev=1:1.2.8.dfsg-1ubuntu1

If it still doesn't work, open up Synaptic Package Manager (It should be in your Launcher. If you can't find it, then at the Terminal enter synaptic-pkexec).

Search for zlib1g-dev. If the box next to zlib1g-dev is not green, click on it and select "Mark for installation". If you see more than one version, pick 1:1.2.8.dfsg-1ubuntu1 . Then search for libssl-dev. If the box next to libssl-dev is not green, click on it and select "Mark for installation".

Then select "Apply".

  • Hi, thank you for replying. I did everything above and got the same error as in my original post. When I ran upgrade I got the following message. The following packages have been kept back: linux-generic-lts-utopic linux-headers-generic-lts-utopic linux-image-generic-lts-utopic 0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded. – Sam Healey Aug 30 '17 at 8:13
  • what gives apt-cache policy zlib1g-dev and grep -P '^[ \t]*[^#[ \t]+' /etc/apt/sources.list /etc/apt/sources.list.d/*.list – user192526 Aug 30 '17 at 8:32
  • @Bahamut Are you sure you mean "-P" ? For me, I get E: Command line option 'P' [from -P] is not known. – gracious1 Aug 30 '17 at 23:43
  • @SamHealey I modified my answer somewhat. Try what I suggest there, and let us know how it goes. – gracious1 Aug 31 '17 at 0:05
  • 1
    @Bahamut Why no sudo with graphical program? – gracious1 Sep 11 '17 at 0:51
2

You have to look for all files related with your package and purge them, then reinstall.

sudo dpkg --list
sudo apt-get purge "file-name"

repeat second command with every file and then just reinstall.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.