I have narrowed down. This bug was introduced by the fix in #1618900.
That tries to fix the problem of the the unattended-upgrades.service
by letting it depend on network.target and local-fs.target.
However, that doesn't change any of the dependencies, it only makes
the race window larger.
After some experiments, the correct dependencies in the unit file appear
Which make it behave just like the SysV init script.
This change together with the patch I attached to this bug report
together should fix the issue and also fix #1618900 .
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to unattended-upgrades in
unattended-upgrade-shutdown hangs when /var is a separate filesystem
Status in unattended-upgrades package in Ubuntu:
The systemd unit file unattended-upgrades.service is used to stop a running
process during shutdown. This unit file is running together with all
The unattended-upgrades service checks if the lockfile for unattended-upgrade
(in /var/run) exists, and if it does, there is an unattended-upgrade in
and the service will wait until it finishes (and therefore automatically wait
However, if /var is a separate filesystem, it will get unmounted even though
is a tmpfs that's still mounted on top of the /var/run directory in the /var
The unattended-upgrade script will fail to find lockfile, sleeps for 5
tries to check the lockfile again. After 10 minutes (the default timeout), it
exit and the system will continue shutdown.
The problem is the error handling in
where it tries to lock itself:
res = apt_pkg.get_lock(options.lock_file)
logging.debug("get_lock returned %i" % res)
# exit here if there is no lock
if res > 0:
logging.debug("lock not taken")
lock_was_taken = True
The function apt_pkg.get_lock() either returns a file descriptor, or -1 on an
File descriptors are just C file descriptors, so they are always positive
The code should check the result to be negative, not positive. I have
attached a patch
to reverse the logic.
Description: Ubuntu 16.04.1 LTS
*** 0.90ubuntu0.3 500
500 http://nl.archive.ubuntu.com/ubuntu xenial-updates/main amd64
500 http://nl.archive.ubuntu.com/ubuntu xenial-updates/main i386
500 http://nl.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
500 http://nl.archive.ubuntu.com/ubuntu xenial/main i386 Packages
Very slow reboot (after a 10 minutes timeout)
To manage notifications about this bug go to:
Mailing list: https://launchpad.net/~touch-packages
Post to : firstname.lastname@example.org
Unsubscribe : https://launchpad.net/~touch-packages
More help : https://help.launchpad.net/ListHelp