419

Is there a way I can see all the versions that are in the archives that I have configured in sources.list. I can see the last version of each archive withapt-get policy, but how can I see them all?

Is there any way that this can also include PPA and anything in sources.list.d?

0

5 Answers 5

409

As far as I understand your requirements, the madison option for apt-cache does what you want:

madison /[ pkg(s) ]
apt-cache's madison command attempts to mimic the output format and a subset of the functionality of the Debian archive management tool, madison. It displays available versions of a package in a tabular format. Unlike the original madison, it can only display information for the architecture for which APT has retrieved package lists (APT::Architecture).

On my computer:

$ apt-cache madison f-spot
    f-spot | 0.7.2-1~ppa~lucid0 | http://ppa.launchpad.net/f-spot/f-spot-ppa/ubuntu/ lucid/main Packages
    f-spot | 0.6.1.5-2ubuntu7 | http://ro.archive.ubuntu.com/ubuntu/ lucid-updates/main Packages
    f-spot | 0.6.1.5-2ubuntu6 | http://ro.archive.ubuntu.com/ubuntu/ lucid/main Packages
    f-spot | 0.6.1.5-2ubuntu6 | http://ro.archive.ubuntu.com/ubuntu/ lucid/main Sources
    f-spot | 0.6.1.5-2ubuntu7 | http://ro.archive.ubuntu.com/ubuntu/ lucid-updates/main Sources

I hope this is what you need. It also includes the ppas.

4
223

The command

apt list -a <package name>

is the equivalent of madison.

1
  • Can second, I like the output this command produces. I just want to know the version numbers available to me, I don't need all the additional information and warnings and messaging.
    – bjd2385
    Jul 15, 2020 at 13:37
68

The rmadison program from the devscripts package will remotely query the Ubuntu archive and give you the status of a package in all supported releases, not only those you have locally insatlled. This is slightly more than what you want, but should get the job done easily.

Example:

lfaraone@stone:~$ rmadison sudo
      sudo | 1.6.8p12-1ubuntu6 |        dapper | source, amd64, i386, powerpc
      sudo | 1.6.8p12-1ubuntu6.3 | dapper-security | source, amd64, i386, powerpc
      sudo | 1.6.8p12-1ubuntu6.3 | dapper-updates | source, amd64, i386, powerpc
      sudo | 1.6.9p10-1ubuntu3 |         hardy | source, amd64, i386
      sudo | 1.6.9p10-1ubuntu3.8 | hardy-security | source, amd64, i386
      sudo | 1.6.9p10-1ubuntu3.8 | hardy-updates | source, amd64, i386
      sudo | 1.6.9p17-1ubuntu3 |        jaunty | source, amd64, i386
      sudo | 1.6.9p17-1ubuntu3.3 | jaunty-security | source, amd64, i386
      sudo | 1.6.9p17-1ubuntu3.3 | jaunty-updates | source, amd64, i386
      sudo | 1.7.0-1ubuntu2 |        karmic | source, amd64, i386
      sudo | 1.7.0-1ubuntu2.4 | karmic-security | source, amd64, i386
      sudo | 1.7.0-1ubuntu2.4 | karmic-updates | source, amd64, i386
      sudo | 1.7.2p1-1ubuntu5 |         lucid | source, amd64, i386
      sudo | 1.7.2p1-1ubuntu5.1 | lucid-security | source, amd64, i386
      sudo | 1.7.2p1-1ubuntu5.1 | lucid-updates | source, amd64, i386
      sudo | 1.7.2p7-1ubuntu1 |      maverick | source, amd64, i386

before you can use rmadison you must install the devscripts package:

sudo apt-get install devscripts
3
38

I don't know how (or why) you said apt-cache policy doesn't show all versions! I'm using this for several years now and It always showed all versions including the priority number.

Output of apt-cache policy nautilus

nautilus:
  Installed: 1:3.18.5-0ubuntu1~xenial1
  Candidate: 1:3.18.5-0ubuntu1~xenial1
  Version table:
 *** 1:3.18.5-0ubuntu1~xenial1 500
        500 file:/media/Linux/apt-repo/xenial1  Packages
        500 http://ppa.launchpad.net/budgie-remix/ppa/ubuntu xenial/main amd64 Packages
        500 http://ppa.launchpad.net/gnome3-team/gnome3/ubuntu xenial/main amd64 Packages
        100 /var/lib/dpkg/status
     1:3.18.4.is.3.14.3-0ubuntu5 500
        500 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
     1:3.18.4.is.3.14.3-0ubuntu4 500
        500 file:/media/Linux/apt-repo/xenial1  Packages
        500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
     1:3.14.2-0ubuntu13 500
        500 file:/media/Linux/apt-repo/wily  Packages

Output of apt-cache madison nautilus

  nautilus | 1:3.18.5-0ubuntu1~xenial1 | file:/media/Linux/apt-repo/xenial1  Packages
  nautilus | 1:3.18.5-0ubuntu1~xenial1 | http://ppa.launchpad.net/budgie-remix/ppa/ubuntu xenial/main amd64 Packages
  nautilus | 1:3.18.5-0ubuntu1~xenial1 | http://ppa.launchpad.net/gnome3-team/gnome3/ubuntu xenial/main amd64 Packages
  nautilus | 1:3.18.4.is.3.14.3-0ubuntu5 | http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
  nautilus | 1:3.18.4.is.3.14.3-0ubuntu4 | file:/media/Linux/apt-repo/xenial1  Packages
  nautilus | 1:3.18.4.is.3.14.3-0ubuntu4 | http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
  nautilus | 1:3.14.2-0ubuntu13 | file:/media/Linux/apt-repo/wily  Packages

Only difference is that madison took some more time than policy and shorter version. But, policy is more useful to see which version get installed, which version is next candidate to be installed.

That's why I'd suggest always using apt-cache policy <package-name> instead.

Note about output: I have some local repository setup and both of the command shows those as well.

Note 2 Newer apt comes with policy integrated into them. So, you can use apt instead of apt-cache directly.

0

Neither rmadison nor apt-cache policy will show all packages available. This is due to them relying on the package manifest list contained within each repo. However, rmadison is slightly better because it will show you packages available from all repositories you have added to your system instead of the top weighted ones like apt-cache policy does.

If you really want to see, browse to the repository in question in your web browser and go to the correct path (something like this: https://repo.zabbix.com/zabbix/6.3/ubuntu/pool/main/z/zabbix/).

You'll then see all the debs there you could potentially install for a particular version even before the vendor updates the manifest for apt to grab the "newest" release.

I'm sure this could also be done with a simple for loop and curl in a bash script.

1
  • This solution depends on the apt repository's HTTP server having directory indexing available. For repositories hosted on Amazon S3, for instance, that won't be the case. Regardless, if the apt repository's manifest doesn't list a package, that package isn't "in" the repository, and if you download and install it directly then things like "apt-get upgrade" may well get confused in future. Jul 18 at 5:56

You must log in to answer this question.

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