3

I have done a release upgrade from ubuntu 18.04 to 20.04. Removed previously installed PHP. Then I run

sudo apt install php-cli

but I encounter the error below:

The following packages have unmet dependencies:
 php7.4-cli : Depends: php7.4-common (= 7.4.3-4ubuntu2.4) but 7.4.8-1+ubuntu18.04.1+deb.sury.org+3 is to be installed
              Depends: php7.4-json but it is not going to be installed
              Depends: php7.4-opcache but it is not going to be installed
              Depends: php7.4-readline but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

so I suspect 7.4.8-1+ubuntu18.04.1+deb.sury.org+3 package is still active? I have checked /etc/apt/sources.list and /etc/apt/sources.list.d/ directory and didn't found any source matching that package.

Where else should I look?

Edit

apt policy php7.4-common

php7.4-common:
  Installed: 7.4.8-1+ubuntu18.04.1+deb.sury.org+3
  Candidate: 7.4.8-1+ubuntu18.04.1+deb.sury.org+3
  Version table:
 *** 7.4.8-1+ubuntu18.04.1+deb.sury.org+3 100
        100 /var/lib/dpkg/status
     7.4.3-4ubuntu2.4 500
        500 http://bd.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
     7.4.3-4ubuntu1 500
        500 http://bd.archive.ubuntu.com/ubuntu focal/main amd64 Packages

4
  • 1
    Please add the output of apt policy php7.4-common.
    – pLumo
    Dec 28, 2020 at 10:59
  • You might have some custom "sources" in your apt configuration? Have a look in the software manager and see if that is the case
    – Jad
    Dec 28, 2020 at 11:00
  • Did you run sudo apt update first ? This command will update the package "database" with a list of newest available package versions.
    – Soren A
    Dec 28, 2020 at 11:09
  • @pLumo i've updated the question. SorenA Yes I did
    – Sisir
    Dec 28, 2020 at 11:12

1 Answer 1

5

You uninstalled php, but not it's dependencies, so there are still leftovers from the ppa (I guess it was ppa:ondrej/php).

Try autoremove, it may already be enough:

sudo apt autoremove

If not, you can manually uninstall the packages in question:

sudo apt remove php7.4-common

If that is not enough, it might help adding the ppa again and remove with ppa-purge:

sudo add-apt-repository ppa:ondrej/php
sudo apt install ppa-purge
sudo ppa-purge ppa:ondrej/php
1
  • 1
    it seems ondrej/php was pointing to bionic but it was unchecked (disabled?) when I did the upgrade. From "Software and Updates" I removed it then I updated apt using sudo apt update. Then I removed php7.4-common as per your instruction. It seems there were some leftover packages as well. Now I was able to reinstall PHP. Thanks a lot!
    – Sisir
    Dec 28, 2020 at 11:22

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.