I am trying to install libpcre3-dev but it gives me the follwing error:

The following packages have unmet dependencies: libpcre3-dev : Depends: libpcre3 (= 2:8.38-3.1) but 2:8.39-1+deb.sury.org~trusty+1 is to be installed E: Unable to correct problems, you have held broken packages.

The 2:8.39-1+deb.sury.org~trusty+1 is from an 'old' ppa (ondrej), so I took a fresh and new Sources.list.

I had the same issue with php7.0-dev and ended up uninstalling php7.0 and installing it from the official repos.

Now when I want to remove libpcre3 it wants to remove nearly all of my packages? Is there another way to "change" the libpcre3 package to the "official" one?

I also tried this, with no luck



sudo apt-get install libpcre3=2:8.38-3.1 libpcre3-dev=2:8.38-3.1

to force apt-get to install version 2:8.38-3.1 of those packages.

Warning: Only use this this if you are really sure you want to install version 2:8.38-3.1 (the version from the official Ubuntu 16.04 repository) of the packages libpcre3 and libpcre3-dev.

If you are not running Ubuntu 16.04 you should change the version number to the version you actually want to install.

  • 3
    This does not work on ubuntu 18.04. It gives Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package 2:8.41-1.1+ubuntu17.10.1+deb.sury.org+3 E: Couldn't find any package by glob '2:8.41-1.1+ubuntu17.10.1+deb.sury.org+3' E: Couldn't find any package by regex '2:8.41-1.1+ubuntu17.10.1+deb.sury.org+3' – kashish Jul 21 '18 at 12:13
  • 1
    OMG this just uninstalled my entire PHP distro, including phpmyadmin, mysql, apache and all this other random stuff, and cause my webserver to serve raw code to the browser. Downvoting this answer sorry, can you please provide any links to some relevant knowledge so future punters don't do whatever it is I just did? Ubuntu 18.04LTS btw – Abraham Brookes Feb 28 '19 at 0:10
  • @AbrahamBrookes: I added a warning. It seems you still have package sources for 16.04 activated on your system. By forcing to install libpcre3 from 16.04 APT removed all packages depending on the 18.04 version of libpcre3. It's usually a good idea to remove old package sources. – Florian Diesch Mar 1 '19 at 12:46

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.