This bug was fixed in the package cloud-init -

cloud-init (0.7.8-1-g3705bb5-0ubuntu1~16.04.3) xenial-proposed; urgency=medium

  * ntp: move to run after apt configuration (LP: #1628337).

cloud-init (0.7.8-1-g3705bb5-0ubuntu1~16.04.2) xenial; urgency=medium

  * Support IPv6 config coming from initramfs.  LP: #1621615.

 -- Scott Moser <>  Mon, 03 Oct 2016 12:22:26 -0400

** Changed in: cloud-init (Ubuntu Xenial)
       Status: Fix Committed => Fix Released

You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.

  cloud-init tries to install NTP before even configuring the archives

Status in cloud-init:
  Fix Committed
Status in cloud-init package in Ubuntu:
  Fix Released
Status in cloud-init source package in Xenial:
  Fix Released

Bug description:
  == Begin SRU Template ==
  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
    servers: ['']

      - arches: [default]

  $ release=xenial
  $ name=x1
  $ lxc init ubuntu-daily:$release $name "--config=user.user-data=$(cat 

  # simulate a mirror that can't be reached by changing
  # /etc/apt/sources.list to have a bogus mirror.
  # what should happen is that cloud-init should apply apt config changes
  # and render /etc/apt/sources.list from /etc/cloud/templates/
  # 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/apt/sources.list <<EOF
  deb $release main restricted universe

  $ lxc start $name

  # wait for it to boot
  $ while ! lxc exec $name -- [ -e /run/cloud-init/result.json ]; do sleep 1; 

  $ lxc file pull $name/var/log/cloud-init-output.log - | egrep "^[EW]:"
  W: Failed to fetch  
Could not resolve ''
  W: Some index files failed to download. They have been ignored, or old ones 
used instead.
  E: Unable to locate package ntp

  ## The fix can be shown applied by subsequently
  # push the broken sources.list back into image.

  $ lxc file push - $name/etc/apt/sources.list <<EOF
  deb $release main restricted universe

  ## Now update container, clean and reboot to show first boot
  $ lxc exec $name -- sh -c '
      echo deb xenial-proposed main > "$p" &&
      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/cloud-init*'

  $ lxc file pull $name/var/log/cloud-init-output.log - | egrep "^[EW]:" ||
        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

  In a closed MAAS environment where MAAS is limited to access to , cloud-init is trying to access to

  In commissioning, however, cloud-init is doing this:

  1. cloud-init gets metadata from MAAS
  2. cloud-init tries to install NTP from
  3. cloud-init configures /etc/apt/sources.list with
  4. cloud-init installs other packages.

To manage notifications about this bug go to:

Mailing list:
Post to     :
Unsubscribe :
More help   :

Reply via email to