unattended-upgrade might enter an infinite loop if an upgradable package is on hold

Bug #1265729 reported by Ludovico Cavedon
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
unattended-upgrades (Ubuntu)
Fix Released
Medium
Brian Murray

Bug Description

If a package is upgradable but it is set on hold, unattende-upgrade might enter a infinite 100% CPU loop.

From the log:

2014-01-03 07:19:06,777 INFO Initial blacklisted packages: mysql-server mysql-server-5.1 mysql-server-5.5 mysql-server-core-5.1 mysql-server-core-5.5
2014-01-03 07:19:06,777 INFO Starting unattended upgrades script
2014-01-03 07:19:06,778 INFO Allowed origins are: ['o=Ubuntu,a=precise-security']
2014-01-03 07:19:09,694 INFO Initial blacklisted packages: mysql-server mysql-server-5.1 mysql-server-5.5 mysql-server-core-5.1 mysql-server-core-5.5
2014-01-03 07:19:09,694 INFO Starting unattended upgrades script
2014-01-03 07:19:09,695 INFO Allowed origins are: ['o=Ubuntu,a=precise-security']
2014-01-03 07:19:11,359 DEBUG Checking: curl (["<Origin component:'main' archive:'precise-updates' origin:'Ubuntu' label:'Ubuntu' site:'mirrors.service.softlayer.com' isTrusted:True>", "<Origin component:'main'
archive:'precise-security' origin:'Ubuntu' label:'Ubuntu' site:'mirrors.service.softlayer.com' isTrusted:True>"])
2014-01-03 07:19:11,403 DEBUG pkg 'curl' is on hold
2014-01-03 07:19:11,403 DEBUG sanity check failed
2014-01-03 07:19:12,318 DEBUG Checking: libcurl3 (["<Origin component:'main' archive:'precise-updates' origin:'Ubuntu' label:'Ubuntu' site:'mirrors.service.softlayer.com' isTrusted:True>", "<Origin component:'ma
in' archive:'precise-security' origin:'Ubuntu' label:'Ubuntu' site:'mirrors.service.softlayer.com' isTrusted:True>"])
2014-01-03 07:19:12,934 DEBUG Checking: libcurl3-gnutls (["<Origin component:'main' archive:'precise-updates' origin:'Ubuntu' label:'Ubuntu' site:'mirrors.service.softlayer.com' isTrusted:True>", "<Origin component:'main' archive:'precise-security' origin:'Ubuntu' label:'Ubuntu' site:'mirrors.service.softlayer.com' isTrusted:True>"])
2014-01-03 07:19:13,134 DEBUG pkg 'libcurl3-gnutls' is on hold
2014-01-03 07:19:13,134 DEBUG sanity check failed
2014-01-03 07:19:14,295 DEBUG pkgs that look like they should be upgraded: libcurl3
2014-01-03 07:19:14,328 DEBUG blacklist: ['mysql-server', 'mysql-server-5.1', 'mysql-server-5.5', 'mysql-server-core-5.1', 'mysql-server-core-5.5']
2014-01-03 07:19:15,102 DEBUG Checking (blacklist): libcurl3
2014-01-03 07:19:16,323 INFO Packages that are auto removed: ''
2014-01-03 07:19:16,323 DEBUG InstCount=0 DelCount=0 BrokenCout=0
2014-01-03 07:19:16,323 INFO Packages that are upgraded: libcurl3
2014-01-03 07:19:16,324 INFO Writing dpkg log to '/var/log/unattended-upgrades/unattended-upgrades-dpkg_2014-01-03_07:19:16.324186.log'
2014-01-03 07:19:16,350 DEBUG found partition of size 0 ([])
2014-01-03 07:19:17,118 DEBUG applying set []
2014-01-03 07:19:24,010 DEBUG left to upgrade set(['libcurl3'])
2014-01-03 07:19:24,037 DEBUG found partition of size 0 ([])
2014-01-03 07:19:24,891 DEBUG applying set []
2014-01-03 07:19:32,046 DEBUG left to upgrade set(['libcurl3'])
2014-01-03 07:19:32,080 DEBUG found partition of size 0 ([])
2014-01-03 07:19:32,939 DEBUG applying set []
2014-01-03 07:19:39,982 DEBUG left to upgrade set(['libcurl3'])
2014-01-03 07:19:40,017 DEBUG found partition of size 0 ([])
2014-01-03 07:19:40,893 DEBUG applying set []
2014-01-03 07:19:48,116 DEBUG left to upgrade set(['libcurl3'])
2014-01-03 07:19:48,149 DEBUG found partition of size 0 ([])
2014-01-03 07:19:49,002 DEBUG applying set []
2014-01-03 07:19:55,605 DEBUG left to upgrade set(['libcurl3'])
2014-01-03 07:19:55,639 DEBUG found partition of size 0 ([])

This patch seems to fix the issue:
--- /tmp/unattended-upgrade 2014-01-03 08:00:44.962143452 +0000
+++ /usr/bin/unattended-upgrade 2014-01-03 08:00:49.010144637 +0000
@@ -297,6 +297,8 @@
             else:
                 continue
             changes = [pkg.name for pkg in cache.get_changes()]
+ if not changes:
+ continue
             if len(changes) == 1:
                 logging.debug("found leaf package %s" % pkg.name)
                 smallest_partition = changes

ubuntu-bug report:
ProblemType: Bug
ApportVersion: 2.0.1-0ubuntu17.6
Architecture: amd64
Date: Fri Jan 3 07:40:10 2014
Dependencies:
 apt 0.8.16~exp12+ll2 [origin: <myrepo>.com]
 apt-utils 0.8.16~exp12+ll2 [origin: <myrepo>.com]
 coreutils 8.13-3ubuntu3.2
 debconf 1.5.42ubuntu1
 dpkg 1.16.1.2ubuntu7.2
 gcc-4.6-base 4.6.3-1ubuntu5
 gnupg 1.4.11-3ubuntu2.5 [modified: usr/lib/gnupg/gpgkeys_curl usr/lib/gnupg/gpgkeys_hkp]
 gpgv 1.4.11-3ubuntu2.5
 libacl1 2.2.51-5ubuntu1
 libapt-inst1.4 0.8.16~exp12+ll2 [origin: <myrepo>.com]
 libapt-pkg4.12 0.8.16~exp12+ll2 [origin: <myrepo>.com]
 libattr1 1:2.4.46-5ubuntu1
 libbz2-1.0 1.0.6-1
 libc-bin 2.15-0ubuntu10.5
 libc6 2.15-0ubuntu10.5
 libdb5.1 5.1.25-11build1
 libexpat1 2.0.1-7.2ubuntu1.1
 libgcc1 1:4.6.3-1ubuntu5
 liblzma5 5.1.1alpha+20110809-3
 libncursesw5 5.9-4
 libreadline6 6.2-8
 libselinux1 2.1.0-4.1ubuntu1
 libsqlite3-0 3.7.9-2ubuntu1.1
 libssl1.0.0 1.0.1-4ubuntu5.10
 libstdc++6 4.6.3-1ubuntu5
 libtinfo5 5.9-4
 libusb-0.1-4 2:0.1.12-20
 lsb-release 4.0-0ubuntu20.3
 mime-support 3.51-1ubuntu1
 multiarch-support 2.15-0ubuntu10.5
 perl-base 5.14.2-6ubuntu2.3
 python 2.7.3-0ubuntu2.2
 python-apt 0.8.3ubuntu7.1
 python-apt-common 0.8.3ubuntu7.1
 python-minimal 2.7.3-0ubuntu2.2
 python2.7 2.7.3-0ubuntu3.4
 python2.7-minimal 2.7.3-0ubuntu3.4
 readline-common 6.2-8
 tar 1.26-4ubuntu1
 tzdata 2013g-0ubuntu0.12.04
 ubuntu-keyring 2011.11.21.1
 ucf 3.0025+nmu2ubuntu1
 xz-utils 5.1.1alpha+20110809-3
 zlib1g 1:1.2.3.4.dfsg-3ubuntu4
DistroRelease: Ubuntu 12.04
MarkForUpload: True
Package: unattended-upgrades 0.76ubuntu1 [modified: usr/bin/unattended-upgrade]
PackageArchitecture: all
ProcEnviron:
 TERM=xterm
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 3.2.0-48.74-virtual 3.2.46
SourcePackage: unattended-upgrades
Tags: third-party-packages precise
Uname: Linux 3.2.0-48-virtual x86_64
UpgradeStatus: Upgraded to precise on 2013-06-28 (189 days ago)
modified.conffile..etc.apt.apt.conf.d.50unattended.upgrades:
 // Automatically upgrade packages from these (origin:archive) pairs
 Unattended-Upgrade::Allowed-Origins {
  "${distro_id}:${distro_codename}-security";
 // "${distro_id}:${distro_codename}-updates";
 // "${distro_id}:${distro_codename}-proposed";
 // "${distro_id}:${distro_codename}-backports";
 };

 // List of packages to not update
 Unattended-Upgrade::Package-Blacklist {
 // "vim";
 // "libc6";
 // "libc6-dev";
 // "libc6-i686";
         "mysql-server";
         "mysql-server-5.1";
         "mysql-server-5.5";
         "mysql-server-core-5.1";
         "mysql-server-core-5.5";
 };

 // This option allows you to control if on a unclean dpkg exit
 // unattended-upgrades will automatically run
 // dpkg --force-confold --configure -a
 // The default is true, to ensure updates keep getting installed
 Unattended-Upgrade::AutoFixInterruptedDpkg "true";

 // Split the upgrade into the smallest possible chunks so that
 // they can be interrupted with SIGUSR1. This makes the upgrade
 // a bit slower but it has the benefit that shutdown while a upgrade
 // is running is possible (with a small delay)
 Unattended-Upgrade::MinimalSteps "true";

 // Install all unattended-upgrades when the machine is shuting down
 // instead of doing it in the background while the machine is running
 // This will (obviously) make shutdown slower
 Unattended-Upgrade::InstallOnShutdown "false";

 // Send email to this address for problems or packages upgrades
 // If empty or unset then no email is sent, make sure that you
 // have a working mail setup on your system. A package that provides
 // 'mailx' must be installed.
 Unattended-Upgrade::Mail "XXXXXXX";

 // Set this value to "true" to get emails only on errors. Default
 // is to always send a mail if Unattended-Upgrade::Mail is set
 Unattended-Upgrade::MailOnlyOnError "true";

 // Do automatic removal of new unused dependencies after the upgrade
 // (equivalent to apt-get autoremove)
 Unattended-Upgrade::Remove-Unused-Dependencies "true";

 // Automatically reboot *WITHOUT CONFIRMATION* if a
 // the file /var/run/reboot-required is found after the upgrade
 Unattended-Upgrade::Automatic-Reboot "false";

 // Use apt bandwidth limit feature, this example limits the download
 // speed to 70kb/sec
 //Acquire::http::Dl-Limit "70";

mtime.conffile..etc.apt.apt.conf.d.50unattended.upgrades: 2013-06-28T01:45:43.671311

Tags: patch

Related branches

Revision history for this message
Ludovico Cavedon (cavedon) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "unattende-upgrade.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Brian Murray (brian-murray) wrote :

Thanks for working on this and the patch. While the patch looks good I tried recreating the bug by putting an upgradeable package on hold in precise and saucy and was unable to recreate the bug. Could you provide a test case for this bug report? Thanks in advance.

Changed in unattended-upgrades (Ubuntu):
status: New → Incomplete
Changed in unattended-upgrades (Ubuntu):
status: Incomplete → Triaged
importance: Undecided → Medium
assignee: nobody → Brian Murray (brian-murray)
Changed in unattended-upgrades (Ubuntu):
status: Triaged → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package unattended-upgrades - 0.82.1ubuntu1

---------------
unattended-upgrades (0.82.1ubuntu1) trusty; urgency=medium

  * debian/tests/control: Add missing python-apt test dependency, so that
    tests also work with Python 2.
 -- Martin Pitt <email address hidden> Tue, 25 Feb 2014 09:45:18 +0100

Changed in unattended-upgrades (Ubuntu):
status: Fix Committed → 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.