7

I can get a list of all available packages and their details using the following command:

apt-cache search .

Which outputs a list of packages which looks like this:

i   0ad                - Real-time strategy game of ancient warfare
i   0ad-data           - Real-time strategy game of ancient warfare (data files)                            
i   0ad-data-common    - Real-time strategy game of ancient warfare (common data files)                        
p   0ad-dbg            - Real-time strategy game of ancient warfare (debug)                                    
p   0xffff             - Open Free Fiasco Firmware Flasher                                                     
p   2ping              - Ping utility to determine directional packet loss                                     
p   2vcard             - perl script to convert an addressbook to VCARD file format                            
p   3270-common        - Common files for IBM 3270 emulators and pr3287                                        
p   389-admin          - 389 Directory Administration Server 
...

How can I get such a list of packages for a version of Ubuntu which I don't have installed?

So, specifically, where can I download the database of all available packages for a specific version of Ubuntu, and how do I get the details (Possibly including version, size, long description...) from it, in plaintext or in a format which is easy to parse with a script?

2
  • For me apt-cache search . or apt-cache search '' out put 23xx lines which is in fact the whole amount of all possible packages including different DE versions.
    – Videonauth
    Jun 12, 2016 at 16:35
  • 2
    If this didn't have a bounty, I'd suggest this to be a dupe of askubuntu.com/q/722439/158442
    – muru
    Jun 19, 2016 at 18:46

3 Answers 3

10
+50

1. On-line

I prefer use of http://packages.ubuntu.com/ as muru's answer

2. Off-line, Manual

Otherwise looking for an off-line solution then you should be MR. APT and start downloading them from http://archive.ubuntu.com/ubuntu/dists/.

p=$(pwd); for c in main universe multiverse restricted; do for u in "" -security -updates; do for a in binary-amd64 binary-i386; do mkdir trusty${u}_${c}_$a; cd trusty${u}_${c}_$a; wget http://archive.ubuntu.com/ubuntu/dists/trusty$u/$c/$a/Packages.bz2; cd $p; done; done; done;

Results:

$ tree
.
├── trusty_main_binary-amd64
│   └── Packages.bz2
├── trusty_main_binary-i386
│   └── Packages.bz2
├── trusty_multiverse_binary-amd64
│   └── Packages.bz2
├── trusty_multiverse_binary-i386
│   └── Packages.bz2
├── trusty_restricted_binary-amd64
│   └── Packages.bz2
├── trusty_restricted_binary-i386
...

3. Off-line, using apt-cache/overlay-filesystem/chroot

Going bad, advanced setup:

Actually, I'm going to use a custom sources.list* with same apt-cache installed on 16.04, but apt will not overwrite the 16.04 real lists files in /var/lib/apt/lists/, changes will go to the overlay file-system.

Setup:

sudo apt-get install chroot
mkdir sandbox0
cd sandbox0
mkdir upper work merged
sudo mount -t overlay overlay -o lowerdir=/,upperdir=./upper,workdir=./work ./merged
sudo chroot merged/
echo "deb http://archive.ubuntu.com/ubuntu/ trusty universe multiverse main restricted" > /etc/apt/sources.list
rm -r /etc/apt/sources.list.d/*
apt-get update
exit

Use: (you may prepare a script)

sudo mount -t overlay overlay -o lowerdir=/,upperdir=./upper,workdir=./work ./merged
sudo chroot merged/

apt-cache ...
4
+100

Use chdist. This command allows you to run apt-get and apt-cache as usual, but for a different release of Ubuntu (or Debian or in fact any other Debian-derived distribution).

It also provides a wrapper around grep-dctrl which easily allows you to search and report on metadata fields.

2
  • 1
    Thanks, this seems to offer exactly what I need, and looks like it'll be easier to get working than the method from Sneetsher's answer. Jun 25, 2016 at 14:18
  • Great, this is the canonical answer. You beat me :D. Nice to know about such tool.
    – user.dz
    Jun 25, 2016 at 18:26
2

You already have the command to list all possible posted, but ok lets go a bit deeper shall we? So apt-cache search . or apt-cache search '' output around 2300+ lines which is in fact the whole amount of all possible packages including different DE versions.

To make it more easy you could only get the names with:

apt-cache search '' | sort -d | awk '{print $1}'

Or is you like more information and dont mind a long long list you could roll that through apt-cache policy:

apt-cache policy $(apt-cache search '' | sort -d | awk '{print $1}')
6
  • 4
    Yes, but I asked "for a specific version of Ubuntu which I don't have installed ?", so I don't have this list in my apt-cache yet, I need to get it from the internet somehow. Do you know how I could do that ? Jun 12, 2016 at 16:47
  • mhmm yes at least for the desktop versions there are manifest files, let me find the link to one ok?
    – Videonauth
    Jun 12, 2016 at 16:49
  • releases.ubuntu.com/16.04/ubuntu-16.04-desktop-amd64.manifest thats the one for 16.04 LTS, and 14.04.4 here releases.ubuntu.com/14.04/ubuntu-14.04.4-desktop-amd64.manifest then you have them as file form.
    – Videonauth
    Jun 12, 2016 at 16:51
  • Unfortunately that isn't the complete list of all available packages (It's just the list of packages on the ISO), which is what I need, nor does it have the descriptions and other data, which I need as well. Any other possibilities ? Jun 12, 2016 at 16:53
  • Not that I know, really this is the best guess I can give you. the lists in the manifest only not contain the canonical stuff I think. they are beside that pretty complete.
    – Videonauth
    Jun 12, 2016 at 16:58

You must log in to answer this question.

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