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:                                                                    
                                
        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.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1654600

Title:
  unattended-upgrade-shutdown hangs when /var is a separate filesystem

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/unattended-upgrades/+bug/1654600/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to