0

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?

1 Answer 1

1

"Package selection state" tells dpkg what you WANT.

"Package state" tells dpkg whether a package is ACTUALLY 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:

       Selection State                          State
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...

       Selection State                          State
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.

2
  • I beleive that should be package status instead of selection status. :) I come from this link and would like to figure out how does these things work under the hood. According to your reply, is selection state used to tell apt what I really want and let it accomplish my goals? If I do not need say packageA anymore, is it enough to just dpkg --set-selections packageA deinstall and run apt upgrade ?
    – krave
    Oct 1, 2021 at 8:41
  • Edited terms to more closely match man dpkg
    – user535733
    Oct 1, 2021 at 11:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .