[Bug 1711428] Re: cloud-init sometimes fails on dpkg lock due to concurrent apt-daily-upgrade.service execution
Julian Andres Klode
julian.klode at gmail.com
Thu Aug 17 19:33:05 UTC 2017
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
Foundations Bugs, which is subscribed to apt in Ubuntu.
https://bugs.launchpad.net/bugs/1711428
Title:
cloud-init sometimes fails on dpkg lock due to concurrent apt-daily-
upgrade.service execution
Status in cloud-init:
Incomplete
Status in apt package in Ubuntu:
Incomplete
Bug description:
This is the same problem as https://bugs.launchpad.net/cloud-
init/+bug/1693361, but with a different APT invoking service. In this
case it is apt-daily-upgrade.service.
So, I guess add apt-daily-upgrade.service to the Before line in
/lib/systemd/system/cloud-final.service along side apt-daily.service.
Or wait for an APT fix. Or retry APT commands when executing
"packages:"
Reporting this to save someone else trouble, but I think we'll be
rolling back to Trusty at this point. Hopefully the B LTS will have
an alternative to systemd.
To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1711428/+subscriptions
More information about the foundations-bugs
mailing list