[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: aptitude --mind-your-own-business option?



On Sat, Dec 02, 2006 at 15:36:30 -0900, Ken Irving wrote:
> On Sun, Dec 03, 2006 at 01:05:29AM +0100, Florian Kulzer wrote:

[...]

> > It is perfectly safe to mix aptitude and apt-get. I will now perform a
> > daring experiment to demonstrate this: I have here an up-to-date Debian Sid
> > box, which I have upgraded daily with aptitude for the last year (before
> > that I used apt-get, also daily). Now, what unspeakable horrors lie in
> > wait for me if I install something with apt-get and run aptitude
> > afterwards? There is only one way to find out...
> > 
> > First of all, an md5sum of aptitude's list of installed packages (which
> > includes the "auto" flag) - I want to be able to show that I can restore
> > this state:
> > 
> > $ aptitude search '~i' | md5sum
> > 06f9da945e91f95eb2913ed081809159  -
> > ...
> > # apt-get install aiksaurus
> > ...
> > # aptitude dist-upgrade
> > ...
> > # apt-get dist-upgrade
> > ...
> > # aptitude --purge-unused purge aiksaurus
> > ...
> > $ aptitude search '~i' | md5sum
> > 06f9da945e91f95eb2913ed081809159  -
> > 
> > I rest my case.
> 
> I'll take your word for it.  So once aptitude gets "synched" to my system,
> I can use either aptitude or apt-get with impunity?  That sounds reasonable.

I wanted to check if the above trick scales up to more complicated
cases, so I ran "apt-get install gnome". This installed 88 packages on
my system and removed abiword (due to a conflict with the automatically
installed abiword-gnome). Afterwards I saw that "aptitude install -f"
wanted to remove gdm and three packages that depended on it. Aborting
the operation and running "aptitude keep-all" fixed this and made the
system stable again. However, contrary to the simple example posted
earlier, aptitude did not figure out itself which packages were
installed as a dependency by apt-get. So this time I had to undo
apt-get's actions myself with the aid of a saved list of the 88
packages. Conclusion: It seems to be necessary to run "aptitude
keep-all" after more extensive changes to the system with apt-get.
Aptitude does not seem to mark packages as "auto" on its own in that
case. It looks like mixing aptitude and apt-get is not dangerous, but it
takes away one of the main advantages of aptitude over apt-get. (If you
do not need/want automatic removal of unused packages then you might as
well stick with apt-get.)

> But its initial behavior still strikes me as unreasonable.  Would aptitude
> be left in a broken state if it warned me of inconsistencies but still did
> what I asked (e.g., install something in spite of unused packages)?  Could
> not this work be postponed to some time when it is, in fact, critical?

I have tried to come up with possible reasons why some people have such
bad experiences when they try aptitude. Here is my "traps and pitfalls
of aptitude" list:

1) Aptitude remembers intended actions, even if you change the package
   states and/or configuration settings which prompted this behavior.
   When in doubt, run "aptitude keep-all".

2) Aptitude tries to react immediately to changes in package states,
   including the "automatically installed" flag. If you want to run
   several successive (un)markauto commands to change/fix your system
   then you have to use "--schedule-only" to keep aptitude from doing
   something unintended halfway through the operation and "keep-all"
   afterwards. Another helpful stop-gap measure in such cases is
   -o aptitude::Keep-Unused-Pattern='~T'

3) The location of aptitude's configuration file depends on whether it
   is run as root or with "sudo" (unless you change your sudo set_home
   configuration). This can lead to inconsistent behavior. "sudo -H"
   takes care of this.

4) If aptitude runs into problems when trying to upgrade packages (e.g.
   because the updated versions of some dependencies are still missing)
   it will normally propose the least harmful action first (e.g. keeping
   a few packages at their presently installed version). However, if you
   run another upgrade command after the harmless actions have been
   carried out, then aptitude will assume that you want it to be more
   aggressive. "keep-all" helps again, as well as CTRL + U or "Cancel
   Pending Actions" in interactive mode.

-- 
Regards,
          Florian



Reply to: