Issue
I noticed an interesting phenomenon and I am looking for an explanation. On my Ubuntu 15.10 (alpha) system, dpkg-query
cannot find some uninstalled packages which apt-cache
can find. For instance,
dpkg-query -l libssl-dev
gives me:
dpkg-query: no packages found matching libssl-dev
while:
apt-cache show libssl-dev
finds the package information. At the same time, dpkg-query
can locate other uninstalled packages, e.g. gimp and show their status as uninstalled. Why are some packages not visible to dpkg-query
?
Solution
dpkg-query
is primarily intended to work on packages present on the system (including packages in various states, from installed, unpacked to packages that have been removed but not yet purged), or packages that have selections, for example a non-installed package marked for installation. A package purged and without any selections will be garbage collected from the dpkg
status file, and will not be shown by default by dpkg-query
. You can still ask it to show available packages from repositories by using the --load-avail
option, as long as your available file is up-to-date that will also give good results. See this FAQ entry for more information on how to do that.
apt-cache
is intended to be used for both installed packages and packages available from the configured repositories for apt
, in contrast to other possible dpkg
frontends.
Answered By - Guillem Jover Answer Checked By - Senaida (WPSolving Volunteer)