Can it cause problems to switch from apt-get to aptitude?

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?


Solution 1:

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.

Solution 2:

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.

Solution 3:

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.

Solution 4:

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.

Solution 5:

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