This logic is correct. apt_pkg.get_lock(options.lock_file) is trying to acquire a lockfile (/var/run/unattended-upgrades.lock) which is only possible if no unattended-upgrade is already running. If it can acquire the lock, it means that NO unattended-upgrade is running, hence shutdown may proceed.
while True:
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")
break lock_was_taken = True
The problem is that apt_pkg.get_lock(options.lock_file) will also return -1 if the path to the lock file doesn't exist, which is the case when /var is unmounted, hence /var/run is no longer present (/var/run is a symlink to /run).
I'm working on identifying the proper systemd order to make sure that /var/run is still accessible.
Hello,
This logic is correct. apt_pkg. get_lock( options. lock_file) is trying to acquire a lockfile (/var/run/ unattended- upgrades. lock) which is only possible if no unattended-upgrade is already running. If it can acquire the lock, it means that NO unattended-upgrade is running, hence shutdown may proceed.
while True: get_lock( options. lock_file)
logging. debug(" get_lock returned %i" % res)
logging. debug(" lock not taken")
lock_was_ taken = True
res = apt_pkg.
# exit here if there is no lock
if res > 0:
break
The problem is that apt_pkg. get_lock( options. lock_file) will also return -1 if the path to the lock file doesn't exist, which is the case when /var is unmounted, hence /var/run is no longer present (/var/run is a symlink to /run).
I'm working on identifying the proper systemd order to make sure that /var/run is still accessible.