As you probably already know, in Linux packages may specify "dependencies", that is other packages that must be installed in order for this package to actually work. These dependencies are resolved recursively, that is dependencies of your package dependencies are installed as well. This way meta-packages may exist that will install entire set of software. Common examples are libreoffice
(for office suite) or kde-full
for entire KDE desktop.
When apt (Debian package manager) installs some package, it marks all dependencies as automatically installed. This way it can distinguish between packages explicitly requested by user and packages that were pulled in merely as dependencies (about which user most likely don't care at all).
apt-get autoremove
looks up for packages that are marked as automatically installed, but which are no longer needed by any manually installed packages. These are often older versions of libraries (when version of library is in package name to allow different versions to coexist, e.g. libavcodec54
and libavcodec56
) or packages removed from repository, but sometimes some useful application gets pulled in as dependency and then is removed. This happens especially when you first tell apt to install recommended or suggested packages, but then configure it to not pull in these packages as dependencies.
To remove package from list of packages considered for removal, mark that package as installed manually. You can do it using apt-mark
:
apt-mark manual <package_name>
or aptitude (following commands are equivalent, use only one):
aptitude unmarkauto <package_name>
aptitude install <package_name>
aptitude install <package_name>&m
Finally, to get some context when these particular packages were installed, you can try searching their names in /var/log/apt/history.log
files. These logs are rotated (compressed and put in separate file) monthly; to get the full archive, you can run (order will not be preserved):
cat /var/log/apt/history.log > /tmp/full-archive
zcat history.log* >> /tmp/full-archive
Best Answer
Although
apt-get install
marks packages as installed too, it does other things like upgrading packages (if there is an upgrade available). The correct program to change the automatically-installed states isapt-mark
.Usage
Marking a package as manually installed (such that it won't be removed by
apt-get autoremove
):To mark a package as automatically installed (such that it will be removed by
apt-get autoremove
if no packages depend on it):More details are available in the manual page apt-mark(8).