cloud-final.service does not run due to dependency cycle
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Fix Released
|
Undecided
|
Unassigned | ||
cloud-init (Ubuntu) |
Fix Released
|
High
|
Unassigned | ||
Xenial |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
==== Begin SRU Template ====
[Impact]
As part of the change in bug 1576692, we made cloud-final.target
run After multi-user.target. That created a dependency loop between
cloud-init.target and multi-user.target and cloud-final.target.
Most of the time systemd would break that loop by dropping
cloud-init.target. But sometimes, it would break the loop by dropping
cloud-final.target, which would mean that user scripts do not run
and generally cloud-init doesn't finish.
[Test Case]
## Failure in a xenial image can only be reproduced by
## patching an image up to the previous xenial-proposed upload
## (0.7.7-
## and then restarting. We will focus on verifying there is not
## a problem.
## Launch an instance and patch it up to xenial-proposed
$ release=xenial
$ name=x1
$ lxc launch ubuntu-
# wait for it to boot
$ while ! lxc exec $name -- [ -e /run/cloud-
## Now update container, clean and reboot to show first boot
$ lxc exec $name -- sh -c '
p=/
echo deb http://
apt-get update -q && apt-get -qy install cloud-init'
$ lxc exec $name -- sh -c '
cd /var/lib/cloud && for d in *; do [ "$d" = "seed" ] || rm -Rf "$d"; done
rm -Rf /var/log/
## This is like first boot now.
$ lxc exec $name reboot
$ while ! lxc exec $name -- [ -e /run/cloud-
## The services should show active
$ lxc exec $name -- journalctl | grep Break || echo Good, no breaks
$ lxc exec $name -- systemctl --no-pager status cloud-final.service
$ lxc exec $name -- systemctl --no-pager status cloud-init.target
[Regression Potential]
Playing with boot order can cause problems. Regression would be around
some targets not running. On a booted system this would show itself inx
journalctl | grep -i Break
or
journalctl | grep -i ordering
==== End SRU Template ====
With current yakkety cloud images (at least in Scalingstack), I often run into this dependency cycle at boot:
Sep 15 09:28:51 ubuntu systemd[1]: cloud-init.target: Found ordering cycle on cloud-init.
Sep 15 09:28:51 ubuntu systemd[1]: cloud-init.target: Found dependency on cloud-final.
Sep 15 09:28:51 ubuntu systemd[1]: cloud-init.target: Found dependency on multi-user.
Sep 15 09:28:51 ubuntu systemd[1]: cloud-init.target: Found dependency on cloud-init.
Sep 15 09:28:51 ubuntu systemd[1]: cloud-init.target: Breaking ordering cycle by deleting job cloud-final.
Sep 15 09:28:51 ubuntu systemd[1]: cloud-final.
● cloud-final.service - Execute cloud user/final scripts
Loaded: loaded (/lib/systemd/
Active: inactive (dead)
Thus /var/lib/
This is with the most recent https:/
Related bugs:
* bug 1576692: fully support package installation in systemd
tags: | added: regression-release yakkety |
Changed in cloud-init (Ubuntu): | |
importance: | Undecided → High |
description: | updated |
description: | updated |
Most of the time (at least in LXD, timing issue) cloud-init.target is inactive instead, which is also unintended. This is because it is installed into multi-user.target and thus gets an implied Before= multi-user. target as well. With explicitly adding After=multi- user.target (since one part of it, cloud-final. service, runs after it) all units start and I cannot reproduce the cycle any more.