According to the dpkg man page, a selection state of install means "The package is selected for installation". A selection state of deinstall means "The package is selected for deinstallation (i.e. we want to remove all files, except configuration files)".

What confuses me, and what I would like to clarify: After I remove a package, it is in the selection state deinstall. But it's already removed. How can something that is removed be in any state? And I did remove all files, I don't "want to remove" them.

Same for the install selection state: How can a package be "selected for installation" if it is already installed?

In the same vein, the man page of dpkg-query differentiates between desired action and package status, which I understand to be the same as selection state and state, respectively. Most packages have a desired action of Install and a status of Installed. Again, what is this supposed to mean? Why do we desire installing a package that is already installed?

And the big question: Under which circumstances is this distinction between selection/desired state and normal state relevant at all?


"selection state" tells dpkg what you WANT.

"selection status" tells dpkg whether a package is REALLY installed or not.

How can a package be "selected for installation" if it is already installed? is a (understandable) misunderstanding of the language. It does not mean in the future -- dpkg has no concept of future or past.

In most cases, your preference and the system status will match. That's a good thing. It means that your system is working properly:

       State                                      Status
I want Package X to be installed     --and-- Package X is installed.
I want Package Y to be NOT installed --and-- Package Y is NOT installed.

A discrepancy...

       State                                      Status
I want Package X to be NOT installed --but-- Package X is installed

...should be investigated. It sometimes indicates problems (conflicting packages, corrupt packages) if the same discrepancy persists. dpkg is not designed to solve discrepancies for you...but apt is.

| improve this answer | |

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.