I'm in a situation where apt shows 1000+ packages on my system marked as auto-removable. Amongst those are many that I know I need. I've resolved the situation by setting those to manually installed. But that results in almost half the packages in my system showing up as 'manually installed'. I ran into trouble when upgrading my system to the current stable version of Debian (apt-get dist-upgrade), and none of the 'manually installed' packages were upgraded. Again, I resolved the situation by setting all the 'manually installed' packages to automatically installed. That made the upgrade possible. But now all the upgraded, formerly 'manually installed' packages are again auto-removable. I tried finding not installed meta-packages that through their dependencies would at least reduce the auto-removable list. But without success. - Is there no way to get back to a situation where the packages marked as auto-removable are really those I don't need?

  • 1
    "I ran into trouble when upgrading my system to the current stable version of Debian" Are the auto-removable packages Jessie ---but you have kept Stretch?
    – user8779
    Commented Aug 22, 2017 at 15:17
  • Which command did you run for apt to display those packages? I would like to experiment on my VM...
    – Alex
    Commented Aug 22, 2017 at 17:03
  • arochester: Before the upgrade my autoremovable packages were Jessie. Now they are Stretch.
    – Anthony
    Commented Aug 23, 2017 at 10:16
  • Alex: I used the command "manual=$(apt-mark showmanual); apt-mark auto $manual" That is to make all packages that were marked as manually installed to be marked automatically installed. The output of the command apt-mark showmanual, i.e. all the package names, is put into the variable $manual which is then used in the second command. - I hope this is what you were asking.
    – Anthony
    Commented Aug 23, 2017 at 10:31

2 Answers 2


Finally I was thinking: what do I do when I install a new system? - Install a minimal system and then add what I need in addition. So I tried this:

aptitude install ~pstandard ~pimportant ~prequired

which should make sure at least a minimal functioning system would not be 'autremoved', containing all packages of priorities Required, Important and Standard.

However the command returned an error code: "Unable to apply some actions, aborting" Not very informative, but I then replaced the command whith a longer version:

required=$(aptitude search ~prequired -F"%p"); apt-get install $required;

important=$(aptitude search ~pimportant -F"%p"); apt-get install $important;

standard=$(aptitude search ~pstandard -F"%p"); apt-get install $standard;

That also threw a couple of errors which were, however, easily resolved. Then I listed the still autoremovable packages with:

apt-get --dry-run autoremove | grep -Po 'Remv K[^ ]+' | sort > autoremovable.txt

one name per line and found & additionally installed those I knew I needed. Having done that there were still 757 packages in my 'autoremovable' list. Those I then removed with

apt-get autoremove

Then I rebooted and the system came back up fine.


Possibly you are misunderstanding "auto-removable". If a packet is installed automatically as a dependency of other packages, it is marked as "automatically installed" or "auto-removable" (as opposed to "manually installed").

This only means that if all other packages that need a particular are removed, then this automatically installed package is considered as a candidate for auto-removal, which you have to do explicitly. It does not mean that these packages are somehow in danger of being removed while they are still needed.

On the other hand, marking a package as "manual" means "the user has explicitly chosen to install this package, with this particular version, and the user is responsible for upgrading it".

So the usual way to handle things is to install those packages you need (which will mark them "manual"), upgrade them manually or let them semi-manually upgrade with dist-upgrade, and let the library packages etc. be marked as "auto", so the package system can remove those at will, and re-install variants or different versions as needed.

TL;DR: Don't worry about auto-removable packages, keep them that way.

  • You may be right that I'm worrying too much. And I know that my autoremovable packages are not in danger, at least as long as I don't type "apt-get autoremove" and hit return twice in a state of somnambulism (as I once did). My point is that I formerly used apt-get autoremove to 'take out the trash', typically to get rid of libraries that are no longer needed etc.. Now I don't know how to identify the 'trash' any more.
    – Anthony
    Commented Aug 23, 2017 at 10:45
  • You identify it the same way as before: Do you need a library because you want to develop against it? Install it explicitely, it gets marked "manual", it won't get auto-removed. You only installed a package because it was a dependency of some other package? It will be marked "auto", and get auto-removed the next time you "take out the trash" when the package that used it is removed in the future. So, nothing has changed.
    – dirkt
    Commented Aug 23, 2017 at 11:13
  • 1
    dirkt: "It will be marked "auto", and get auto-removed the next time you "take out the trash" when the package that used it is removed in the future." - That is exactly what is NOT working. If I do that I remove, as I said, 1000+ packages from my system, amongst them many that I do need.
    – Anthony
    Commented Aug 23, 2017 at 14:04

You must log in to answer this question.

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