'aptitude safe-upgrade -d -y' enters infinite loop

Bug #975793 reported by NooP on 2012-04-07
This bug affects 21 people
Affects Status Importance Assigned to Milestone
Fix Released
aptitude (Ubuntu)

Bug Description


Users of aptitude can not download updates in advance with the
intention of installing them later. One common use case is using
apt-cron to download all available updates at night then reviewing
and installing a subset of them later.

The problem does not occur for all users, but can be traced to a
point where the download/install logic invokes dpkg even though it
is supposed to only download packages.

[Test Case]

* Wait for package updates to be available:

  # aptitude clean && aptitude update
  Current status: 6 updates [+6].

* Fetch the updates using -d (download only) and observe that
  after the download, aptitude loops (appears stuck) without
  ever exiting:

  # aptitude safe-upgrade -d -y
  Get: 5 http://fr.archive.ubuntu.com/ubuntu precise/main insserv i386 1.14.0-2.1ubuntu2 [50.1 kB]
  Get: 6 http://fr.archive.ubuntu.com/ubuntu precise/main iproute i386 20111117-1ubuntu2 [441 kB]
  Fetched 3574 kB in 0s (9562 kB/s)

[Regression Potential]


* Small patch touching only one file.

* Some of the updated logic can be checked against similar code
  in apt/cmndline/apt-get.cc(InstallPackages).

* Fixed in Debian sid since May with no regressions reported.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: aptitude 0.6.6-1ubuntu1
ProcVersionSignature: Ubuntu 3.2.0-22.35-generic-pae 3.2.14
Uname: Linux 3.2.0-22-generic-pae i686
ApportVersion: 2.0-0ubuntu4
Architecture: i386
Date: Sat Apr 7 10:36:46 2012
 PATH=(custom, no user)
SourcePackage: aptitude
UpgradeStatus: No upgrade log present (probably fresh install)

NooP (noop) wrote :
Daniel Hartwig (wigs) wrote :

Provide log of output from safe-upgrade, perhaps also your apt/aptitude conf files.

Changed in aptitude (Ubuntu):
status: New → Incomplete
NooP (noop) wrote :

No modifications on aptitude / apt configs.

Here is what I do :

aptitude clean && aptitude update

This work fine and update package lists corectly.

But now, if I do either 'aptitude safe-upgrade -d -y' or 'aptitude safe-upgrade -d', here is what I get :

root@precise:~# LANG="C" aptitude safe-upgrade -d
The following packages will be upgraded:
  dpkg insserv iproute login passwd update-notifier-common
The following packages are RECOMMENDED but will NOT be installed:
6 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 3574 kB of archives. After unpacking 1024 B will be used.
Do you want to continue? [Y/n/?] y
Get: 1 http://fr.archive.ubuntu.com/ubuntu precise/main dpkg i386 [1813 kB]
Get: 2 http://fr.archive.ubuntu.com/ubuntu precise/main login i386 1: [287 kB]
Get: 3 http://fr.archive.ubuntu.com/ubuntu precise/main update-notifier-common all 0.119ubuntu5 [48.0 kB]
Get: 4 http://fr.archive.ubuntu.com/ubuntu precise/main passwd i386 1: [935 kB]
Get: 5 http://fr.archive.ubuntu.com/ubuntu precise/main insserv i386 1.14.0-2.1ubuntu2 [50.1 kB]
Get: 6 http://fr.archive.ubuntu.com/ubuntu precise/main iproute i386 20111117-1ubuntu2 [441 kB]
Fetched 3574 kB in 0s (9562 kB/s)

And then, aptitude loops without sending any output nor logs (aptitude, kern, message).

If I do 'aptitude safe-upgrade -y', then aptitude downloads corectly it's packages then install them without problems.
It seems that this is ONLY the '-d' option which causes problems. The problem is the same eitherin my native language (fr_FR.UTF8) or by forcing english language (LANG="C").

Changed in aptitude:
status: Unknown → New
Daniel Hartwig (wigs) wrote :

Though I was not able to (quickly) reproduce this the attached patch
should fix it.

Could affected users please test and confirm the results.

Changed in aptitude (Ubuntu):
status: Incomplete → Confirmed

The attachment "0001-Avoid-dpkg-and-infinite-loop-in-download-only-mode.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-reviewers team 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.]

