I removed some packages I no longer need with aptitude. I was surprised that none of their dependancies were also autoremoved (as I thought aptitude did that by default unlike apt-get), so I checked these dependencies with aptitude why
and all of them were marked with status id
, which according to the manual means "installed, will be deleted". When will this happen? I tried running apt-get autoremove
, aptitude upgrade
, aptititude full-upgrade
and apt-get dist-upgrade
, and the packages are still installed. Also when I run these commands they all print 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
What causes the discrepancy between 0 to remove
, and having packages marked with status id
?
Edit:
After more digging I discovered that all these packages were marked as manually installed, even though they were installed automatically. I looked through my history and noted that many of them were installed with apt-get instead of aptitude, which may be part of the issue. I was able to use the following commands to remove them all:
# aptitude search "?installed" | grep "^id" | awk '{ print $2 }' | xargs apt-mark auto
# aptitude upgrade
I'm still curious about what exactly that "d" state means, and what apt-get/aptitude do with it, so I'm leaving the question up.
Best Answer
The second state in the
dpkg -l
output is the selection, i.e., the wanted state. This is mostly used bydselect
these days, but it can also be used bydpkg --set-selections
. To get from the current state to the selection, you need something that even looks at the selection, which aptitude and apt don't do by default.Apt has an option to do that, though. Just run:
This should make the wanted modifications.
I'm not sure why packages were left in an
id
state. Maybe the uninstall didn't finish successfully?