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?
7 Answers
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.
-
2A great, clear answer. One additional detail is how/when they remove automatically installed dependencies.
aptitude
will remove them right away, butapt-get
will only prompt you to remove them by entering the commandapt-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 Feb 28, 2010 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:
- Always read the output of
aptitude
orapt-get
carefully, before saying yes to anything. - Remember that you can always do a dry-run using
aptitude -s safe-upgrade
oraptitude -s install foo
. The-s|--simulate
flag 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.
-
1
-
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?– CarlFJan 11, 2010 at 3:22
-
@Matthew: a while back (Sarge or early Etch), there were lots of people worried about switching from
apt-get
toaptitude
. Back then, they handled many essential functions very differently. Over time, they have become much more similar, andaptitude
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. Feb 28, 2010 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.
Are they not just a different interface to the same backend?
-
2
-
That might be. But an interface with more features doesn't necessarily mean a different backend.– SvishJan 11, 2010 at 7:57
-
2no, you're right, both are front-ends to
dpkg
. butdpkg
just installs the packages; it's the front-ends that are in charge of searching, dependency resolution, and downloading. Jan 11, 2010 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...– SvishJan 13, 2010 at 13:03
-
2just 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). Feb 26, 2010 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!
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
.
Regards
-
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. Feb 26, 2010 at 13:32
-
-
@William, @dag729: Current versions of
apt-get
also offer auto-removal of packages installed only as dependencies. The remaining difference in that regard is thataptitude
instantly removes the dependencies (as appropriate), butapt-get
only prods you to run the commandapt-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. Feb 28, 2010 at 18:28