tags: added: patch
AndresVia (andresvia) wrote :

I apply the patch to aptitude source-code and confirm that it fixes the bug.

Changed in aptitude:
status: New → Fix Committed
Changed in aptitude:
status: Fix Committed → Fix Released
Allo (allo) wrote :

in which version was the patch applied?

On 16 May 2012 15:38, Alexander Schier <email address hidden> wrote:
> in which version was the patch applied?

From the associated Debian report[1]:

> Fixed in version aptitude/0.6.7-1

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=629266

AndresVia (andresvia) wrote :

Patch applied to: aptitude_0.6.6-1ubuntu1.debian

Allo (allo) wrote :

seems, this is still an issue with cron-apt:
$ apt-cache policy aptitude
  Installed: 0.6.6-1ubuntu1
  Candidate: 0.6.6-1ubuntu1

OPTIONS="-o Acquire::http::Dl-Limit=2000"

$ cat action.d/0-update
update -o quiet=2
$ cat action.d/3-download
autoclean -y
dist-upgrade -d -y -o APT::Get::Show-Upgraded=true
$ cat action.d/5-install
autoclean -y
dist-upgrade --safe-resolver -y -o APT:Get:Show-Upgraded=true

resulting in error mails like this one:
CRON-APT RUN [/etc/cron-apt/config]: Tue May 22 04:00:01 CEST 2012
CRON-APT SLEEP: 3161, Tue May 22 04:52:42 CEST 2012
CRON-APT ACTION: 3-download
CRON-APT LINE: /usr/bin/aptitude -o Acquire::http::Dl-Limit=2000 dist-upgrade -d -y -o APT::Get::Show-Upgraded=true
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...
The following packages will be upgraded:
  icedtea-6-jre-cacao icedtea-6-jre-jamvm linux-headers-3.2.0-24
  update-manager-core update-manager-kde
20 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 53.3 MB/98.0 MB of archives. After unpacking 2030 kB will be used.
Writing extended state information...
Get: 1 http://pi.wiss-stud/ubuntu/ precise-updates/main linux-image-3.2.0-24-generic amd64 3.2.0-24.38 [38.3 MB]
Fetched 53.3 MB in 23s (2243 kB/s)
E: Failed to write temporary StateFile /var/lib/apt/extended_states.tmp
Reading package lists...
Building dependency tree...
Reading state information...
Reading extended state information...
Initializing package states...

I'm not quite sure, if this bug really is the relevant one, but i was redirected to this bug in: https://bugs.launchpad.net/ubuntu/+source/apt/+bug/999810 because the other bug is only related to apt-get.

Daniel Hartwig (wigs) wrote :

> seems, this is still an issue with cron-apt:
> $ apt-cache policy aptitude
> aptitude:
> Installed: 0.6.6-1ubuntu1
> Candidate: 0.6.6-1ubuntu1

Yes. The previous message indicating "Patch applied to: aptitude_0.6.6-1ubuntu1.debian" was not saying that the ubuntu package has been fixed, rather, that the patch does apply to that version.

You should apply the patch yourself or encourage your distribution to include a more recent version of aptitude.

Jonathan Reed (jdreed) wrote :

Can this make it into Qantal and/or get SRU'd for Precise? Or are we unlikely to see this fix until the next import from Debian for 13.04?

Launchpad Janitor (janitor) wrote :
Download full text (4.3 KiB)

This bug was fixed in the package aptitude - 0.6.8-1ubuntu1

aptitude (0.6.8-1ubuntu1) quantal; urgency=low

  * Resynchronise with Debian. Remaining changes:
    - debian/05aptitude: Never autoremove kernels.
    - Drop aptitude-doc to Suggests.
    - 03_branding: Ubuntu branding.
    - 04_changelog: Take changelogs from changelogs.ubuntu.com.
    - 14_html2text_preferred: Switch back to html2text in favor of elinks,
      since html2text is in main and elinks isn't. Convert all files to utf-8
      encoding as it is better then ascii for iso-8859-1 (English docs).
    - no-google-mock: Don't use google-mock as it and libgtest-dev are in
      universe. Refreshed to cover all changes.

