aptitude vs. debfoster 

Newsgroups:  gmane.linux.debian.user
Date:        Thu, 31 Aug 2006 18:23:08 +0200

I used to use debfoster to install/uninstall packages. My recent reading hinted that aptitude can be as smart as debfoster now. So I gave it a try.

But I found that aptitude doesn't even come close to debfoster:

% aptitude install apache2
The following NEW packages will be automatically installed:
  apache2-common apache2-mpm-worker apache2-utils
The following NEW packages will be installed:
  apache2 apache2-common apache2-mpm-worker apache2-utils
0 packages upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 1055kB/1148kB of archives. After unpacking 3981kB will be
used.

yes, work as advertised. But apt-get can do that too. Now how about removal?

% aptitude purge apache2
Reading package lists... Done
Building dependency tree... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done
The following packages will be REMOVED:
  apache2{p}
0 packages upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Need to get 0B of archives. After unpacking 81.9kB will be freed. Do you
want to continue? [Y/n/?]
Writing extended state information... Done (Reading database ... 134497
files and directories currently installed.) Removing apache2 ...

What? All the apache2-common, apache2-mpm-worker, & apache2-utils that get automatically installed are not touched:

$ dpkg -l | grep apache2
ii  apache2-common 2.0.55-4.1     next generation, scalable, extendable
ii  apache2-mpm-wo 2.0.55-4.1     high speed threaded model for Apache2
ii  apache2-utils  2.0.55-4.1     utility programs for webservers

This is unacceptably to me. These packages should be automatically purged as well. Or I'm doing something wrong?

The debfoster, OTOH, has never let me down on this.

Please comment.

T

aptitude vs. debfoster 

> This is unacceptably to me. These packages should be automatically
> purged as well. Or I'm doing something wrong?

You're probably doing something wrong.

One possibility that comes to mind is that you've _already_ got those packages installed, having using some other program than aptitude to install them — if that's the case, then aptitude won't know that those various libraries are "only dependencies" because it never had a chance to record that information. Aptitude is conservative, and assumes that any package it doesn't _know_ is automatically installed might have been installed intentionally by the user, and so shouldn't be automatically removed.

So basically, the first time you start using aptitude, you have to give aptitude that information, by marking as "automatically installed" all packages that you later want to be automatically deinstalled. After that, as long as you use aptitude to install new stuff, it will do do the appropriate marking for you.

[This step is actually pretty easy because you can use aptitude's powerful search and limiting commands to handle most of the common cases — e.g.: limit to only non-development libraries with the search pattern (^lib)!(-dev$), and mark them all as "autoinstalled" (with one keystroke); limit to all packages with names matching (-base|-common), mark them; etc.]

Miles

aptitude vs. debfoster 

> What? All the apache2-common, apache2-mpm-worker, & apache2-utils that
> get automatically installed are not touched:

It is weird — works for me. Can you go to aptitude and check these packages which should be removed, whether they have A to the left of the name of the package? Something like this:

i A   kdelibs4c2a                    4:3.5.4-3  4:3.5.4-3

If they don't, you can fix it "manually" by Shift+M, which should make them ready to be deleted. However, why they are not marked so, I have no idea — it just works for me. Otherwise you can investigate which packages claim to be dependent on them (Reverse dependency — Shift+R).

Somebody else could chime in?

Matej Cepl

aptitude vs. debfoster 

> Somebody else could chime in?

Maybe there is a configuration setting that tells aptitude not to remove unused packages automatically. (This is configurable and I am not sure what the default setting is.)

The easiest way to check this is probably to start aptitude in interactive mode, press CTRL + T to activate the menu, go to "Options", "Dependency handling" and verify that the item "Remove unused packages automatically" is selected.

Florian Kulzer

aptitude doesn't suck, actually 

2006-05-17

I have to say I was a little worried when I saw the installation notice during a recent upgrade of debfoster. It had been deprecated, abandoned by its developers, and instead I was being encouraged to use aptitude. So, I was being forced to give up my favourite package tool for a tool that I've started a few times but always found too confusing to invest time in learning.

My first step was the transition from debfoster to aptitude. I tried out the debfoster2aptitude script that was added to the last upgrade of debfoster but quickly realised that it was asking questions on a level that was way too low. I decided to do it manually instead. First I minimised my list of packages in debfoster and saved a copy of it:

# debfoster
# debfoster -qmn
# debfoster -a > ~/debfoster_keepers

Then I turned to aptitude. First I marked all packages as automatically installed (auto) from the command line:

# aptitude markauto '~i'

Then I marked each of the packages in /root/debfoster_keepers as not auto. I did this using the UI, which was both boring and time consuming. It should be easy to wip up a shell script for it, but I felt I needed to get used to aptitude's UI a bit. After this I went on to see what the damage would be-I hit 'g' to add/remove packages. As expected there were a few packages in there that I had to tell aptitude to keep installed for me. No big deal.

One interesting thing about aptitude is that it doesn't just keep depends of packages, it keeps recommends as well. To see if I could further trim the list of non-auto packages I started looking at the ways to filter the view of packages. I didn't quite succeed on my own, but after a few emails to the Debian User List I had a nice filter expression:

~i!~M(~R~i|~Rrecommends:~i)

It will show any installed packages that aren't auto which are dependencies or recommendations of other packages. In short, packages that aren't marked auto but could (should?) be. Be aware though that circular depends/recommends prevents all packages in that list to be marked auto.

Another cool thing is the "Audit recommendations" view in aptitude. It's a great way of finding related packages and improving the functionality of the system. If you want to also see the suggests of installed packages you can change the filter in that view to:

!~v!~i(~RBrecommends:~i|~RBsuggests:~i)

By now I'm not too sad that debfoster is being removed, aptitude actually doesn't suck