1

I'm trying to use dpkg tool to list which packages are installed on my machine. Using the -l option it reports "un" for some packages which means unknown, "not-installed". Does "not-installed" flag means that there is such a package, it is available for the system I'm running at but it's not present on my machine (locally) and I have to download the .deb file from the web and install it?

1

I’ll address the underlying question first:

dpkg -l | grep '^.i'

will list all installed packages. Other tools can provide this information too; for example

apt list --installed

In dpkg -l’s output, “not-installed” does indeed mean that dpkg is aware of a package’s existence, even though it’s not installed on your system. The package file itself might be available on your system, for example in the APT cache in /var/cache/apt/archives, but dpkg’s doesn’t know that. From dpkg’s perspective, as you say, you’d have to download the package file, or obtain it in some other way, and install it.

1

dpkg print un (unknown) because its database isn't updated. You can use the sync-available from dctrl-tools package to synchronize dpkg info with apt.

sudo apt install dctrl-tools
sudo sync-available

man sync-available :

 sync-available - sync dpkg's available database with apt's database 

DESCRIPTION
This program updates the dpkg(8) available database with the data in the apt(8)
package database. This is required for grep-available(1) and other similar
programs to give up-to-date results.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.