2

I am getting the following error:

root@56709:/etc/nginx/conf.d# apt install php7.4-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php7.4-dev : Depends: libpcre2-dev (>= 10.30) but it is not going to be installed
              Depends: libssl-dev but it is not going to be installed
              Depends: php7.4-common (= 7.4.3-4ubuntu2.4) but 7.4.11-6+ubuntu16.04.1+deb.sury.org+1 is to be installed
              Recommends: pkg-php-tools but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

when running apt install php7.4-dev any idea on how to fix it ?

i tried using aptitude instead of apt and here's what i got

root@56709:/etc/nginx/conf.d# sudo aptitude install php7.4-dev
The following NEW packages will be installed:
  libpcre2-16-0{a} libpcre2-32-0{a} libpcre2-dev{ab} libpcre2-posix2{a} libssl-dev{ab} php7.4-dev{b} pkg-php-tools{a} shtool{a}
0 packages upgraded, 8 newly installed, 0 to remove and 2 not upgraded.
Need to get 3,295 kB of archives. After unpacking 17.7 MB will be used.
The following packages have unmet dependencies:
 php7.4-dev : Depends: php7.4-common (= 7.4.3-4ubuntu2.4) but 7.4.11-6+ubuntu16.04.1+deb.sury.org+1 is installed
 libpcre2-dev : Depends: libpcre2-8-0 (= 10.34-7) but 10.35-5+ubuntu16.04.1+deb.sury.org+1 is installed
 libssl-dev : Depends: libssl1.1 (= 1.1.1f-1ubuntu2) but 1.1.1g-1+ubuntu16.04.1+deb.sury.org+1 is installed
The following actions will resolve these dependencies:

     Keep the following packages at their current version:
1)     libpcre2-dev [Not Installed]
2)     libssl-dev [Not Installed]
3)     php7.4-dev [Not Installed]

I am currently on ubuntu 20.0.4 but if i see above i think i am still referring to 16.04 .. need to somehow update the sources ?

2

4 Answers 4

3

@Henning Kockerbeck's explanation is great. Here is the 2-line solution presented at this blog post

Copy-pasting the code to avoid link-rot in the future:

# apt install libssl-dev
The following packages have unmet dependencies:
libssl-dev : Depends: libssl1.1 (= 1.1.1-1ubuntu2.1~18.04.9) but 1.1.1d-1+ubuntu18.04.1+deb.sury.org+2 is to be installed
E: Unable to correct problems, you have held broken packages.

This explains the various versions that are in conflict, due to which you might have to "hold" a package to a particular version which appears to apt as the not-latest version:

# apt-cache policy libssl1.1
libssl1.1:
  Installed: 1.1.1g-1+ubuntu18.04.1+deb.sury.org+1
  Candidate: 1.1.1g-1+ubuntu18.04.1+deb.sury.org+1
  Version table:
 *** 1.1.1g-1+ubuntu18.04.1+deb.sury.org+1 100
        100 /var/lib/dpkg/status
     1.1.1-1ubuntu2.1~18.04.9 500
        500 http://us-west-2.ec2.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
     1.1.0g-2ubuntu4 500
        500 http://us-west-2.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 Packages

This installs a specific version. Remember that this is a time-bomb and when you want to upgrade later you have remove this version of the package / unhold it.

# apt install libssl1.1=1.1.1-1ubuntu2.1~18.04.9 

Now the versions are OK and php7.x-dev will install properly

# apt-cache policy libssl1.1
libssl1.1:
  Installed: 1.1.1-1ubuntu2.1~18.04.9
  Candidate: 1.1.1-1ubuntu2.1~18.04.9
  Version table:
 *** 1.1.1-1ubuntu2.1~18.04.9 500
        500 http://us-west-2.ec2.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
        100 /var/lib/dpkg/status
     1.1.0g-2ubuntu4 500
        500 http://us-west-2.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 Packages

The minor versions above may vary, but the idea is the same - Sury's packages are causing an issue with system's libssl package. There must be other solutions to keep using Sury's version of libssl, after all he has been maintaining these packages for a decade, which means he must know what he is doing, but I'm not aware of the details of such an alternative approach.

1
  • doing apt install libssl1.1=1.1.1-1ubuntu2.1~18.04.14 solved it for me Jan 19 at 17:36
1

It seems like you have old packages from a PPA installed that throw things into disarray.

You try to install php7.4-dev. That package depends on php7.4-common. For Ubuntu 20.04, php7.4-common actually is 7.4.3-4ubuntu2.4.

But you already have a php7.4-common package installed, namely 7.4.11-6+ubuntu16.04.1+deb.sury.org+1. This seems to be a package for about eight Ubuntu versions ago, but with a slightly newer PHP version (7.4.11 vs. 7.4.3). So apt prefers the supposedly newer package. But 7.4.11-6+ubuntu16.04.1+deb.sury.org+1from the PPA doesn't work with php7.4-dev from Ubuntu 20.04s repositories. So apt is throwing up its proverbial hands up and gives up.

If you don't need it anymore, you should remove the PPA and all packages installed from it. Maybe there are additional PPAs or packages throwing things in disarray, but the above seems to be a problem in any case.

0

aptitude output suggests that dependencies can't be met because conflicting packages from a third-party repository are already installed:

libpcre2-dev : Depends: libpcre2-8-0 (= 10.34-7) but 10.35-5+ubuntu16.04.1+deb.sury.org+1 is installed

Do you have something about deb.sury.org in your package sources (/etc/apt/sources.list and subdirectories)?

Have you tried apt autoremove? This will remove dependencies of uninstalled package (i.e. automatically installed package that are not required by any installed package).

0

Try:

sudo apt install libc6=2.31-0ubuntu9.2 libc-bin=2.31-0ubuntu9.2

Αfter running this command run:

sudo apt install php7.4-dev

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.