In Ubuntu/Debian, how do I mark a package as non-auto removable?

I know you can do it in aptitude. You can do it either in its GUI by selecting package and hitting 'm' or selecting "Mark manual" from "Package" menu, or using command line:

aptitude install <package_name>&m

You can use apt-mark manual <package> for that, of from Synaptic, Package => [ ] Automatically Installed (uncheck it).

ex:

# Mark <some_package> as manually-installed:
apt-mark manual <some_package>

# Mark <other_package> as automatically-installed (ex if you know it's a
# dependency to something else and you want to make sure it'll be
# auto-removable if it's no longer used):
apt-mark auto <other_package>

Also, if you use apt-get install <package> on a package that's already installed, it will be implicitly marked as manual.


You can "hold" a package in Ubuntu.

Holding a package basically means you're telling the package manager to keep the current version no matter what. This is useful if more recent version of a currently working program breaks after an update.

You can do it via Synaptic or on the command-line via apt/dpkg. The command-line version to hold a package is:

echo package_name hold | dpkg --set-selections

Ubuntu Community Documentation has a more complete guide explaining how to pin or hold packages.