2

My question is related to suggestion feature of apt-get. When we enter some wrong package name apt-get suggests some similar package name. So does apt-get stores the name list of all packages and libraries available on repository locally? And when we do "sudo apt-get update" after adding some 3rd party repository does it update the file having name list.

Sawan
  • 23
  • 3

2 Answers2

0

Yes, all available packages are stored locally and

sudo apt-get update

updates that list.

Pilot6
  • 90,100
  • 91
  • 213
  • 324
0

apt does not only store the names of every available package in all of your enabled repositories, it stores a lot of information around that!

You can view its lists with any editor, as they're plain text files. Just browse the directory

/var/lib/apt/lists

on your local machine. Every file represents one repository, the file name consits of the repository's address, distribution, section and architecture usually. Some example file names:

archive.canonical.com_ubuntu_dists_vivid_partner_binary-i386_Packages
archive.canonical.com_ubuntu_dists_vivid_partner_i18n_Translation-en
ftp-stud.hs-esslingen.de_ubuntu_dists_vivid_main_binary-i386_Packages
ppa.launchpad.net_libreoffice_ppa_ubuntu_dists_vivid_Release

Note that if a file name ends with .gpg, it's not a package index file abut a GPG key that is used to verify the package.

Those index files basically contain a list of every package available in the repository it represents. Each package entry has a structure more or less like the following example snippet from my ftp-stud.hs-esslingen.de_ubuntu_dists_vivid_main_binary-i386_Packages. The contained data fields may vary per package as many of them are optional.

Package: apt
Priority: important
Section: admin
Installed-Size: 3743
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: APT Development Team <deity@lists.debian.org>
Architecture: i386
Version: 1.0.9.7ubuntu4
Replaces: manpages-it (<< 2.80-4~), manpages-pl (<< 20060617-3~), openjdk-6-jdk (<< 6b24-1.11-0ubuntu1~), sun-java5-jdk (>> 0), sun-java6-jdk (>> 0)
Depends: libapt-pkg4.12 (>= 1.0.9.7ubuntu4), libc6 (>= 2.15), libgcc1 (>= 1:4.1.1), libstdc++6 (>= 4.9), ubuntu-keyring, gnupg
Suggests: aptitude | synaptic | wajig, dpkg-dev (>= 1.17.2), apt-doc, python-apt
Conflicts: python-apt (<< 0.7.93.2~)
Breaks: manpages-it (<< 2.80-4~), manpages-pl (<< 20060617-3~), openjdk-6-jdk (<< 6b24-1.11-0ubuntu1~), sun-java5-jdk (>> 0), sun-java6-jdk (>> 0)
Filename: pool/main/a/apt/apt_1.0.9.7ubuntu4_i386.deb
Size: 1007526
MD5sum: bae83438d0e7650003c06cd07fa315d9
SHA1: 8db49e516b515be90149ec7292abb2b7c496efb8
SHA256: 3461fc57d9d2389bb50927ce2f5341b6a8680a1c4f00b699391ee58fead04779
Description: commandline package manager
Description-md5: 9fb97a88cb7383934ef963352b53b4a7
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Build-Essential: yes
Origin: Ubuntu
Supported: 9m
Task: minimal

Just FYI:
If you want to force apt to completely re-read all your package indexes, you may delete this folder's content and let apt-get download the files again afterwards. Note that depending on your internet connection speed, this may take up to a few minutes, as this folder may easily take around 100MB disk space...

sudo rm -r /var/lib/apt/lists/ && sudo apt-get update
Byte Commander
  • 107,489