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.
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
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
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
lib-so-and-so gets removed too. But
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
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:
- Always read the output of
apt-getcarefully, before saying yes to anything.
- Remember that you can always do a dry-run using
aptitude -s safe-upgradeor
aptitude -s install foo. The
-s|--simulateflag is your friend.
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.
I'd also say go ahead and use
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
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.
Are they not just a different interface to the same backend?
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!
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.