Welcome to the Linux Foundation Forum!

Where Are Application Details Saved

Where is package details stored if the package is not listed in /var/lib/dpkg/available?


The Context

On this DPKG module page, it says to use dpkg -p wget to show the information about an installed package.

Here is the output on a newly installed Ubuntu 18.04...

  1. me@me:~$ dpkg -l | grep wget
  2. ii wget 1.19.4-1ubuntu2.2 amd64 retrieves files from the web
  3. me@me:~$ dpkg -L wget
  4. /.
  5. /etc
  6. /etc/wgetrc
  7. /usr
  8. /usr/bin
  9. /usr/bin/wget
  10. /usr/share
  11. /usr/share/doc
  12. /usr/share/doc/wget
  13. /usr/share/doc/wget/AUTHORS
  14. /usr/share/doc/wget/MAILING-LIST
  15. /usr/share/doc/wget/NEWS.gz
  16. /usr/share/doc/wget/README
  17. /usr/share/doc/wget/changelog.Debian.gz
  18. /usr/share/doc/wget/copyright
  19. /usr/share/info
  20. /usr/share/info/wget.info.gz
  21. /usr/share/man
  22. /usr/share/man/man1
  23. /usr/share/man/man1/wget.1.gz
  24. me@me:~$ dpkg -p wget
  25. dpkg-query: package 'wget' is not available
  26. Use dpkg --info (= dpkg-deb --info) to examine archive files,
  27. and dpkg --contents (= dpkg-deb --contents) to list their contents.
  28. me@me:~$ apt-cache show wget
  29. Package: wget
  30. Architecture: amd64
  31. Version: 1.19.4-1ubuntu2.2
  32. Multi-Arch: foreign
  33. Priority: standard
  34. Section: web
  35. Origin: Ubuntu
  36. Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
  37. Original-Maintainer: Noël Köthe <noel@debian.org>
  38. Bugs: https://bugs.launchpad.net/ubuntu/+filebug
  39. Installed-Size: 932
  40. ...(I trimmed off the rest of the output details to save space)...

When I look in man dpkg, I find this...

  1. -p, --print-avail package-name...
  2. Display details about package-name, as found in
  3. /var/lib/dpkg/available. Users of APT-based frontends
  4. should use apt-cache show package-name instead.

When I search /var/lib/dpkg/available, there is nothing listed for wget. If I run dpkg -p <package> against a package listed in /var/lib/dpkg/available is does return details.

So since the package is obviously installed, I ran apt-cache show wget to find the details and it returned details. So obviously, apt-cache show is pulling from somewhere else.

As a result, I decided to read the manual at man apt-cache. It has this...

  1. show pkg...
  2. show performs a function similar to dpkg --print-avail; it displays the package records for
  3. the named packages.

While the action is obviously similar, it is not exactly the same. And I am back at to where I started.

Comments

  • Posts: 1,276
    edited June 2020

    Hi @teachernightowl ,

    I was able to reproduce the behaviour. For some reason, there are many packages on /var/lib/status that are installed, and that are not present in /var/lib/available (and they should). You can confirm that by doing the following:

    grep "Package: " available > /tmp/packages_available

    grep "Package: " status > /tmp/packages_status

    Then compare these files; you will find that there are a lot of packages in /tmp/packages_status that are not in /tmp/packages_available . Why the OS has failed in mantain an updated /var/lib/dpkg/available file? No idea.

    Can this be fixed? Yes, totally! I haven't had the need to do this before, this is the first time I see this issue.

    So, this can be reconciliated by merging the apt-cache database for available packages with dpkg. This is how it's done:

    apt-cache dumpavail | dpkg --merge-avail

    So, if you dump the output of apt-cache dumpavail to a file, you will see that "wget" is there (apt-cache dumpavail > apt_packages). Then the output of the first command is passed to dpkg--merge-avail through a pipe.

    Then next time you do "dpkg -p wget" it will work (I confirmed it on my Ubuntu LTS 18.04 image).

    Note: I found useful information here: https://wiki.debian.org/Teams/Dpkg/FAQ

    I hope this helps.

    Many regards,
    Luis.

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training