Saturday, May 18, 2013

Removing unwanted applications in Debian

One of the biggest pitfalls for a new Debian (or Linux) user is attempting to remove an unwanted application than came installed with the Desktop installed. This can result in the Debian package manager informing the user that there are various packages which can be autoremoved. Allowing the package manager to autoremove these packages then removes packages essential to the Desktop environment, destroying the installation. Why?

In Linux, one package can depend on another. For example, A depends on B. If you install A, the package manager will automatically install B, because it is required. If you uninstall A, the package manager will tell you B is autoremoveable, unless you have installed another package which also depends on B.

If you uninstall B,  A's dependency will be missing and it will not work, so the package manager will want to uninstall it.

Desktop environments are installed using a metapackage, which is simply a list of packages to install. A depends on B,C,D,E,F,G.... If you want to uninstall F, A's dependencies will not be met, so the package manager will want to uninstall it, and the rest of your desktop environment- not what you want, or even expect: B for example may work quite happily even if F is not present.

What is the solution?

In the past I've used apt-mark to unmark packages for autoremoval. This works, but a recent thread on the Debian forum made me aware that it's not an ideal solution.

An explanation of the Debian package management system and metapackages then appeared on the Forum. It gives a detailed example of how to remove one application from a metapackage and correct the autoremove marking of wanted packages in the metapackage.

HOWTO: How I learned to stop worrying and love metapackages

It is a rather complicated procedure, so advice for a Linux novice might be, don't be tempted to remove applications you don't need from a desktop environment, or if you do, don't remove packages marked as autoremove.

No comments:

Post a Comment