cloud-init tries to install NTP before even configuring the archives
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Fix Released
|
Medium
|
Scott Moser | ||
cloud-init (Ubuntu) |
Fix Released
|
Critical
|
Unassigned | ||
Xenial |
Fix Released
|
Critical
|
Unassigned |
Bug Description
== Begin SRU Template ==
[Impact]
When told to configure ntp, and the ntp package is not installed
in an image, cloud-init will attempt to install the package.
The problem here is that it currently tries to install the package before
it configures apt. As a result, no apt proxy or mirror configuration is
setup, and the stock image apt config is used.
[Test Case]
## Failure can be shown like this:
$ cat > user-data <<END
#cloud-config
ntp:
servers: ['ntp.ubuntu.com']
apt:
primary:
- arches: [default]
uri: http://
END
$ release=xenial
$ name=x1
$ lxc init ubuntu-
# simulate a mirror that can't be reached by changing
# /etc/apt/
# what should happen is that cloud-init should apply apt config changes
# and render /etc/apt/
# and do the mirror substitution first.
#
# The bug is that cloud-init does not render apply the apt
# config before ntp runs and requests the package installation.
$ lxc file push - $name/etc/
deb http://
EOF
$ lxc start $name
# wait for it to boot
$ while ! lxc exec $name -- [ -e /run/cloud-
$ lxc file pull $name/var/
W: Failed to fetch http://
W: Some index files failed to download. They have been ignored, or old ones used instead.
E: Unable to locate package ntp
EOF
## The fix can be shown applied by subsequently
# push the broken sources.list back into image.
$ lxc file push - $name/etc/
deb http://
EOF
## 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/
$ lxc file pull $name/var/
echo "FIX WORKED."
[Regression Potential]
The 'ntp' function is fairly new, and is only used if a user specifies
an ntp configuration as shown above. Regression chance is low then
and should be restricted to scenarios where users are providing
the ntp configuration.
== End SRU Template ==
cloud-init tries to install NTP package before it actually configures /etc/apt/
In a closed MAAS environment where MAAS is limited to access to us.archive.
In commissioning, however, cloud-init is doing this:
1. cloud-init gets metadata from MAAS
2. cloud-init tries to install NTP from archive.ubuntu.com
3. cloud-init configures /etc/apt/
4. cloud-init installs other packages.
Related branches
- Ryan Harper: Approve
-
Diff: 19 lines (+1/-1)1 file modifiedconfig/cloud.cfg (+1/-1)
Changed in cloud-init: | |
status: | New → Confirmed |
importance: | Undecided → Medium |
Changed in cloud-init (Ubuntu): | |
status: | New → Confirmed |
importance: | Undecided → Medium |
Changed in cloud-init (Ubuntu): | |
importance: | Medium → Critical |
Changed in cloud-init: | |
assignee: | nobody → Scott Moser (smoser) |
status: | Confirmed → Fix Committed |
Changed in cloud-init (Ubuntu Xenial): | |
importance: | Undecided → Critical |
Changed in cloud-init (Ubuntu Xenial): | |
status: | New → In Progress |
description: | updated |
description: | updated |
fwiw, this is really critical for us. Is causing all of our CI runs to fail.