apt-get vs aptitude

A topic which has been exhausted on the web we finally try to put to bed.

Before I begin I must make sure that you understand the history of apt in order to fully understand and distinguish the difference between apt and aptitude as well as any other package management tools.

Most Linux installations usually take this very simple approach. An install directive is followed by the name of one or more packages desired for installation. Each package name is phrased as just the name portion of the package, not a fully qualified file name (for instance, in a Debian GNU/Linux system, libc6 would be the argument provided, not libc6_1.9.6-2.deb). Notably, all packages containing dependencies required by the package(s) specified for installation will also be automatically retrieved and installed. This was an original distinguishing characteristic of apt-based package management systems whereby software installation failure due to missing dependencies, a type of dependency hell, was specifically avoided.

However due to the way that aptitude was written and then re-written in late 2000, as of the Debian 4.0 ("Etch") release of 2007, it is "the preferred program for package management from console both for package installations and package or system upgrades."[1]

This is because apt has had a big problem that hasn't really been addressed until only just recently. The problem is in removing packages. You see, apt does a great job of identifying what dependencies need to be installed when you want a certain package, but it fails miserably when you want to remove that package. If dependencies were required, ‘apt-get remove’ will remove your packages, but leave orphaned dependencies on your system.

For example, say you install a package which automatically installs some library packages because it depends on them. When you remove this package with apt-get, it won't remove the libraries this package installed, although they aren't used any more. However when you install that same package with aptitude and remove it with aptitude, aptitude 'detects' that those library packages aren't used any more and will therefore automatically remove them. This is primarily because aptitude stores a 'markauto' and 'unmarkauto' flag in its database. Where 'unmarkauto' represents packages that are installed by the end user and 'markauto' those which were installed automatically by aptitude in order to satisfy dependencies.

1. ^ Quotation from Debian GNU/Linux FAQ, Chapter 8: The Debian package management tools.

No comments:

Post a Comment