/usr/bin/unattended-upgrade:AssertionError:/usr/bin/unattended-upgrade@1927:main:do_install

Bug #1779157 reported by errors.ubuntu.com bug bridge
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
unattended-upgrades (Ubuntu)
Fix Released
High
Balint Reczey
Xenial
Fix Released
High
Unassigned
Bionic
Fix Released
High
Unassigned
Cosmic
Fix Released
Undecided
Unassigned

Bug Description

[Impact]

 * Unattended-upgrades can be crashing when packages are marked for removal after collecting upgradable packages.
 * The fix clear the cache when it may be in an invalid state to lose markings.

[Test Case]

 * Observe https://errors.ubuntu.com/problem/66b5fef8d6dd83a7db6c494c807cfc067626c0c2 not occurring in fixed versions.

[Regression Potential]

 * The extra cache.clear() can take extra CPU time when invoked needlessly or can cause skipping updates when invoked at the wrong time. However the fix received extensive testing in newer releases making unnoticed regressions unlikely to surface.

[Original Bug Text]

The Ubuntu Error Tracker has been receiving reports about a problem regarding unattended-upgrades. This problem was most recently seen with package version 1.1ubuntu1.18.04.1, the problem page at https://errors.ubuntu.com/problem/9b1b98279fa2b503abb1b1b69bec0cabf647be0c contains more details, including versions of packages affected, stacktrace or traceback, and individual crash reports.
If you do not have access to the Ubuntu Error Tracker and are a software developer, you can request it at http://forms.canonical.com/reports/.

Traceback

Traceback (most recent call last):
  File "/usr/bin/unattended-upgrade", line 1927, in <module>
    sys.exit(main(options))
  File "/usr/bin/unattended-upgrade", line 1782, in main
    logfile_dpkg)
  File "/usr/bin/unattended-upgrade", line 1057, in do_install
    "removal:%s" % "".join([pkg.name for pkg in marked_delete]))
AssertionError: Internal error. The following packages are marked for removal:linux-headers-4.15.0-20-generic

Also seen as:
https://errors.ubuntu.com/problem/733d2e7865692e215f406231edd3692a6a1810c5

Balint Reczey (rbalint)
description: updated
Changed in unattended-upgrades (Ubuntu):
status: New → In Progress
assignee: nobody → Balint Reczey (rbalint)
importance: Undecided → High
Revision history for this message
Balint Reczey (rbalint) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

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

---------------
unattended-upgrades (1.4ubuntu1) cosmic; urgency=medium

  * Merge from Debian unstable
    - Remaining changes:
      - unattended-upgrades: Do not automatically upgrade the development
        release of Ubuntu unless Unattended-Upgrade::DevRelease is true.
    - Dropped changes, included in Debian:
      - Stop rewriting test apt.conf in test_untrusted.py.
      - Fix test_on_battery on Ubuntu development releases