aptitude (0.6.8-1) unstable; urgency=low

  * Fix build with g++ 4.7
    Thanks Adrian Lang for the patch (Closes: #672335)
  * New binary packages:
    - aptitude-doc-it: Italian documentation (Closes: #674664)
    - aptitude-common: data files and translations
  * debian/rules:
    - use dh (debhelper command sequencer)
  * Require libapt-pkg 0.9.3 to avoid "Method http has died
    unexpectedly" (Closes: #669322)
  * Removed preinst script, the one transition it handled is
    over ten years old.
  * New upstream release.
    - Update to tasks support: task packages, multi-arch, syntax

      Task packages (introduced with tasksel 3.0) are
      meta-packages which define the dependencies of tasks. The
      packages themselves have always worked but the 'tasks'
      grouping policy and '?task' search term did not support
      them. This update corrects for this.

      As a result of this change to tasksel all Debian tasks now
      function exactly like meta-packages. (Closes: #382631)

      The syntax for installing tasks from the command line has
      been updated. It now supports specifying an arch and
      requires the same syntax as apt-utils ('^' must be the last
      part of the name). Examples:

        # aptitude install gnome-desktop^
        # aptitude install ssh-server^:armel

      This avoids ambiguity that may arise when a task and
      package have the same name.
    - Changelog downloading is restored
      (Closes: #669569, LP: #824708)
    - Exit with non-zero status when a package run is
      aborted. (Closes: #293008)
    - Restore candidate version on undo, keep
      (Closes: #529403)
    - Adjust default widths of localized columns:
      broken_count, downloadsize (Closes: #674045)
    - Update package views after 'Cancel pending actions'
      (Closes: #595753)
    - Fix minor errors in documentation. Thanks to Beatrice Torracca
      (Closes: #674675)
    - Fix groff warning in manpage (Closes: #675085)
    - Translation updates:
      + French (Closes: #673827, LP: #642840)
      + German (Closes: #672467, #668875)
      + Simplified Chinese

aptitude (0.6.7-1) unstable; urgency=low

  * Fix FTBFS in sid: include build of gtest when building gmock
   (Closes: #670403, #671439)

  * New upstream release.

    - Avoid dpkg and infinite loop in download-only mode
      (Closes: #629266, LP: #975793)

    - Check for apt_init errors in cmdline_download.cc (Closes: #670379)

    - Downloading/installing...


Changed in aptitude (Ubuntu):
status: Confirmed → Fix Released
Daniel Hartwig (wigs) on 2012-08-21
description: updated
Marcin Juszkiewicz (hrw) wrote :

Updated "precise" package to have also fix for bug #975793 as suggested.

Location: http://tygrysek.juszkiewicz.com.pl/~hrw/ubuntu/

Please test.

Thilo Uttendorfer (t-lo) wrote :

I installed aptitude_0.6.6-1ubuntu2_amd64.deb from your repo. It works as expected!

Will there be an updated version released in precise?

Valentin Höbel (t-valentin) wrote :

Thanks Marcin, works like a charm.

Daniel Hartwig (wigs) wrote :

The debdiff for precise SRU is attached to bug #824708.

Micah Gersten (micahg) wrote :

sponsored debdiff from Bug #824708

Changed in aptitude (Ubuntu Precise):
status: New → Fix Committed
lenios (lenios) wrote :

I had the bug and installed aptitude_0.6.6-1ubuntu2_amd64.deb. I'm pleased to say it fixes the bug also for me.

Clint Byrum (clint-fewbar) wrote :

Micah, standard SRU procedure is to only change status to 'Fix Committed' when the fix has been accepted into precise-proposed. It should be In Progress.

tags: added: verification-needed

Hello NooP, or anyone else affected,

Accepted aptitude into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/aptitude/0.6.6-1ubuntu1.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please change the bug tag from verification-needed to verification-done. If it does not, change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Daniel Hartwig (wigs) on 2012-11-06
tags: added: verification-done
removed: verification-needed

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package aptitude - 0.6.6-1ubuntu1.1

aptitude (0.6.6-1ubuntu1.1) precise-proposed; urgency=low

  * Apply cherry-picked patches from upstream:
    - fix changelog fetching. LP: #824708
    - avoid dpkg and infinite loop in download-only mode. LP: #975793
 -- Marcin Juszkiewicz <email address hidden> Mon, 10 Sep 2012 14:22:56 -0500

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

Other bug subscribers

Remote bug watches

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