This bug was fixed in the package cloud-init -
0.7.8-1-g3705bb5-0ubuntu1~16.04.3

---------------
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 <smo...@ubuntu.com>  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 नेपाली
भाषा समायोजकहरुको समूह, which is subscribed to Xenial.
Matching subscriptions: Ubuntu 16.04 Bugs
https://bugs.launchpad.net/bugs/1628337

Title:
  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 ==
  [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://us.archive.ubuntu.com/ubuntu/
  END

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

  # 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 http://bogus.example.com/ubuntu/ $release main restricted universe
  EOF

  $ lxc start $name

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

  $ lxc file pull $name/var/log/cloud-init-output.log - | egrep "^[EW]:"
  W: Failed to fetch http://bogus.example.com/ubuntu/dists/xenial/InRelease  
Could not resolve 'bogus.example.com'
  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/apt/sources.list <<EOF
  deb http://bogus.example.com/ubuntu/ $release main restricted universe
  EOF

  ## Now update container, clean and reboot to show first boot
  $ lxc exec $name -- sh -c '
      p=/etc/apt/sources.list.d/proposed.list
      echo deb http://archive.ubuntu.com/ubuntu 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
  /etc/apt/sources.list.

  In a closed MAAS environment where MAAS is limited to access to
  us.archive.ubuntu.com , cloud-init is trying to access to
  archive.ubuntu.com.

  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/sources.list with us.archive.ubuntu.com
  4. cloud-init installs other packages.

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

_______________________________________________
Mailing list: https://launchpad.net/~group.of.nepali.translators
Post to     : group.of.nepali.translators@lists.launchpad.net
Unsubscribe : https://launchpad.net/~group.of.nepali.translators
More help   : https://help.launchpad.net/ListHelp

Reply via email to