unattended-upgrades (1.4) unstable; urgency=medium

  * Skip starting init.d script in debhelper-generated postinst part
    (LP: #1778800)
  * Use "deb-systemd-invoke start" instead of "systemctl start" in postinst.
    It is used only in a workaround applied for a Debian bug and for upgrading
    from pre-bionic versions.
  * Clear cache when autoremoval is invalid for a package set marked for
    removal (LP: #1779157)
  * Clear cache after failed commits to return from a possibly invalid state
  * Unlock for dpkg operations with apt_pkg.pkgsystem_unlock_inner() when it
    is available, also stop running when reacquiring the lock fails.
    Thanks to to Julian Andres Klode for original partial patch
  * Use fully qualified domain name in email subject.
  * Send email about all failures and crashes (Closes: #898607)
  * Add short textual summary of the results in the summary email
  * Recommend overriding configuration in a separate file.
    This can be better than changing /etc/apt/apt.conf.d/50unattended-upgrades
    because package updates don't conflict with local changes this way.
  * Adjust candidates only for packages to be possibly installed
    (Closes: #892028, #899366) (LP: #1396787)
  * Add Unattended-Upgrade::OnlyOnACPower config file example for all
    distributions
  * debian/control: Drop redundant Testsuite: autopkgtest field to keep Lintian
    happy
  * Bump Standards-Version to 4.1.4
  * Add debian/tests/upgrade-all-security to install all current security
    updates. On development releases this tests latest stable, on stable
    releases it tests the release itself.
  * Skip updates on metered connections (Closes: #855570)
  * Quote shell variables in autopkgtest
  * Stop u-u early when it should stop later anyway
  * Measure time for --dry-run and after all updates are installed in
    autopkgtests
  * Filter out packages cheaper when they are not from allowed origins
  * Collect autoremovable packages, too, when looking for upgradable ones

 -- Balint Reczey <email address hidden> Fri, 06 Jul 2018 13:33:29 +0200

Changed in unattended-upgrades (Ubuntu):
status: In Progress → Fix Released
Balint Reczey (rbalint)
description: updated
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Please test proposed package

Hello errors.ubuntu.com, or anyone else affected,

Accepted unattended-upgrades into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/unattended-upgrades/1.1ubuntu1.18.04.2 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 on 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 add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

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

Changed in unattended-upgrades (Ubuntu Bionic):
status: New → Fix Committed
tags: added: verification-needed verification-needed-bionic
Revision history for this message
Steve Langasek (vorlon) wrote :

Hello errors.ubuntu.com, or anyone else affected,

Accepted unattended-upgrades into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/unattended-upgrades/1.1ubuntu1.18.04.3 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 on 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 add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

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

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Hello errors.ubuntu.com, or anyone else affected,

Accepted unattended-upgrades into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/unattended-upgrades/1.1ubuntu1.18.04.4 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 on 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 add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

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

Revision history for this message
Balint Reczey (rbalint) wrote :

The problem seems to be gone on errors.ubuntu.com.
There are a few errors falsely reported against the fixed version (1.1ubuntu1.18.04.4) but those are cases where the buggy version upgraded the package and afterwards apport collected the version of the fixed package, which did not run yet.

Also note that in the stack trace the u-u versions are mixed,
only 1.1ubuntu1.18.04.1 raises the error at line 1065 in do_install,
but the "if dpkg_log_content:" is from 1.1ubuntu1.18.04.4.

Traceback (most recent call last):
  File "/usr/bin/unattended-upgrade", line 1935, in <module>
  File "/usr/bin/unattended-upgrade", line 1790, in main
    cache, auto_removable_kernel_pkgs,
  File "/usr/bin/unattended-upgrade", line 1065, in do_install
    if dpkg_log_content:
AssertionError: Internal error. The following packages are marked for removal:linux-modules-extra-4.15.0-23-generic

(https://errors.ubuntu.com/oops/84855090-8807-11e8-b8b4-fa163e192766)

tags: added: verification-done verification-needed-done
removed: verification-needed verification-needed-bionic
Balint Reczey (rbalint)
tags: added: verification-done-bionic
removed: verification-needed-done
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package unattended-upgrades - 1.1ubuntu1.18.04.4

---------------
unattended-upgrades (1.1ubuntu1.18.04.4) bionic; urgency=medium

  * Redirect stderr output in upgrade-between-snapshots, too, otherwise it
    breaks the test sometimes (LP: #1781446)

unattended-upgrades (1.1ubuntu1.18.04.3) bionic; urgency=medium

  * Redirect stderr output in upgrade-all-security, otherwise it breaks the
    test (LP: #1781446)

unattended-upgrades (1.1ubuntu1.18.04.2) bionic; urgency=medium

  [ Balint Reczey ]
  * Clear cache when autoremoval is invalid for a package set marked for
    removal and clear cache after failed commits to return from a possibly
    invalid state (LP: #1779157)
  * Don't start or gracefully stop upgrade on battery (LP: #1773033)
  * Skip updates on metered connections (Closes: #855570) (LP: #1781183)
  * Add debian/tests/upgrade-all-security to install all current security updates.
    On development releases this tests latest stable, on stable releases it tests
    the release itself.
  * Speed up unattended-upgrade (Closes: #892028, #899366) (LP: #1396787)
    - Adjust candidates only for packages to be possibly installed
    - Filter out packages cheaper when they are not from allowed origins
    - Collect autoremovable packages, too, when looking for upgradable ones
    - Measure time of running with --dry-run in autopkgtests
  * Skip starting init.d script in debhelper-generated postinst part
    (LP: #1778800)

  [ Ivan Kurnosov ]
  * Fixed is_pkgname_in_blacklist to be side-effect free. (LP: #1781176)
    Otherwise 'is_pkgname_in_blacklist' mutates the 'pkgs_kept_back' and
    'unattended-upgrades' treats the package as a blacklisted candidate

 -- Balint Reczey <email address hidden> Fri, 13 Jul 2018 10:36:23 +0200

Changed in unattended-upgrades (Ubuntu Bionic):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for unattended-upgrades 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 regressions.

Balint Reczey (rbalint)
description: updated
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello errors.ubuntu.com, or anyone else affected,

Accepted unattended-upgrades into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/unattended-upgrades/1.1ubuntu1.18.04.7~16.04.0 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 on 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 add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-xenial to verification-done-xenial. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-xenial. In either case, without details of your testing we will not be able to proceed.

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

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in unattended-upgrades (Ubuntu Xenial):
status: New → Fix Committed
tags: added: verification-needed verification-needed-xenial
removed: verification-done
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Hello errors.ubuntu.com, or anyone else affected,

Accepted unattended-upgrades into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/unattended-upgrades/1.1ubuntu1.18.04.7~16.04.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 on 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 add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-xenial to verification-done-xenial. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-xenial. In either case, without details of your testing we will not be able to proceed.

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

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Mathew Hodson (mhodson)
Changed in unattended-upgrades (Ubuntu Xenial):
importance: Undecided → High
Changed in unattended-upgrades (Ubuntu Bionic):
importance: Undecided → High
Revision history for this message
Balint Reczey (rbalint) wrote :

The problem still exists in 1.1ubuntu1.18.04.7~16.04.1 (and 1.1ubuntu1.18.04.8):

https://errors.ubuntu.com/problem/dc828b331e8948ac9875455b6f5653eeaf9f1022

tags: added: verification-failed verification-failed-xenial
removed: verification-needed verification-needed-xenial
Changed in unattended-upgrades (Ubuntu Xenial):
status: Fix Committed → Confirmed
Balint Reczey (rbalint)
Changed in unattended-upgrades (Ubuntu Xenial):
status: Confirmed → In Progress
tags: added: id-5c5c4808c0b18e80534bdd44
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Hello errors.ubuntu.com, or anyone else affected,

Accepted unattended-upgrades into cosmic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/unattended-upgrades/1.5ubuntu3.18.10.2 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 on 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 add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-cosmic to verification-done-cosmic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-cosmic. In either case, without details of your testing we will not be able to proceed.

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

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in unattended-upgrades (Ubuntu Cosmic):
status: New → Fix Committed
tags: added: verification-needed verification-needed-cosmic
removed: verification-failed
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Hello errors.ubuntu.com, or anyone else affected,

Accepted unattended-upgrades into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/unattended-upgrades/1.1ubuntu1.18.04.9 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 on 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 add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

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

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in unattended-upgrades (Ubuntu Bionic):
status: Fix Released → Fix Committed
tags: added: verification-needed-bionic
removed: verification-done-bionic
Balint Reczey (rbalint)
tags: added: verification-done-bionic verification-done-cosmic
removed: verification-needed-bionic verification-needed-cosmic
Revision history for this message
Balint Reczey (rbalint) wrote :

The issue is not seen in either unattended-upgrades/1.1ubuntu1.18.04.9 or unattended-upgrades/1.5ubuntu3.18.10.2 but it should be noted that in the past week the issue was observed only 12 times with 1.1ubuntu1.18.04.8:
https://errors.ubuntu.com/?package=unattended-upgrades&period=week&version=1.1ubuntu1.18.04.8

Considering that only a tiny fraction of the users enable bionic-proposed the issues are unlikely to be observed while the tested packages are in -proposed.

Since the issue is observed rarely anyway I suggest releasing the update to not hold back other fixes and if the issue surfaced again we can look for a different root cause.

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Hello errors.ubuntu.com, or anyone else affected,

Accepted unattended-upgrades into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/unattended-upgrades/1.1ubuntu1.18.04.7~16.04.2 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 on 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 add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-xenial to verification-done-xenial. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-xenial. In either case, without details of your testing we will not be able to proceed.

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

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in unattended-upgrades (Ubuntu Xenial):
status: In Progress → Fix Committed
tags: added: verification-needed-xenial
removed: verification-failed-xenial
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package unattended-upgrades - 1.5ubuntu3.18.10.2

---------------
unattended-upgrades (1.5ubuntu3.18.10.2) cosmic; urgency=medium

  * Clear cache when autoremoval fails (LP: #1779157)
  * Find autoremovable kernel packages using the patterns in APT's way
    (LP: #1815494)
  * Filter out progress indicator from dpkg log (LP: #1599646)

 -- Balint Reczey <email address hidden> Thu, 21 Feb 2019 15:10:13 +0100

Changed in unattended-upgrades (Ubuntu Cosmic):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package unattended-upgrades - 1.1ubuntu1.18.04.9

---------------
unattended-upgrades (1.1ubuntu1.18.04.9) bionic; urgency=medium

  * debian/changlog: Drop extra trailer after old entry
  * Don't check blacklist too early and report updates from not allowed origins
    as kept back. (LP: #1781176)
  * test/test_blacklisted_wrong_origin.py: Fix and enable test
  * Clear cache when autoremoval fails (LP: #1779157)
  * Find autoremovable kernel packages using the patterns in APT's way
    (LP: #1815494)

 -- Balint Reczey <email address hidden> Thu, 21 Feb 2019 14:58:38 +0100

Changed in unattended-upgrades (Ubuntu Bionic):
status: Fix Committed → Fix Released
Revision history for this message
Balint Reczey (rbalint) wrote :

The error is still not seen in Xenial's 1.1ubuntu1.18.04.7~16.04.2:

https://errors.ubuntu.com/?package=unattended-upgrades&period=year&version=1.1ubuntu1.18.04.7~16.04.2

tags: added: verification-done verification-done-xenial
removed: verification-needed verification-needed-xenial
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (33.9 KiB)

This bug was fixed in the package unattended-upgrades - 1.1ubuntu1.18.04.7~16.04.2

---------------
unattended-upgrades (1.1ubuntu1.18.04.7~16.04.2) xenial; urgency=medium

  * Don't check blacklist too early and report updates from not allowed origins
    as kept back. (LP: #1781176)
  * test/test_blacklisted_wrong_origin.py: Fix and enable test
  * Filter out progress indicator from dpkg log (LP: #1599646)
  * Clear cache when autoremoval fails (LP: #1779157)
  * Find autoremovable kernel packages using the patterns in APT's way
    (LP: #1815494)

unattended-upgrades (1.1ubuntu1.18.04.7~16.04.1) xenial; urgency=medium

  * Start service after systemd-logind.service to be able to take inhibition
    lock (LP: #1806487)
  * Handle gracefully when logind is down (LP: #1806487)

unattended-upgrades (1.1ubuntu1.18.04.7~16.04.0) xenial; urgency=medium

  * Backport to Xenial (LP: #1702793)
  * Revert to build-depending on debhelper (>= 9~) and dh-systemd
  * Revert configuration example changes to avoid triggering a debconf question
  * debian/postinst: Update recovery to be triggered on Xenial's package versions

unattended-upgrades (1.1ubuntu1.18.04.7) bionic; urgency=medium

  * Trigger unattended-upgrade-shutdown actions with PrepareForShutdown()
    Performing upgrades in service's ExecStop did not work when the upgrades
    involved restarting services because systemd blocked other stop/start
    actions making maintainer scripts time out and be killed leaving a broken
    system behind.
    Running unattended-upgrades.service before shutdown.target as a oneshot
    service made it run after unmounting filesystems and scheduling services
    properly on shutdown is a complex problem and adding more services to the
    mix make it even more fragile.
    The solution of monitoring PrepareForShutdown() signal from DBus
    allows Unattended Upgrade to run _before_ the jobs related to shutdown are
    queued thus package upgrades can safely restart services without
    risking causing deadlocks or breaking part of the shutdown actions.
    Also ask running unattended-upgrades to stop when shutdown starts even in
    InstallOnShutdown mode and refactor most of unattended-upgrade-shutdown to
    UnattendedUpgradesShutdown class. (LP: #1778219)
  * Increase logind's InhibitDelayMaxSec to 30s. (LP: #1778219)
    This allows more time for unattended-upgrades to shut down gracefully
    or even install a few packages in InstallOnShutdown mode, but is still a
    big step back from the 30 minutes allowed for InstallOnShutdown previously.
    Users enabling InstallOnShutdown node are advised to increase
    InhibitDelayMaxSec even further possibly to 30 minutes.
    - Add NEWS entry about increasing InhibitDelayMaxSec and InstallOnShutdown
      changes
  * Ignore "W503 line break before binary operator"
    because it will become the best practice and breaks the build
  * Stop using ActionGroups, they interfere with apt.Cache.clear()
    causing all autoremovable packages to be handled as newly autoremovable
    ones and be removed by default. Dropping ActionGroup usage does not slow
    down the most frequent case of not having anything to upgrade a...

Changed in unattended-upgrades (Ubuntu Xenial):
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.