Installing then removing Monodevelop reports "the package system is broken"

Bug #659111 reported by Paul van Genderen on 2010-10-12
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
aptdaemon (Ubuntu)
High
Unassigned
monodevelop (Ubuntu)
Undecided
Unassigned

Bug Description

Ubuntu 10.10
Ubuntu Software Center 4.1.22, monodevelop 2.5.92+dfsg-2ubuntu1, Ubuntu 11.10 beta 1

1. Install Monodevelop.
2. Remove Monodevelop.

What happens: Partway through the removal, a dialog appears, "The package system is broken".

Previously the details mentioned "monodoc-browser". I purged it and ran sudo apt-get install -f. Everything seems fine but software-center insists that the package system is broken.

Related branches

description: updated
summary: - Software center says "the package system is broken"
+ Installing then removing Monodevelop reports "the package system is
+ broken"
Changed in software-center (Ubuntu):
status: New → Triaged
importance: Undecided → High
Michael Vogt (mvo) wrote :

Thanks for your bugreport.

I can reproduce this issue, looks like a bug in the auto-remove code, the terminal log says:

For the install:

Start-Date: 2011-09-19 17:31:28
Commandline: aptdaemon role='role-commit-packages' sender=':1.133'
Install: monodoc-base:amd64 (2.10.5-1, automatic), monodoc-manual:amd64 (2.10.5-1, automatic), monodevelop:amd64 (2.5.92+dfsg-2ubuntu1)
End-Date: 2011-09-19 17:31:38

And then the remove:
Start-Date: 2011-09-19 17:42:06
Commandline: aptdaemon role='role-remove-packages' sender=':1.133'
Install: monodoc-browser:amd64 (2.10-1, automatic), libwebkit1.1-cil:amd64 (0.3-3ubuntu3, automatic)
Remove: monodoc-base:amd64 (2.10.5-1), monodoc-manual:amd64 (2.10.5-1), monodevelop:amd64 (2.5.92+dfsg-2ubuntu1)
End-Date: 2011-09-19 17:43:16

And the error is:Removing monodevelop ...^M
dpkg: monodoc-manual: dependency problems, but removing anyway as you requested:^M
 monodoc-browser depends on monodoc-manual.^M
Removing monodoc-manual ...^M
dpkg: monodoc-base: dependency problems, but removing anyway as you requested:^M
 monodoc-browser depends on monodoc-base (>= 1.0).^M

Michael Vogt (mvo) wrote :

And on the terminal:
$ sudo apt-get install -f
The following extra packages will be installed:
  monodoc-base monodoc-manual
The following NEW packages will be installed:
  monodoc-base monodoc-manual

Michael Vogt (mvo) on 2011-09-28
Changed in monodevelop (Ubuntu):
status: New → Invalid
Changed in software-center (Ubuntu):
status: Triaged → In Progress
Michael Vogt (mvo) wrote :

This is a interessting one, on oneiric I get:

# apt-get remove monodevelop
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  monodoc-base monodoc-manual monodoc-browser libwebkit1.1-cil
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  libwebkit1.1-cil monodoc-browser
Suggested packages:
  monodoc-webkit-manual
The following packages will be REMOVED:
  monodevelop
The following NEW packages will be installed:
  libwebkit1.1-cil monodoc-browser
0 upgraded, 2 newly installed, 1 to remove and 117 not upgraded.

Note that it wants to install two packages. The problem resolver shows:
# apt-get remove monodevelop -o Debug::pkgProblemResolver=true
Reading package lists... Done
Building dependency tree
Reading state information... Done
Starting
Starting 2
Investigating (0) monodoc-manual [ amd64 ] < 2.10.5-1 > ( devel )
Broken monodoc-manual:amd64 Depends on monodoc-browser [ amd64 ] < none -> 2.10-1 > ( devel )
  Considering monodoc-browser:amd64 1 as a solution to monodoc-manual:amd64 0
  Try Installing monodoc-browser [ amd64 ] < none -> 2.10-1 > ( devel ) before changing monodoc-manual:amd64

So apt does not want to keep monodoc-manual in a broken state and instead installed the browser to fix that. It
should probably only do that if the package in question is not auto-installed.

But:
# apt-get autoremove monodevelopReading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  monodevelop monodoc-base monodoc-manual
0 upgraded, 0 newly installed, 3 to remove and 117 not upgraded.

Behaves correctly.

This happens in aptdaemon as well. First aptdaemon marks the package monodevelop for removal
with auto_fix=True. The resolver installs monodoc-manual now (see above why). Then the autoremove
of obsoletes is run by aptdaemon. The autoremover looks at monodoc-browser but at this point of the
loop the monodoc-base is still installed.

Michael Vogt (mvo) wrote :

I wrote a tiny python test case for this (it requires a installed monodevelop and a otherwise clean autoremove info):

    def test_remove_bug659111(self):
       cache = apt.Cache()
        cache["monodevelop"].mark_delete()
        for pkg in cache:
            if pkg.marked_install:
                print "inst: ", pkg.name
            if pkg.marked_delete:
                print "rm: ", pkg.name
            if pkg.is_auto_removable:
                print "auto-removable: ", pkg.name

This prints for me:
inst: libwebkit1.1-cil
inst: monodoc-browser
rm: monodevelop
auto-removable: monodevelop
auto-removable: monodoc-base
auto-removable: monodoc-manual

But at the point that monodoc-browser is marked for install monodoc-base is no longer autoremovable.

Michael Vogt (mvo) wrote :

It turns out that python-apt is to blame, it only shows "is_auto_removable" for packages that are installed, not marked_install.

So this needs additional checks in the code if a pkg is in state "marked_install" and "is_auto_removable", then we can call "mark_keep()" on the package.

But looking at this again I think a better fix it so simply run the resolver again, it will clean any pending packages that are in state "marked_install" and "is_auto_removable" automatically.

Michael Vogt (mvo) on 2011-09-28
affects: software-center (Ubuntu) → aptdaemon (Ubuntu)
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package aptdaemon - 0.43+bzr697-0ubuntu1

---------------
aptdaemon (0.43+bzr697-0ubuntu1) oneiric; urgency=low

  * debian/patches/03_additional_resolve_run.patch:
    - do an additional resolver run to ensure that autoremove does
      not leave the cache inconsistent (LP: #659111)
 -- Michael Vogt <email address hidden> Wed, 28 Sep 2011 13:36:53 +0200

Changed in aptdaemon (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers