Discussion:
Stretch AMI - user-data doesn't run, but cloud-init claims SUCCESS ?
Jim Freeman
2018-11-04 04:19:25 UTC
Permalink
2018-10-01 stretch AMI (no idea if this is a regression?)
/var/log/cloud-init.log claims user-data was run, when it fact it was not,
with tracebacks and log messages (attached) leading me to think that
failure is somehow getting mis-cast as success?

Any confirmations of other failures/successes of user-data would be
much appreciated ...

Many thanks,
...jfree
Noah Meyerhans
2018-11-04 16:43:42 UTC
Permalink
Post by Jim Freeman
2018-10-01 stretch AMI (no idea if this is a regression?)
/var/log/cloud-init.log claims user-data was run, when it fact it was not,
with tracebacks and log messages (attached) leading me to think that
failure is somehow getting mis-cast as success?
Any confirmations of other failures/successes of user-data would be
much appreciated ...
It seems that there are some invalid characters in your user-data
script. Cloud-init is printing a message at WARNING-level severity
indicating that it can't run the script, and the following stack trace
Post by Jim Freeman
2018-11-02 22:36:11,164 - util.py[WARNING]: Failed calling handler ShellScriptPartHandler: [['text/x-shellscript']] (text/x-shellscript, part-001, 2) with frequency once-per-instance
2018-11-02 22:36:11,170 - util.py[DEBUG]: Failed calling handler ShellScriptPartHandler: [['text/x-shellscript']] (text/x-shellscript, part-001, 2) with frequency once-per-instance
File "/usr/lib/python3/dist-packages/cloudinit/handlers/__init__.py", line 103, in run_part
payload, frequency)
File "/usr/lib/python3/dist-packages/cloudinit/handlers/shell_script.py", line 43, in handle_part
util.write_file(path, payload, 0o700)
File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 1747, in write_file
content = encode_text(content)
File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 154, in encode_text
return text.encode(encoding)
UnicodeEncodeError: 'utf-8' codec can't encode character '\udca9' in position 14: surrogates not allowed
What's in /var/log/cloud-init-output.log after this failure?
Jim Freeman
2018-11-05 02:36:37 UTC
Permalink
© !?!?

The script ran fine when I ran it manually post-boot - cloud-init choked on
it during the once-per-instance run.

#!/bin/bash
ᅩ# © 2018 by ...
^(position/character 14) This is the killer !? Changed to
'Copyright', and it finally ran on instance first-boot.

A user-data script with the same 2 first lines ran fine on an Amazon Linux
2 instance ...

A thousand thanks for your insights and help !
Post by Noah Meyerhans
Post by Jim Freeman
2018-10-01 stretch AMI (no idea if this is a regression?)
/var/log/cloud-init.log claims user-data was run, when it fact it was
not,
Post by Jim Freeman
with tracebacks and log messages (attached) leading me to think that
failure is somehow getting mis-cast as success?
Any confirmations of other failures/successes of user-data would be
much appreciated ...
It seems that there are some invalid characters in your user-data
script. Cloud-init is printing a message at WARNING-level severity
indicating that it can't run the script, and the following stack trace
Post by Jim Freeman
2018-11-02 22:36:11,164 - util.py[WARNING]: Failed calling handler
ShellScriptPartHandler: [['text/x-shellscript']] (text/x-shellscript,
part-001, 2) with frequency once-per-instance
Post by Jim Freeman
2018-11-02 22:36:11,170 - util.py[DEBUG]: Failed calling handler
ShellScriptPartHandler: [['text/x-shellscript']] (text/x-shellscript,
part-001, 2) with frequency once-per-instance
Post by Jim Freeman
File "/usr/lib/python3/dist-packages/cloudinit/handlers/__init__.py",
line 103, in run_part
Post by Jim Freeman
payload, frequency)
File
"/usr/lib/python3/dist-packages/cloudinit/handlers/shell_script.py", line
43, in handle_part
Post by Jim Freeman
util.write_file(path, payload, 0o700)
File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 1747, in
write_file
Post by Jim Freeman
content = encode_text(content)
File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 154, in
encode_text
Post by Jim Freeman
return text.encode(encoding)
UnicodeEncodeError: 'utf-8' codec can't encode character '\udca9' in
position 14: surrogates not allowed
What's in /var/log/cloud-init-output.log after this failure?
Loading...