Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

To compile something, I needed the zlib1g-dev package to be installed so I launched an apt-get install zlib1g-dev.

apt-get informed me nicely that the package was already auto-installed because of an other package, and that it understands that I want it installed explicitly now :

# apt-get install zlib1g-dev
zlib1g-dev is already the newest version.
zlib1g-dev set to manually installed.

My compilation done, I don't need it any more explicitly, so I want to revert its status to the previous one : auto-installed. This way it will be pruned automatically when it will not be needed any more with a simple apt-get autoremove.

I cannot do an apt-get remove zlib1g-dev since some packages still depends on it.

So how may I revert the package zlib1g-devinstallation state to auto-installed ?

I know that I might edit /var/lib/apt/extended_states by hand from

Package: zlib1g-dev
Auto-Installed: 0


Package: zlib1g-dev
Auto-Installed: 1

... but it just doesn't feel right.

share|improve this question
up vote 41 down vote accepted

Aptitude can help you when you initially install the package:

aptitude install "zlib1g-dev&M"

Or, after your have installed the package:

aptitude markauto "zlib1g"

Edit: If you do not have aptitude, you can use

apt-mark auto zlib1g-dev
share|improve this answer
+1: I don't have the aptitude reflex yet, and it works. Thx. – Steve Schnepp Nov 25 '09 at 13:13
Good answer, but I +1's @ArvindSing's answer using apt-mark because it does not require that you install aptitude. apt-mark comes with apt package which everyone should already have. – Christopher Schultz Jan 17 '13 at 16:04

apt-mark can help you:

apt-mark auto zlib1g-dev

For 11.04 or older, use "markauto" instead of "auto"

share|improve this answer

This is what you're looking for.

sudo apt-get markauto first-package second-package etc-package


apt-get --help
share|improve this answer
Please note that this is deprecated now in favor of apt-mark – Joril Oct 1 '12 at 9:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.