3

Is there a way to see all packages in a package repository

(for example, in deb http://archive.ubuntu.com/ubuntu trusty universe)?

  1. In a web browser?
  2. From command line?
Hirurg103
  • 185
  • Do you want to search the content of an installed package (easier) or he content of a not yet installed package (more difficult)? Or the content of all not yet installed packages (you'll have to wade through a lot of output)? – sudodus Feb 14 '20 at 14:15
  • Are you using Trusty Tahr (14.04)? Adding 3rd party repository information won't yield any result. That release reached End of Public support in April 2019.. – Kulfy Feb 14 '20 at 14:21
  • archive.ubuntu.com is not a PPA. None of the applications listed require adding a PPA. One suspects you have been perhaps misled. – user535733 Feb 14 '20 at 14:33
  • @user535733 I am building a docker image from Debian Duster (I updated the question). What is archive.ubuntu.com? Package repository? – Hirurg103 Feb 14 '20 at 14:45
  • @Kulfy I am building a docker image from Debian 10 Buster. – Hirurg103 Feb 14 '20 at 14:47
  • @Hirurg103 Although I have posted an answer, but Debian is off-topic here. – Kulfy Feb 14 '20 at 14:48
  • @sudodus I want to list/search for all packages in a package repository (- or PPA)? Need to learn what is the difference between them – Hirurg103 Feb 14 '20 at 14:49
  • 2
    Difference between a Repository and a PPA: https://askubuntu.com/questions/343333/whats-the-difference-between-a-ppa-and-a-repository. "searching" all packages in a source is most easily done using apt tools, or less-easily by simply using a web browser. Most PPAs are not designed for Debian versions, you may encounter version conflicts. – user535733 Feb 14 '20 at 14:52
  • @Kulfy I updated the question to make it generic and applicable to the both Debian and Ubuntu – Hirurg103 Feb 14 '20 at 16:29
  • @Hirurg103 Though this is a generic question and indeed applicable to both but such edits are usually discouraged by the community. – Kulfy Feb 14 '20 at 16:42
  • @Kulfy I got it - sorry for misleading. I tried to update the question without changing its meaning and purpose. Also the original version didn't have any references to Debian. The question and your answer could be applied to the both OSs. I do not agree that the question is closed as off-topic. Is there a way to reopen it? – Hirurg103 Feb 14 '20 at 18:11
  • 1
    @Hirurg103 Well I'm not sure whether this question should be opened or not. You can take this situation to [meta] and ask for community opinions in such generic cases. – Kulfy Feb 14 '20 at 18:16
  • 1
    I have voted to reopen, I personally don't have an issue with questions being edited to fit Ubuntu better. Community debate on this issue has been heated I know but there is my vote and my opinion... – andrew.46 Feb 15 '20 at 22:18

1 Answers1

4

APT maintains a list of packages in /var/lib/apt/lists that would be downloaded when asked. The files in the above said folder are generally InRelease files or Release files which contains such information. According to DebianRepository/Format - Debian Wiki:

To download packages from a repository apt would download a InRelease or Release file from the $ARCHIVE_ROOT/dists/$DISTRIBUTION directory.

InRelease files are signed in-line while Release files should have an accompanying Release.gpg file.

The Release file lists the index files for the distribution and their hashes (the index file listed are relative to Release file location).

To download index of the main component apt would scan the Release file for hashes of files in the main directory. eg. http://ftp.cz.debian.org/debian/dists/testing/main/binary-i386/Packages.bz2 which would be listed in http://ftp.cz.debian.org/debian/dists/testing/main/Release as binary-i386/Packages.bz2

If you want to check using terminal or using a locally stored files, open a terminal and run:

cat /var/lib/apt/lists/$ARCHIVE_ROOT_dists_$DISTRIBUTION_$COMPONENT_$ARCHITECTURE_Packages

For example:

cat /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_main_binary-amd64_Packages

Alternatively, if you want to check the packages available using a browser, navigate to the corresponding Packages file generally located in $ARCHIVE_ROOT/dists/$DISTRIBUTION/$COMPONENT/$ARCHITECTURE. For example: http://archive.ubuntu.com/ubuntu/dists/trusty/main/binary-amd64/.


Note: The starting paragraph is an excerpt from my other answer on Can't install MySQL 8 on Ubuntu 19.04.

Kulfy
  • 17,696
  • 1
    I logged in my docker image, extracted /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_trusty_universe_binary-amd64_Packages.lz4 and was able to see the full list of packages in the repository.

    Also I visited the repository URL you provided in my browser, downloaded Packages.gz, extracted it and was able to see the full list of packages in that repository.

    Thank you for the answer!

    – Hirurg103 Feb 14 '20 at 15:22
  • 1
    @Hirurg103 Some package maintainers such as MySQL has "Packages" file published beside the gz archive. That makes viewing the file easier right from the browser. Here is the example. – Kulfy Feb 14 '20 at 16:41