Hello,
I looked deeper into this, I feel the issue may be with
apt_pkg.get_lock's return value now. It seems the code considers 0
success whereas now an FD is returned which seems to mean it's fine.
# Example logging output
2019-09-06 10:54:31,249 WARNING - SIGTERM or SIGHUP received, stopping
unattended-upgradesonly if it is running
2019-09-06 10:54:31,250 DEBUG - Starting countdown of 25.0 minutes
2019-09-06 10:54:31,250 DEBUG - get_lock returned 7
2019-09-06 10:54:31,250 DEBUG - lock not taken
# Tracing manually
/usr/share/unattended-upgrades/unattended-upgrade-shutdown:
L230> 2019-09-06 10:54:31,249 WARNING - SIGTERM or SIGHUP received, stopping
unattended-upgradesonly if it is running
* Bug - add space to end (i.e. "SIGTERM or SIGHUP received, stopping
unattended-upgrades ")
L318> 2019-09-06 10:54:31,250 DEBUG - Starting countdown of 25.0 minutes
L333> 2019-09-06 10:54:31,250 DEBUG - get_lock returned 7
* Bug - The lock should be acquired so it should be 0 ... according to code
but docs say it's fine
L332> res = apt_pkg.get_lock(self.options.lock_file)
L333> logging.debug("get_lock returned %i" % res) # <-- This is where I
believe there's the bug
L334> # exit here if there is no lock
L335> if res > 0:
L336> logging.debug("lock not taken")
L337> if self.lock_was_taken:
L338> exit_log_result(self.signal_sent)
L339> else:
L340> sys.exit(0)
L341> self.lock_was_taken = True
L342> signal_stop_unattended_upgrade()
L343> self.signal_sent = True
L344> # show log
L345> log_progress()
L346> return True
* Looking deeper into get_lock it shows that a file descriptor is returned
vs -1 or an error raised. I believe the code may need to be updated as
running python3 interactively, importing apt_pkg and printing its
__doc__ shows the following. This is Sparta err python 3... so perhaps
that's the reason.
>>> print(apt_pkg.get_lock.__doc__)
get_lock(file: str, errors: bool) -> int
Create an empty file of the given name and lock it. If the locking
succeeds, return the file descriptor of the lock file. Afterwards,
locking the file from another process will fail and thus cause
get_lock() to return -1 or raise an Error (if 'errors' is True).
>From Python 2.6 on, it is recommended to use the context manager
provided by apt_pkg.FileLock instead using the with-statement.
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1843099
Title:
Unattended upgrades does not work on shutdown
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/unattended-upgrades/+bug/1843099/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs