3

I am using Ubuntu 22.04. I know I can get the information about where a package comes from via apt-cache policy <package name> (related question). I want to find out how I installed a specific package (php8.3 to be specific) before. Therefore I issue this command:

apt-cache policy php8.3

I know that PHP 8.3 does not come with Ubuntu 22.04, therefore I would like to know where did it come from.

Output of the command above:

php8.3:
  Installed: 8.3.2-1+ubuntu20.04.1+deb.sury.org+1
  Candidate: 8.3.2-1+ubuntu20.04.1+deb.sury.org+1
  Version table:
 *** 8.3.2-1+ubuntu20.04.1+deb.sury.org+1 100
        100 /var/lib/dpkg/status
root@yourappapp-vm:~# apt showpkg php8.3
E: Invalid operation showpkg
root@yourappapp-vm:~# apt-cache showpkg php8.3
Package: php8.3
Versions: 
8.3.2-1+ubuntu20.04.1+deb.sury.org+1 (/var/lib/dpkg/status)
 Description Language: 
                 File: /var/lib/dpkg/status
                  MD5: 86488d7a405bdcbac9ece7c307f30abb


Reverse Depends: 
  php,php8.3
Dependencies: 
8.3.2-1+ubuntu20.04.1+deb.sury.org+1 - libapache2-mod-php8.3 (16 (null)) php8.3-fpm (16 (null)) php8.3-cgi (0 (null)) php8.3-common (0 (null)) 
Provides: 
8.3.2-1+ubuntu20.04.1+deb.sury.org+1 - php (= ) 
Reverse Provides: 

It only mentions /var/lib/dpkg/status instead of the repository name. For other packages that come with Ubuntu 22.04, it will display the correct repository information:

# apt-cache showpkg openssl
Package: openssl
Versions: 
3.0.2-0ubuntu1.15 (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_jammy-updates_main_binary-amd64_Packages) (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_jammy-security_main_binary-amd64_Packages) (/var/lib/dpkg/status)
 Description Language: 
                 File: /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_jammy_main_binary-amd64_Packages
                  MD5: 9b6de2bb6e1d9016aeb0f00bcf6617bd
 Description Language: en
                 File: /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_jammy_main_i18n_Translation-en
                  MD5: 9b6de2bb6e1d9016aeb0f00bcf6617bd
 Description Language: 
                 File: /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_jammy-updates_main_binary-amd64_Packages
                  MD5: 9b6de2bb6e1d9016aeb0f00bcf6617bd

3.0.2-0ubuntu1 (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_jammy_main_binary-amd64_Packages)
 Description Language: 
                 File: /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_jammy_main_binary-amd64_Packages
                  MD5: 9b6de2bb6e1d9016aeb0f00bcf6617bd
 Description Language: en
                 File: /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_jammy_main_i18n_Translation-en
                  MD5: 9b6de2bb6e1d9016aeb0f00bcf6617bd
 Description Language: 
                 File: /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_jammy-updates_main_binary-amd64_Packages
                  MD5: 9b6de2bb6e1d9016aeb0f00bcf6617bd


Reverse Depends: 
...(skipping the dependencies, too long)

My question is: how do I know which repository my PHP 8.3 comes from?


Here is my Source list:

/etc/apt/sources.list:deb http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
/etc/apt/sources.list:deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted universe multiverse
/etc/apt/sources.list:deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
/etc/apt/sources.list:deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted universe multiverse
/etc/apt/sources.list:deb http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
/etc/apt/sources.list:deb-src http://archive.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
/etc/apt/sources.list:deb http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
/etc/apt/sources.list:deb-src http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
/etc/apt/sources.list.d/digitalocean-agent.list:deb [signed-by=/usr/share/keyrings/digitalocean-agent-keyring.gpg] https://repos.insights.digitalocean.com/apt/do-agent main main
/etc/apt/sources.list.d/digitalocean-agent.list.distUpgrade:deb [signed-by=/usr/share/keyrings/digitalocean-agent-keyring.gpg] https://repos.insights.digitalocean.com/apt/do-agent main main
/etc/apt/sources.list.d/digitalocean-agent.list.save:deb [signed-by=/usr/share/keyrings/digitalocean-agent-keyring.gpg] https://repos.insights.digitalocean.com/apt/do-agent main main
/etc/apt/sources.list.d/droplet-agent.list:deb [signed-by=/usr/share/keyrings/droplet-agent-keyring.gpg] https://repos-droplet.digitalocean.com/apt/droplet-agent main main
/etc/apt/sources.list.d/droplet-agent.list.distUpgrade:deb [signed-by=/usr/share/keyrings/droplet-agent-keyring.gpg] https://repos-droplet.digitalocean.com/apt/droplet-agent main main
/etc/apt/sources.list.d/droplet-agent.list.save:deb [signed-by=/usr/share/keyrings/droplet-agent-keyring.gpg] https://repos-droplet.digitalocean.com/apt/droplet-agent main main
/etc/apt/sources.list.d/ondrej-ubuntu-apache2-focal.list.distUpgrade:deb http://ppa.launchpad.net/ondrej/apache2/ubuntu focal main
/etc/apt/sources.list.d/ondrej-ubuntu-php-focal.list.distUpgrade:deb http://ppa.launchpad.net/ondrej/php/ubuntu focal main
/etc/apt/sources.list.d/ondrej-ubuntu-php-focal.list.save:deb http://ppa.launchpad.net/ondrej/php/ubuntu focal main
/etc/apt/sources.list.d/ubuntu-esm-infra.list.save:deb https://esm.ubuntu.com/infra/ubuntu xenial-infra-security main
/etc/apt/sources.list.d/ubuntu-esm-infra.list.save:deb https://esm.ubuntu.com/infra/ubuntu xenial-infra-updates main
0

1 Answer 1

6

If apt-cache policy shows /var/lib/dpkg/status for a particular package version, then that version is no longer present in any of the currently available package lists. So apt does not know which repository it can be installed from now, it only knows that this version is currently installed, or otherwise referred to in dpkg's database (e.g., due to leftover configuration files). In general, you'd generally have to inspect other things, such as the package's license information, README, etc. for any information on who might have packaged it. Check the output of dpkg -L php8.3 for files in /usr/share that might provide hints.

In this specific case, though, the answer is easy: the version contains the suffix +deb.sury.org+1, which is used by Ondřej Surý's PPAs and unofficial repositories. In this case, that would be this disabled source:

/etc/apt/sources.list.d/ondrej-ubuntu-php-focal.list.save:deb http://ppa.launchpad.net/ondrej/php/ubuntu focal main

Presumably it was disabled on upgrade from 20.04 to 22.04. You can add back that PPA, it does have packaged php8.3 for 22.04.

(Of course, you'd have to consider the possibility that some other repo also had a package which that version suffix and that's what you installed instead of Ondřej Surý's package, but I'd guess that's unlikely.)

You must log in to answer this question.

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