dpkg wrongly claims that a foreign-arch package is disappeared by a removed native-arch package

Bug #863675 reported by Steve Langasek
26
This bug affects 5 people
Affects Status Importance Assigned to Milestone
dpkg (Ubuntu)
Fix Released
High
Unassigned
Oneiric
Fix Released
High
Unassigned

Bug Description

This bug has been hovering in the background for a while with multiarch, and I've recently pinned it down.

When a native-architecture package is removed and a foreign-architecture package gets installed, dpkg makes a wrong calculation somewhere which, on upgrade, results in the foreign-architecture package being "disappeared" from the database. This results in all the files from the package being left on disk (orphaned), and apt happily removing any dependencies of the package that were auto-installed.

Reproducer:

1.Download the 64-bit skype package from <http://www.skype.com/intl/en-us/get-skype/on-your-computer/linux/downloading.ubuntu64> and install it with dpkg (fixing up the dependencies with 'apt-get -f install').

2. Install the skype:i386 package from the Canonical Partner repository for oneiric, using either Software Center or 'apt-get install skype:i386'.
$ sudo apt-get install skype:i386
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  skype
The following NEW packages will be installed:
  skype:i386
0 upgraded, 1 newly installed, 1 to remove and 156 not upgraded.
Need to get 0 B/23.6 MB of archives.
After this operation, 489 kB of additional disk space will be used.
Do you want to continue [Y/n]?

3. Confirm that skype is now removed, but not purged.
$ dpkg -l skype:*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Description
+++-==============-==============-============================================
rc skype 2.2.0.35-1 Skype
ii skype:i386 2.2.0.35-0onei VOIP and instant messaging client

4. Make sure at least one package is out of date on the system and run 'sudo apt-get upgrade':
[...]
Preparing to replace libasound2-python 1.0.24.1-0ubuntu8 (using .../libasound2-p
ython_1.0.24.1-0ubuntu10_amd64.deb) ...
Unpacking replacement libasound2-python ...
(Noting disappearance of skype:i386, which has been completely replaced.)
[...]
Setting up unity-2d (4.12.0-0ubuntu1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Processing triggers for python-support ...
The following package disappeared from your system as
all files have been overwritten by other packages:
  skype
Note: This is done automatic and on purpose by dpkg.
$

5. See that skype:i386 really has been disappeared, and skype:amd64 is still in state 'rc'.
$ dpkg -l skype:*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Description
+++-==============-==============-============================================
rc skype 2.2.0.35-1 Skype
un skype:i386 <none> (no description available)

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: dpkg 1.16.0.3ubuntu4
ProcVersionSignature: Ubuntu 3.0.0-11.18-generic 3.0.4
Uname: Linux 3.0.0-11-generic x86_64
ApportVersion: 1.23-0ubuntu2
Architecture: amd64
Date: Fri Sep 30 13:48:16 2011
InstallationMedia: Ubuntu 10.04.1 LTS "Lucid Lynx" - Release amd64 (20100816.1)
ProcEnviron:
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: dpkg
UpgradeStatus: Upgraded to oneiric on 2011-09-23 (6 days ago)
modified.conffile..etc.dpkg.dpkg.cfg: [modified]
mtime.conffile..etc.dpkg.dpkg.cfg: 2011-08-16T12:02:14.243634

Related branches

Revision history for this message
Steve Langasek (vorlon) wrote :
Changed in dpkg (Ubuntu):
status: New → Triaged
importance: Undecided → High
description: updated
Steve Langasek (vorlon)
Changed in dpkg (Ubuntu Oneiric):
milestone: none → oneiric-updates
Steve Langasek (vorlon)
Changed in dpkg (Ubuntu Oneiric):
milestone: oneiric-updates → ubuntu-11.10
tags: added: rls-mgr-o-tracking
Revision history for this message
Raphaël Hertzog (hertzog) wrote : Re: [Bug 863675] [NEW] dpkg wrongly claims that a foreign-arch package is disappeared by a removed native-arch package

On Fri, 30 Sep 2011, Steve Langasek wrote:
> 3. Confirm that skype is now removed, but not purged.
> $ dpkg -l skype:*
> Desired=Unknown/Install/Remove/Purge/Hold
> | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
> |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
> ||/ Name Version Description
> +++-==============-==============-============================================
> rc skype 2.2.0.35-1 Skype
> ii skype:i386 2.2.0.35-0onei VOIP and instant messaging client

Even this result is not entirely normal. The state "config-files" doesn't
mean much at this point since the .list file has been taken over by
skype:i386.

> 5. See that skype:i386 really has been disappeared, and skype:amd64 is still in state 'rc'.
> $ dpkg -l skype:*
> Desired=Unknown/Install/Remove/Purge/Hold
> | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
> |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
> ||/ Name Version Description
> +++-==============-==============-============================================
> rc skype 2.2.0.35-1 Skype
> un skype:i386 <none> (no description available)

This is the result of two bugs:
1/ The .list file is incorrectly rewritten at the end of the installation
of skype:i386. The one of "skype:amd64" overwrites the one of skype:i386
resulting in an almost empty packages from the point of view of dpkg.
2/ The fact the same .list file is loaded twice and associated to
skype:amd64 and skype:i386 which in turns leads the code that checks
for disappearing packages to believe that the files for skype:amd64
are taken over by skype:i386...

The 2 attached patchs should fix this. They are against the current
pu/multiarch/full branch but they should hopefully apply fine on the
ubuntu package or be trivial to adapt.

But I will go further than this in the upstream branch and will make
sure that the conflicting package are properly "disappeared" as soon
as the replacement package is unpacked.

  tag patch
  status inprogress

Cheers,
--
Raphaël Hertzog ◈ Debian Developer

Pre-order a copy of the Debian Administrator's Handbook and help
liberate it: http://debian-handbook.info/go/ulule-rh/

Changed in dpkg (Ubuntu):
status: Triaged → In Progress
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "0001-dpkg-do-not-try-to-drop-files-from-other-packages-in.patch" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-sponsors please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

Revision history for this message
Steve Langasek (vorlon) wrote :

Patches apply, confirmed here to fix the test case. Uploaded to oneiric.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package dpkg - 1.16.0.3ubuntu5

---------------
dpkg (1.16.0.3ubuntu5) oneiric; urgency=low

  * Cherry pick b8d4668 and 967a45f from pu/multiarch so that cross-grading a
    package doesn't result in dpkg believing the package has been disappeared
    on the next call. Thanks to Raphaël Hertzog <email address hidden> for
    the quick fix! (LP: #863675)
 -- Steve Langasek <email address hidden> Thu, 06 Oct 2011 07:29:02 +0000

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

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.