I have resolved this problem.

The base issue was caused because I am using a local apt mirror and I
did not have the deb-src packages available on my mirror. When the ntp
state runs, it does an apt-get update that processes the entire list of
deb and deb-src package sources and if it cannot access one of them,
apt-get will print error messages and return code 100.

The end of the apt-get update showed this, which is the stderr output
from apt-get:

E: Failed to fetch 
http://apt.example.com/ubuntu/dists/xenial-backports/main/source/Sources  404  
Not Found
E: Failed to fetch 
http://apt.example.com/ubuntu/dists/xenial/main/source/Sources  404  Not Found
E: Failed to fetch 
http://apt.example.com/ubuntu/dists/xenial-updates/main/source/Sources  404  
Not Found
E: Failed to fetch 
http://apt.example.com/ubuntu/dists/xenial-security/main/source/Sources  404  
Not Found
E: Some index files failed to download. They have been ignored, or old ones 
used instead.

And following that in the cloud-init.log was the python traceback:

Nov 18 22:08:44 rig9 [CLOUDINIT] util.py[DEBUG]: Running module ntp
(<module 'cloudinit.config.cc_ntp' from '/usr/lib/python3/dist-
packages/cloudinit/config/cc_ntp.py'>) failed#012Traceback (most recent
call last):#012  File "/usr/lib/python3/dist-
packages/cloudinit/stages.py", line 785, in _run_modules#012
freq=freq)#012  File "/usr/lib/python3/dist-
packages/cloudinit/cloud.py", line 70, in run#012    return
self._runners.run(name, functor, args, freq, clear_on_fail)#012  File
"/usr/lib/python3/dist-packages/cloudinit/helpers.py", line 199, in
run#012    results = functor(*args)#012  File "/usr/lib/python3/dist-
packages/cloudinit/config/cc_ntp.py", line 58, in handle#012
check_exe="ntpd")#012  File "/usr/lib/python3/dist-
packages/cloudinit/config/cc_ntp.py", line 69, in install_ntp#012
install_func(packages)#012  File "/usr/lib/python3/dist-
packages/cloudinit/distros/debian.py", line 87, in install_packages#012
self.update_package_sources()#012  File "/usr/lib/python3/dist-
packages/cloudinit/distros/debian.py", line 189, in
update_package_sources#012    ["update"], freq=PER_INSTANCE)#012  File
"/usr/lib/python3/dist-packages/cloudinit/helpers.py", line 199, in
run#012    results = functor(*args)#012  File "/usr/lib/python3/dist-
packages/cloudinit/distros/debian.py", line 185, in package_command#012
args=(cmd,), kwargs={'env': e, 'capture': False})#012  File
"/usr/lib/python3/dist-packages/cloudinit/util.py", line 2163, in
log_time#012    ret = func(*args, **kwargs)#012  File "/usr/lib/python3
/dist-packages/cloudinit/util.py", line 1832, in subp#012
cmd=args)#012cloudinit.util.ProcessExecutionError: Unexpected error
while running command.#012Command: ['eatmydata', 'apt-get', '--
option=Dpkg::Options::=--force-confold', '--option=Dpkg::options
::=--force-unsafe-io', '--assume-yes', '--quiet', 'update']#012Exit
code: 100#012Reason: -#012Stdout: ''#012Stderr: ''

Finally, the reason I was able to successfully run the ntp state
manually after cloud-init had finished was because the ntp state itself
works, and I was not sending a failure message to MAAS like the cloud-
init process does. Also, I didn't care that apt-get update couldn't find
the deb-src sources, because I knew they were irrelevant.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1643116

Title:
  16.04 image commissioning/installation failure due to config-ntp
  failure

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

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to