cloud-init no longer processes user data on GCE in artful
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Fix Released
|
High
|
Scott Moser | ||
cloud-init (Ubuntu) |
Fix Released
|
High
|
Scott Moser | ||
Xenial |
Fix Released
|
Critical
|
Chad Smith | ||
Artful |
Fix Released
|
Critical
|
Chad Smith | ||
Bionic |
Fix Released
|
High
|
Scott Moser |
Bug Description
=== Begin SRU Template ===
[Impact]
Any user-data provided when creating google cloud instances is ignored so no instance customization is observed. This is a silent failure and no tracebacks in cloud-init represent that failure to the user.
Providing a simple cloud-config to set a hostname will provide a quick validation of cloud-init observing user-data.
[Test Case]
# Create cloud-config which should change the hostname, and cli prompt
$ cat > sethostname.yaml <<EOF
#cloud-config
hostname: SRU-worked
EOF
# Deploy on GCE
$ gcloud compute instances create artful-sru-test --zone=
$ gcloud compute ssh artful-sru-test
# Expect default hostname "artful-sru-test" instead of "SRU-worked"
# Look for failure symptom: populated instance-data but user-data: null
artful-sru-test:~# sudo grep user-data /run/cloud/
"instance-data": "{\"user-
"user-data": null,
# Upgrade cloud-init
# add proposed
rel=$(lsb_release -sc);
line=$(awk '$1 == "deb" && $2 ~ /ubuntu.com/ {
printf("%s %s %s-proposed main universe\n", $1, $2, rel); exit(0) };
' "rel=$rel" /etc/apt/
echo "$line" | sudo tee /etc/apt/
sudo apt-get update -q;
sudo apt-get install cloud-init;
# Reboot 'clean' allowing new cloud-init to run against a fresh system
sudo cloud-init clean --reboot --logs
$ gcloud compute ssh artful-sru-test
# Expect to see proper hostname
SRU-worked:~# sudo cloud-init status --long;
# Validate user-data: non-null
SRU-worked:~# sudo grep user-data /run/cloud-
artful-sru-test:~# sudo grep user-data /run/cloud-
"instance-data": "{\"user-
"user-data": "I2Nsb3VkLWNvbm
[Other Info]
Upstream commit at
https:/
=== End SRU Template ===
=== Begin Original Description ===
If I pass in user data like so:
$ cat cfg
#!/bin/sh
touch /tmp/foobar
$ gcloud compute instances create aa-$(date +%y%m%d-%H%M) --image-family ubuntu-1710 --image-project ubuntu-
...
Then in the instance:
$ ls /tmp/foobar
$ sudo cat /var/lib/
$ curl "http://
#/bin/sh
touch /tmp/foobar
Related branches
- Server Team CI bot: Approve (continuous-integration)
- Scott Moser: Pending requested
-
Diff: 118 lines (+96/-0)3 files modifieddebian/changelog (+7/-0)
debian/patches/cpick-40e7738-GCE-fix-reading-of-user-data-that-is-not-base64-encoded (+88/-0)
debian/patches/series (+1/-0)
- Server Team CI bot: Approve (continuous-integration)
- Scott Moser: Pending requested
-
Diff: 116 lines (+96/-0)3 files modifieddebian/changelog (+7/-0)
debian/patches/cpick-40e7738-GCE-fix-reading-of-user-data-that-is-not-base64-encoded (+88/-0)
debian/patches/series (+1/-0)
- Server Team CI bot: Approve (continuous-integration)
- Scott Moser: Pending requested
-
Diff: 371 lines (+141/-27)10 files modifiedcloudinit/config/cc_puppet.py (+40/-14)
cloudinit/config/cc_salt_minion.py (+9/-0)
cloudinit/sources/DataSourceGCE.py (+7/-8)
cloudinit/util.py (+7/-2)
debian/changelog (+13/-0)
doc/examples/cloud-config-chef.txt (+2/-2)
tests/cloud_tests/testcases/modules/salt_minion.py (+5/-0)
tests/cloud_tests/testcases/modules/salt_minion.yaml (+5/-0)
tests/unittests/test_datasource/test_gce.py (+19/-1)
tests/unittests/test_util.py (+34/-0)
- Chad Smith: Approve
- Server Team CI bot: Approve (continuous-integration)
-
Diff: 70 lines (+26/-9)2 files modifiedcloudinit/sources/DataSourceGCE.py (+7/-8)
tests/unittests/test_datasource/test_gce.py (+19/-1)
description: | updated |
Changed in cloud-init: | |
status: | New → Confirmed |
importance: | Undecided → High |
Changed in cloud-init (Ubuntu): | |
status: | New → Confirmed |
importance: | Undecided → High |
Changed in cloud-init (Ubuntu Xenial): | |
status: | New → Confirmed |
Changed in cloud-init (Ubuntu Artful): | |
status: | New → Confirmed |
Changed in cloud-init (Ubuntu Xenial): | |
importance: | Undecided → Critical |
Changed in cloud-init (Ubuntu Artful): | |
importance: | Undecided → Critical |
Changed in cloud-init: | |
status: | Confirmed → Fix Committed |
description: | updated |
description: | updated |
description: | updated |
Note that /tmp and /var/tmp (and possibly others) are not safe during boot:
https:/ /www.freedeskto p.org/software/ systemd/ man/systemd- tmpfiles. html
Can you reproduce with a touch to a non-tmp path ?