/usr/bin/unattended-upgrade:FileNotFoundError:/usr/bin/unattended-upgrade@1468:main:write_stamp_file

Bug #1639977 reported by errors.ubuntu.com bug bridge
30
This bug affects 3 people
Affects Status Importance Assigned to Milestone
unattended-upgrades (Ubuntu)
Fix Released
High
Brian Murray
Xenial
Fix Released
High
Brian Murray
Yakkety
Fix Released
High
Brian Murray

Bug Description

Test Case
---------
1) edit /etc/apt/apt.conf.d/20auto-upgrades so that Update-Package-Lists is 1 and Unattended-Upgrade is 1
2) sudo apt-get update
3) sudo rm -fr /var/lib/apt/periodic
4) sudo /usr/bin/unattended-upgrade
5) observe the following Traceback

Traceback (most recent call last):
  File "/usr/bin/unattended-upgrade", line 1468, in <module>
    main(options)
  File "/usr/bin/unattended-upgrade", line 1419, in main
    write_stamp_file()
  File "/usr/bin/unattended-upgrade", line 1011, in write_stamp_file
    with open(os.path.join(statedir, "unattended-upgrades-stamp"), "w"):
FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/apt/periodic/unattended-upgrades-stamp'

With the version of the package from -proposed you'll receive no such Traceback.

Regression Potential
--------------------
This patch just ends up creating a directory if it does not exist. Potential regressions would be a result of the patch being typo'ed e.g. typo'ing os.path.exits instead of os.path.exists and the code failing when a statedir does exist. So read the patch carefully!

Original description
--------------------
The Ubuntu Error Tracker has been receiving reports about a problem regarding unattended-upgrades. This problem was most recently seen with package version 0.90ubuntu0.1, the problem page at https://errors.ubuntu.com/problem/4f4644d58ccc3231b270311abe8fec67b6c7ca36 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 you can request it at http://forms.canonical.com/reports/.

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

Here's the Traceback:

Traceback (most recent call last):
  File "/usr/bin/unattended-upgrade", line 1468, in <module>
    main(options)
  File "/usr/bin/unattended-upgrade", line 1331, in main
    write_stamp_file()
  File "/usr/bin/unattended-upgrade", line 1011, in write_stamp_file
    with open(os.path.join(statedir, "unattended-upgrades-stamp"), "w"):
FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/apt/periodic/unattended-upgrades-stamp'

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

This bug was fixed in the package unattended-upgrades - 0.92ubuntu3

---------------
unattended-upgrades (0.92ubuntu3) zesty; urgency=medium

  * Create the directory /var/lib/apt/periodic/, if it does not exist, so that
    we don't receive a Traceback when trying to write a stampfile there.
    (LP: #1639977)

 -- Brian Murray <email address hidden> Mon, 07 Nov 2016 16:07:36 -0800

Changed in unattended-upgrades (Ubuntu):
status: New → Fix Released
Changed in unattended-upgrades (Ubuntu):
assignee: nobody → Brian Murray (brian-murray)
Changed in unattended-upgrades (Ubuntu Xenial):
status: New → Triaged
Changed in unattended-upgrades (Ubuntu Yakkety):
status: New → Triaged
Changed in unattended-upgrades (Ubuntu Xenial):
importance: Undecided → High
Changed in unattended-upgrades (Ubuntu Yakkety):
importance: Undecided → High
tags: added: yakkety
Changed in unattended-upgrades (Ubuntu Yakkety):
assignee: nobody → Brian Murray (brian-murray)
status: Triaged → In Progress
Changed in unattended-upgrades (Ubuntu Xenial):
assignee: nobody → Brian Murray (brian-murray)
status: Triaged → In Progress
Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

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

Accepted unattended-upgrades into yakkety-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/unattended-upgrades/0.92ubuntu1.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 to verification-done. If it does not fix the bug for you, please add a comment stating that, and 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!

Changed in unattended-upgrades (Ubuntu Yakkety):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Martin Pitt (pitti) 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/0.90ubuntu0.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 to verification-done. If it does not fix the bug for you, please add a comment stating that, and 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!

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

Verification passed in Xenial:

After this operation, 0 B of additional disk space will be used.
Get:1 http://192.168.10.7/ubuntu xenial-proposed/main amd64 unattended-upgrades all 0.90ubuntu0.2 [31.7 kB]
Fetched 31.7 kB in 0s (0 B/s)
Preconfiguring packages ...
(Reading database ... 245059 files and directories currently installed.)
Preparing to unpack .../unattended-upgrades_0.90ubuntu0.2_all.deb ...
Unpacking unattended-upgrades (0.90ubuntu0.2) over (0.90) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for systemd (229-4ubuntu10) ...
Processing triggers for ureadahead (0.100.0-19) ...
Setting up unattended-upgrades (0.90ubuntu0.2) ...
Replacing config file /etc/apt/apt.conf.d/50unattended-upgrades with new version
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
bdmurray@clean-xenial-amd64:~$ sudo /usr/bin/unattended-upgrade

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

Verily verified for Yakkety.

Preparing to unpack .../unattended-upgrades_0.92ubuntu1.1_all.deb ...
Unpacking unattended-upgrades (0.92ubuntu1.1) over (0.92ubuntu1) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (231-9git1) ...
Setting up unattended-upgrades (0.92ubuntu1.1) ...
Replacing config file /etc/apt/apt.conf.d/50unattended-upgrades with new version
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
Processing triggers for man-db (2.7.5-1) ...
bdmurray@clean-yakkety-amd64:~$ ls /var/lib/apt/periodic/unattended-upgrades-stamp
ls: cannot access '/var/lib/apt/periodic/unattended-upgrades-stamp': No such file or directory
bdmurray@clean-yakkety-amd64:~$ sudo /usr/bin/unattended-upgrade
bdmurray@clean-yakkety-amd64:~$ ls /var/lib/apt/periodic/unattended-upgrades-stamp
/var/lib/apt/periodic/unattended-upgrades-stamp

tags: added: verification-done-yakkety
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package unattended-upgrades - 0.90ubuntu0.2

---------------
unattended-upgrades (0.90ubuntu0.2) xenial-proposed; urgency=medium

  * Create logfile_dpkg if it does not exist so that the file can be read
    later, thereby preventing a FileNotFound crash. (LP: #1590321)
  * Create the directory /var/lib/apt/periodic/, if it does not exist, so that
    we don't receive a Traceback when trying to write a stampfile there.
    (LP: #1639977)

 -- Brian Murray <email address hidden> Mon, 07 Nov 2016 14:38:04 -0800

Changed in unattended-upgrades (Ubuntu Xenial):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) 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.

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

This bug was fixed in the package unattended-upgrades - 0.92ubuntu1.1

---------------
unattended-upgrades (0.92ubuntu1.1) yakkety; urgency=medium

  * Modify data/50unattended-upgrades.Ubuntu such that the release pocket is
    an allowed origin so that security updates with a new dependency will be
    upgraded and the new dependency will be installed. (LP: #1624641)
  * Create logfile_dpkg if it does not exist so that the file can be read
    later, thereby preventing a FileNotFound crash. (LP: #1590321)
  * Create the directory /var/lib/apt/periodic/, if it does not exist, so that
    we don't receive a Traceback when trying to write a stampfile there.
    (LP: #1639977)

 -- Brian Murray <email address hidden> Mon, 07 Nov 2016 12:41:10 -0800

Changed in unattended-upgrades (Ubuntu Yakkety):
status: Fix Committed → Fix Released
Mathew Hodson (mhodson)
Changed in unattended-upgrades (Ubuntu):
importance: Undecided → High
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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