User-data scripts are not executing in Xenial Cloud Image

Bug #1577787 reported by György Szombathelyi
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
cloud-init (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

In the Xenial cloud image (xenial-server-cloudimg-amd64-disk1.img), scripts embedded into user-data don't run.
After installing python-minimal, and the python-pkg-resources package, it works, even it is a bash script.

Seems cloud-init requires /usr/bin/python and the python-pkg-resources package to run the user-data script.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in cloud-init (Ubuntu):
status: New → Confirmed
Revision history for this message
Scott Moser (smoser) wrote :

Hi,
cloud-init has no dependency on python. It is possible that your user-scripts do, but that is beyond the control of cloud-init. The ubuntu 16.04 cloud images do not have a python2 interpreter installed.

I put together a gist on how to run either python2 or python3 based on what is available at https://gist.github.com/smoser/8904199bb8f00a90dd04 that might be useful. The key point though, is that 16.04 images do not have python installed. If you need it, install python2 with apt.

Changed in cloud-init (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
György Szombathelyi (gyurco) wrote :

Even a
'''
#!/bin/bash

echo "hello world"
'''

doesn't run.
But will retest with recent images.

Revision history for this message
Scott Moser (smoser) wrote :

please set to 'New' if you still see this problem, and provide info on where you're running the image.
And if possible, after failure to boot collect /var/log/cloud-init.log and /var/log/cloud-init-output.log and console output if possible.

Revision history for this message
György Szombathelyi (gyurco) wrote :

Ok, seems the problem is that Heat with the CloudWatch user_data_format tries to inject a python script with user-data.

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for cloud-init (Ubuntu) because there has been no activity for 60 days.]

Changed in cloud-init (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.