53

Executing dpkg --get-selections shows packages with one of the markers install or deinstall.

Some packages I could remove completely with apt-get remove.

  1. What does deinstall mean?

  2. What can be done so that the packages marked deinstall are not listed by dpkg --get-selections anymore?

Tim
  • 32,861
  • 27
  • 118
  • 178
user78225
  • 531

3 Answers3

25

What does "deinstall" mean?

From the manpage of dpkg this means

the package is selected for de-installation or removal (i.e. we want to remove all files, except configuration files).

You also asked

What can be done so that the packages marked "deinstall" are not listed by "dpkg --get-selections" anymore?

There are two ways you can do for not to be listed in the dpkg --get-selections command.

1. Unselect the packages for removal

You can unselect the packages, which are selected for removal. In this way, dpkg --get-selection will not show "deinstall" entry.

Look at this answer for the exact procedure to do this

2. You can actually do the selected task, i.e deinstall them

It is not recommended, If you have done a dpkg --clear-selections accidentally, which mark all packages as "deinstall" except the essentials one (Here, essentials doesn't mean You can have a system without any unnecessary software, essentials mean, You can only boot and have a very low-level linux system).

The command to do the desired task selected is:

sudo apt-get dselect-upgrade

Hope this will answer your query.


For more information you can check these links.

Anwar
  • 76,649
  • 5
    You write "is selected for de-installation or removal (i.e. we want to remove all files, except configuration files)". Well, how did I ("we") select that? Is that what happens when I "apt-get remove ..."? And if so, why are they only "selected for de-installation", why are they not removed instantly when running "apt-get remove"? – Mads Skjern May 29 '15 at 12:42
  • You write that it is not recommended to dselect-upgrade. Is that only because, in the case that one has accidentally run --clear-selections, it goes to bare-bone. Or is it for other reasons as well? It seems sort of like an obvious thing to do, to de-install things that are selected for deinstallation :/ ?? – Mads Skjern May 29 '15 at 12:45
  • I can't understand the answer either. I am reading the manual, but it's not clear either. For example, the package selection state "install" is described as "The package is selected for installation.". But I find the packages marked as 'install' have all already been installed in my system. What does it mean 'selected for installation'? (when it's already installed?) – Chan Kim Feb 27 '19 at 07:27
  • 1
    @MadsSkjern I observe that apt remove does mark certain packages as deinstall in Ubuntu 19.10. I have no idea why it doesn't just remove it immediately. Full example at: https://stackoverflow.com/a/54239534/895245 – Ciro Santilli OurBigBook.com Feb 28 '20 at 08:21
17

The "sudo apt-get dselect-upgrade" answer did not work for me. To remove a single deinstalled package I used:

sudo apt-get --purge remove <package_name>
John
  • 271
17

If apt-get --purge fails to remove the package try the following:

Check the de-installed packages to make sure you really want to remove them.

dpkg --get-selections | grep deinstall | cut -f1

If you are sure, execute dpkg --purge:

sudo dpkg --purge `dpkg --get-selections | grep deinstall | cut -f1`
Kevin Bowen
  • 19,615
  • 55
  • 79
  • 83