Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dpkg-query vs apt-cache: different package lists?

Tags:

ubuntu

apt

dpkg

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?

like image 208
Andrzej Pronobis Avatar asked May 25 '26 12:05

Andrzej Pronobis


1 Answers

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.

like image 66
Guillem Jover Avatar answered May 27 '26 12:05

Guillem Jover



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!