unattended-upgrades crashes without writing to the log on invalid config file entries

Bug #1680599 reported by Dan Valentine
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
unattended-upgrades (Ubuntu)
Fix Released
Medium
Brian Murray
Xenial
Fix Released
Undecided
Unassigned

Bug Description

If Unattended-Upgrade::Allowed-Origins in 50unattended-upgrades contains an invalid entry, such as "invalid", unattended-upgrades crashes without writing to /var/log/unattended-upgrades/unattended-upgrades.log.

# unattended-upgrades --debug
Traceback (most recent call last):
  File "/usr/bin/unattended-upgrades", line 1536, in <module>
    main(options)
  File "/usr/bin/unattended-upgrades", line 1202, in main
    allowed_origins = get_allowed_origins()
  File "/usr/bin/unattended-upgrades", line 343, in get_allowed_origins
    allowed_origins = get_allowed_origins_legacy()
  File "/usr/bin/unattended-upgrades", line 328, in get_allowed_origins_legacy
    (distro_id, distro_codename) = s.split()
ValueError: not enough values to unpack (expected 2, got 1)

0.92ubuntu1.2 on 16.10

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

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in unattended-upgrades (Ubuntu):
status: New → Confirmed
Revision history for this message
Patrik Karisch (patkar) wrote :

Same error with 0.90ubuntu0.5 on Ubuntu 16.04

# unattended-upgrades --debug --dry-run
Initial blacklisted packages:
Initial whitelisted packages:
Starting unattended upgrades script
Allowed origins are: ['o=Ubuntu,a=xenial-security', 'o=Ubuntu,a=xenial-updates', 'o=Ubuntu,a=xenial', 'o=packagecloud.io/slacktechnologies/slack', 'o=Google, Inc.', 'o=Node Source,n=xenial']
Traceback (most recent call last):
  File "/usr/bin/unattended-upgrades", line 1473, in <module>
    main(options)
  File "/usr/bin/unattended-upgrades", line 1198, in main
    allowed_origins=allowed_origins)
  File "/usr/bin/unattended-upgrades", line 105, in __init__
    self.adjust_candidate_versions()
  File "/usr/bin/unattended-upgrades", line 126, in adjust_candidate_versions
    if is_allowed_origin(pkg.candidate, self.allowed_origins):
  File "/usr/bin/unattended-upgrades", line 512, in is_allowed_origin
    if match_whitelist_string(allowed, origin):
  File "/usr/bin/unattended-upgrades", line 363, in match_whitelist_string
    for s in token.split("=")]
ValueError: not enough values to unpack (expected 2, got 1)

tags: added: rls-aa-incoming
Revision history for this message
Patrik Karisch (patkar) wrote :

Ok, that's a strange behavior. As long as there are no pending updates, it's fine.

When there is an update available it errors:

Traceback (most recent call last):
  File "/usr/bin/unattended-upgrades", line 1473, in <module>
    main(options)
  File "/usr/bin/unattended-upgrades", line 1198, in main
    allowed_origins=allowed_origins)
  File "/usr/bin/unattended-upgrades", line 105, in __init__
    self.adjust_candidate_versions()
  File "/usr/bin/unattended-upgrades", line 126, in adjust_candidate_versions
    if is_allowed_origin(pkg.candidate, self.allowed_origins):
  File "/usr/bin/unattended-upgrades", line 512, in is_allowed_origin
    if match_whitelist_string(allowed, origin):
  File "/usr/bin/unattended-upgrades", line 363, in match_whitelist_string
    for s in token.split("=")]
ValueError: not enough values to unpack (expected 2, got 1)

Revision history for this message
Aex Rauch (centaurie) wrote :

xenial with unattended-upgrades:
  Installiert: 0.90ubuntu0.5
  Installationskandidat: 0.90ubuntu0.5

unattended-upgrades --debug
Traceback (most recent call last):
  File "/usr/bin/unattended-upgrades", line 1473, in <module>
    main(options)
  File "/usr/bin/unattended-upgrades", line 1139, in main
    allowed_origins = get_allowed_origins()
  File "/usr/bin/unattended-upgrades", line 341, in get_allowed_origins
    allowed_origins = get_allowed_origins_legacy()
  File "/usr/bin/unattended-upgrades", line 326, in get_allowed_origins_legacy
    (distro_id, distro_codename) = s.split()
ValueError: not enough values to unpack (expected 2, got 1)

Revision history for this message
Aex Rauch (centaurie) wrote :

I run sudo dpkg-reconfigure -plow unattended-upgrades.

I'm not sure if relevant.

http://www.directupload.net/file/d/4721/m66f7gh6_png.html

Really Debian?

Changed in unattended-upgrades (Ubuntu):
importance: Undecided → Low
status: Confirmed → Triaged
importance: Low → Medium
assignee: nobody → Brian Murray (brian-murray)
Revision history for this message
Brian Murray (brian-murray) wrote :

I've recreated this and submitted it to the Ubuntu Error Tracker and apparently I'm the only one who has.

https://errors.ubuntu.com/bucket/?id=/usr/bin/unattended-upgrade%3AValueError%3A/usr/bin/unattended-upgrade%401558%3Amain%3Aget_allowed_origins%3Aget_allowed_origins_legacy

Regardless, I'll get it fixed in the development release of Ubuntu.

Changed in unattended-upgrades (Ubuntu):
status: Triaged → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package unattended-upgrades - 0.93.1ubuntu6

---------------
unattended-upgrades (0.93.1ubuntu6) artful; urgency=medium

  * unattended-upgrades: Do not automatically upgrade the development release
    of Ubuntu unless Unattended-Upgrade::DevRelease is true. (LP: #1649709)

 -- Brian Murray <email address hidden> Wed, 17 May 2017 16:28:32 -0700

Changed in unattended-upgrades (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote :

There is an upstream pull request for this fix here:

https://github.com/mvo5/unattended-upgrades/pull/53

Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Dan, 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
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Hello Dan, 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.

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

Hello Dan, 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.

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

Tested with 1.1ubuntu1.18.04.7~16.04.2 on Xenial:

root@x-uu-lp-1260041:~# unattended-upgrade --dry-run --debug
Unable to parse Unattended-Upgrade::Allowed-Origins.
Traceback (most recent call last):
  File "/usr/bin/unattended-upgrade", line 1998, in <module>
    sys.exit(main(options))
  File "/usr/bin/unattended-upgrade", line 1565, in main
    allowed_origins = get_allowed_origins()
  File "/usr/bin/unattended-upgrade", line 475, in get_allowed_origins
    allowed_origins = get_allowed_origins_legacy()
  File "/usr/bin/unattended-upgrade", line 454, in get_allowed_origins_legacy
    (distro_id, distro_codename) = s.split()
ValueError: not enough values to unpack (expected 2, got 1)
root@x-uu-lp-1260041:~# cat /var/log/unattended-upgrades/unattended-upgrades.log
2019-03-13 17:23:53,035 ERROR Unable to parse Unattended-Upgrade::Allowed-Origins.
root@x-uu-lp-1260041:~# dpkg -l unattended-upgrades | cat
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 Architecture Description
+++-===================-==========================-============-===========================================
ii unattended-upgrades 1.1ubuntu1.18.04.7~16.04.2 all automatic installation of security upgrades

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.