Not that if B has After=A does not imply that the two don't run at the
same time. If B is already running, A will be started as well. That's
the reason why we added a lock file in apt:

if [ "$1" = "lock_is_held" ]; then
    shift
else
    # Maintain a lock on fd 3, so we can't run the script twice at the same
    # time.
    eval $(apt-config shell StateDir Dir::State/d)
    exec 3>${StateDir}/daily_lock
    if ! flock -w 3600 3; then
        echo "E: Could not acquire lock" >&2
        exit 1
    fi

    # We hold the lock.  Rerun this script as a child process, which
    # can run without propagating an extra fd to all of its children.
    "$0" lock_is_held "$@" 3>&-
    exit $?
fi

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

Title:
  cloud-init sometimes fails on dpkg lock due to concurrent apt-daily-
  upgrade.service execution

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1711428/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to