dpkg --get-selections shows packages marked "deinstall"

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.

  • Ubuntu manual page for dpkg
  • What do the various dpkg flags like mean?

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>

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`