cloud-init (18.2) fails on decoding proc1 env
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Fix Released
|
Medium
|
Unassigned |
Bug Description
cloud-init-18.2 on an openSUSE-15 (python 3.6) kiwi image fails with this:
failed run of stage init-local
-------
Traceback (most recent call last):
File "/usr/lib/
ret = functor(name, args)
File "/usr/lib/
network=not args.local)]
File "/usr/lib/
cmdline = util.get_cmdline()
File "/usr/lib/
if is_container():
File "/usr/lib/
pid1env = get_proc_env(1)
File "/usr/lib/
contents = load_file(fn)
File "/usr/lib/
return decode_
File "/usr/lib/
return blob.decode(
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 3432: invalid start byte
-------
This is from reading /proc/1/environ
hexdump around the relvant offset (3432 = 0x0d68) shows me:
00000d50 32 61 32 32 37 37 30 34 66 00 42 4f 4f 54 41 42 |2a227704f.BOOTAB|
00000d60 4c 45 5f 46 4c 41 47 3d 80 00 69 6e 69 74 3d 2f |LE_FLAG=..init=/|
So there we go: BOOTABLE_FLAG=\x80 does not decode to utf-8 ...
Related branches
- Server Team CI bot: Approve (continuous-integration)
- Scott Moser: Pending requested
-
Diff: 1562 lines (+711/-94)26 files modifiedcloudinit/config/cc_lxd.py (+56/-8)
cloudinit/net/eni.py (+17/-3)
cloudinit/net/netplan.py (+14/-8)
cloudinit/net/sysconfig.py (+7/-0)
cloudinit/sources/DataSourceOpenStack.py (+23/-0)
cloudinit/stages.py (+3/-1)
cloudinit/user_data.py (+13/-9)
cloudinit/util.py (+90/-21)
debian/changelog (+25/-0)
doc/rtd/topics/datasources/openstack.rst (+15/-0)
doc/rtd/topics/network-config-format-v1.rst (+27/-0)
doc/rtd/topics/network-config-format-v2.rst (+6/-0)
doc/rtd/topics/tests.rst (+6/-1)
integration-requirements.txt (+1/-1)
tests/cloud_tests/args.py (+3/-0)
tests/cloud_tests/collect.py (+2/-1)
tests/cloud_tests/stage.py (+12/-3)
tests/cloud_tests/testcases/modules/ntp_chrony.py (+12/-1)
tests/cloud_tests/testcases/modules/salt_minion.yaml (+12/-2)
tests/cloud_tests/verify.py (+46/-1)
tests/unittests/test_data.py (+10/-1)
tests/unittests/test_datasource/test_openstack.py (+110/-14)
tests/unittests/test_handler/test_handler_lxd.py (+64/-16)
tests/unittests/test_net.py (+20/-1)
tests/unittests/test_runs/test_simple_run.py (+30/-2)
tests/unittests/test_util.py (+87/-0)
- Ryan Harper: Approve
- Server Team CI bot: Approve (continuous-integration)
-
Diff: 116 lines (+78/-13)2 files modifiedcloudinit/util.py (+22/-13)
tests/unittests/test_util.py (+56/-0)
Here's a patch that adds exception handling.
I guess there is no reason that would guarantee that the environment vars from process 1 (systemd/init) is UTF-8. so we need to handle whatever we see.
The good news is that detecting that we are in a container or not does not depend on correctly decoded strings ... we really only need to make sure that we don't error out.