I wanted to "purge" all packages that were "removed" only. After skimming through the manpage of dpkg
, I thought the --clear-selections
parameter would do the trick. So stupid me typed it in with sudo
, and afterwards I checked the selection states again and was shocked.
dpkg
has selected all (non-vital) installed packages to get uninstalled!
This was of course my fault, but definitely not intended. So, how do I revert this?
I still have the terminal window open where I ran dpkg --get-selections | grep deinstall
both before (85 packages) and after (2614 packages) the accidental command.
What I need now is to subtract the first (old) deinstall list from the second (current) one and mark all those packages as wanted again. Setting them to manual
will not be good though, as that would affect hundreds of libraries which make no sense if installed without their applications. So we have to set it to auto
and then I probably have to manually find out the top level packages to be selected as manual
. Or can something help me there?
Info: I have two separate text files, one containing the first --get-selections
output, one the second. They contain only lines with the syntax:
package-name deinstall
where package-name
is, well, the actual package name, and the space in between is an undefined number of tabs.
Update: I just found the output of dpkg --get-selections
from before the accident without any grep
filtering! Only two packages were installed after that, I can fix them manually later.
Please help me to restore my previous package selections!
/var/lib/apt/extended_states
still intact? If yes, back it up! – Nephente Oct 19 '15 at 12:24dpkg --get-selections
, I could solve the problem. – Byte Commander Oct 19 '15 at 12:29