I've been thinking about switching to aptitude, but I've heard people say "if you're already using apt-get, you should wait until your next installation to switch." Why do people say this? What sort of problems (if any) can this cause?


apt-get and aptitude are different UIs that are part of the same package management system, APT, the Advanced Packaging Tool. For instance, both are configured using /etc/apt/apt.conf, both use the same filespace and formats to represent package state, and the same filespace to store downloaded .debs.

How they differ is their internal rule system to represent potential conflicts between package, how to resolve them (say during apt-get dist-upgrade vs. aptitude full-upgrade), and how to express these when interacting with the user. Generally speaking, both might do the wrong thing in tricky situations, but apt-get is much more likely to get it wrong than aptitude.

| improve this answer | |
  • 2
    A great, clear answer. One additional detail is how/when they remove automatically installed dependencies. aptitude will remove them right away, but apt-get will only prompt you to remove them by entering the command apt-get autoremove. In general, they will want to remove the same items. See this link, however, for a complex case where they disagreed on that: forums.debian.net/viewtopic.php?f=10&t=49589&start=0 – Telemachus Feb 28 '10 at 18:50

Lots of good advice is already here, but let me add one thing nobody has mentioned. If you do decide to switch, you may want to run this command, depending on what you've been up to with apt-get:

aptitude keep-all

That command resets aptitude's sense of what packages are orphans and should be removed.

Here's the reason it's sometimes useful: for awhile now, both apt-get and aptitude will track packages that were automatically installed as a dependency of something else. So, for example, if you install mpd, you might get lib-so-and-so as a dependency. They do this, so that if you later remove mpd, lib-so-and-so gets removed too. But aptitude and apt-get handle this clean up differently. aptitude immediately tries to remove all orphaned dependencies; but apt-get merely suggests that you run apt-get autoremove to clean up. (The logic behind all of this is that you only got the library since mpd needed it. If you don't keep mpd, you shouldn't need the library any longer. If another package still depends on it, then both aptitude and apt-get will know this and not try to remove the library.)

What's my point? Well, if you've been seeing constant nudges to run apt-get autoremove and you switch to aptitude, then you may be in for a shock the first time you try to install something. aptitude will straightaway try to remove all those orphans. In general, this will be fine (they're orphans after all, and not necessary), but there is one complicating case. The desktop meta-packages all involve a complex dependency chain where each individual program is pulled in as a dependency of a virtual package wrapper. For example, if you have Gnome installed because you installed the gnome package, then all of your normal desktop programs were installed as dependencies. If you have uninstalled a single one of these programs (e.g., Ekiga or Gedit), then in the eyes of aptitude the rest of your desktop should be removed too. Note that aptitude always asks before it removes things, but people often enter 'Y' without reading. In my experience, this is the single most common complaint/confusion for people new to Debian.

Two general pieces of advice:

  1. Always read the output of aptitude or apt-get carefully, before saying yes to anything.
  2. Remember that you can always do a dry-run using aptitude -s safe-upgrade or aptitude -s install foo. The -s|--simulate flag is your friend.
| improve this answer | |

It was said on the Debian mailing list, years ago, that switching from apt-get to aptitude was risky. This is two Debian versions (say 10 years) ago. All those problems seem to be worked out now, and certainly I haven't seen problems on either Debian or Ubuntu.

| improve this answer | |
  • 1
    Do you have a link to the mailing list post? – Matthew Jan 10 '10 at 17:04
  • Matthew, do you imagine that I keep a perfectly indexed archive of the entire debian-user mailing list here? When it's clear from the above that I don't even even remember the year? – CarlF Jan 11 '10 at 3:22
  • @Matthew: a while back (Sarge or early Etch), there were lots of people worried about switching from apt-get to aptitude. Back then, they handled many essential functions very differently. Over time, they have become much more similar, and aptitude has matured a ton. For 90% of the cases now, there should be no problems if you switch. See my post for one edge case. – Telemachus Feb 28 '10 at 18:52

I'd also say go ahead and use aptitude.
Aptitude has a better dependency management than apt-get. This will help keeping the count of orphaned packages low.
I've read a while ago that aptitude has the better dist upgrade algorithm compared to apt-get. But that's hardly a killer feature as it's not used that often in the life time of a system.

Additionally you'll have more stuff united in one tool. Rather than remembering when to call apt-get, apt-cache or dpkg and with which switches I just use aptitude and get most things done.

As for complications when switching "in the middle": I don't remember having had any when I did it.

| improve this answer | |

Are they not just a different interface to the same backend?

| improve this answer | |
  • 2
    aptitude is a more featureful interface... – quack quixote Jan 10 '10 at 5:09
  • That might be. But an interface with more features doesn't necessarily mean a different backend. – Svish Jan 11 '10 at 7:57
  • 2
    no, you're right, both are front-ends to dpkg. but dpkg just installs the packages; it's the front-ends that are in charge of searching, dependency resolution, and downloading. – quack quixote Jan 11 '10 at 18:40
  • but searching, downloading and dependency resolution won't break anything. or if it does that would be very weird in my opinion... – Svish Jan 13 '10 at 13:03
  • 2
    just noticed your last comment. keep in mind that it's the frontends that are deciding what to install; dpkg just does the installation. if something breaks, it's usually because the dependency resolution failed, or because the user turned the dependency resolution off (eg with a --force option). – quack quixote Feb 26 '10 at 14:02

From my experience, they have a different way of pinning package versions. In my case, I told aptitude to lock certain packages, assuming I'd be safe from future updates. I was wrong; the cron-scheduled update manager, which uses apt-get, proceeds to upgrade it to my dismay.

Drats, as I was writing this, I googled and found out that the bug (#557580 aptitude does not obey pins in preferences.d/*) was already fixed!

| improve this answer | |

I use both apt-get and aptitude without any problem: I have the same question...Why do people say this??? :D

Go on, and don't worry: aptitude is just a text-gui for apt-get, that you could even use as a command line application, for example apt-get install foo is the same as aptitude install foo.


| improve this answer | |
  • I don't believe they are the same. Unless things have changed, aptitude will do more dependency tracking and remove any packages that it has automatically installed, while apt-get will not. That is, if foo depends on bar and you install and remove foo with apt-get, bar will remain on your system. If you do the same with aptitude, it will not. – William Pursell Feb 26 '10 at 13:32
  • You're right: see the ~quack's comments below. – dag729 Feb 28 '10 at 5:42
  • @William, @dag729: Current versions of apt-get also offer auto-removal of packages installed only as dependencies. The remaining difference in that regard is that aptitude instantly removes the dependencies (as appropriate), but apt-get only prods you to run the command apt-get autoremove. But they both track dependencies in the same way now. They still differ, however, in their handling of complex dependencies and edge cases (very complicated installs or removals), but for the majority of people & the majority of situations, they work the same now. – Telemachus Feb 28 '10 at 18:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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