cloud-init runs again after reboot in release upgraded instance
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init (Ubuntu) |
Fix Released
|
Medium
|
Scott Moser | ||
Precise |
Fix Released
|
High
|
Unassigned |
Bug Description
=== Begin SRU Information ===
[Impact]
* If a user launches a 10.04 cloud-image with a user-data script, and then
does a upgrade to 12.04 and 'reboot's to complete the upgrade, the
user-data script will incorrectly execute again on boot.
This is because the cloud config module that executed user-data changed
names between 10.04 and 12.04 from 'user-scripts' to 'config-
but nothing was in place to adjust the "already ran" marker file
[Test Case]
* launch an instance with some user-data:
$ cat lp-1049146-
#!/bin/sh
echo "====== $(date -R) [$0] =====" | tee -a /root/user-data.log
$ ubuntu-ec2-run --key=your-keyname --instance-
-
# us-east-
* upgrade the image and then do-release-upgrade it, then reboot
$ IP=THE_IP_ADDRESS
$ ssh ubuntu@$IP
% sudo apt-get update -q && sudo apt-get upgrade -y
% do-release-upgrade --frontend=
# you could install the patched new version of cloud-init by hand here.
% sudo reboot
* see that the user-data has run more than once
# upon reboot, you'll see that the user-data script ran again (twice)
$ sudo cat /root/user-data.log
====== Thu, 08 Nov 2012 17:07:52 +0000
[/var/
====== Thu, 08 Nov 2012 17:26:50 +0000
[/var/
====== Thu, 08 Nov 2012 17:26:50 +0000
[/var/
[Regression Potential]
* There is little potential to make anything worse here. The relevant
change is really only to touch a file in the post install that will
serve as a marker for the newer version of cloud-init, so it realize
that the user-data has already been executed once.
=== End SRU Information ===
I spawned a lucid AWS instance and used some cloud-init config to perform some tasks for me.
All is good.
Then, as part of the task I was performing, I upgraded that lucid instance to precise using do-release-upgrade. It failed, but unrelated to cloud-init (a postinst from a package failed).
I then rebooted the instance. When it came back up, the cloud-init config I supplied the first time was run again, as if this was the first time the instance booted.
smoser had access to before and after reboot, and asked to add this to the bug:
# for x in /var/lib/
config-byobu
config-ca-certs
config-chef
config-grub-dpkg
config-
config-landscape
config-mcollective
config-phone-home
config-
config-rsyslog
config-salt-minion
config-
config-scripts-user
config-
config-
config-timezone
$ ls var-lib-
config-
config-
config-locale config-set_hostname user-scripts
config-mounts config-ssh
Changed in cloud-init (Ubuntu Precise): | |
status: | New → Triaged |
importance: | Undecided → High |
description: | updated |
Changed in cloud-init (Ubuntu Precise): | |
assignee: | nobody → Scott Moser (smoser) |
tags: |
added: verification-done removed: verification-needed |
Changed in cloud-init (Ubuntu Precise): | |
assignee: | Scott Moser (smoser) → nobody |
More info: loud', 'DataSourceConf igDrive' , 'DataSourceOVF'] loud', 'DataSourceConf igDrive' , 'DataSourceOVF'] loudNet' , 'DataSourceConf igDriveNet' , 'DataSourceOVFNet', 'DataSourceMAAS', 'DataSourceEc2'] py[DEBUG] : Using metadata source: 'http:// 169.254. 169.254' py[DEBUG] : crawl of metadata service took 0s py[DEBUG] : resize took 0.101883888245 seconds py[DEBUG] : resizing root filesystem (type=ext3, maj=202, min=1, val=True) hostname. py[DEBUG] : wrote ip-10-50-203-219 to /var/lib/ cloud/data/ previous- hostname etc_hosts. py[DEBUG] : not managing /etc/hosts cfg[INFO] : cloud-init-cfg ['all', 'config'] import_ id.py[DEBUG] : importing ssh ids. cmd = ['sudo', '-Hu', 'ubuntu', 'ssh-import-id', 'ahasenack'] _.py[DEBUG] ...
2012-09-11 13:42:31,743 - cloud-init[INFO]: cloud-init start-local running: Tue, 11 Sep 2012 13:42:31 +0000. up 10.06 seconds
2012-09-11 13:42:33,291 - __init__.py[DEBUG]: searching for data source in ['DataSourceNoC
2012-09-11 13:42:33,784 - __init__.py[DEBUG]: Did not find data source. searched classes: ['DataSourceNoC
2012-09-11 13:42:34,487 - cloud-init[INFO]: cloud-init start running: Tue, 11 Sep 2012 13:42:34 +0000. up 13.21 seconds
2012-09-11 13:42:34,529 - __init__.py[DEBUG]: searching for data source in ['DataSourceNoC
2012-09-11 13:42:34,738 - DataSourceEc2.
2012-09-11 13:42:34,756 - DataSourceEc2.
2012-09-11 13:42:34,757 - __init__.py[DEBUG]: found data source DataSourceEc2
2012-09-11 13:42:34,899 - cloud-init[DEBUG]: found data source: DataSourceEc2
2012-09-11 13:42:34,911 - __init__.py[DEBUG]: consume_userdata already ran once-per-instance
2012-09-11 13:42:34,974 - __init__.py[DEBUG]: handling bootcmd with freq=None and args=[]
2012-09-11 13:42:35,068 - __init__.py[DEBUG]: handling resizefs with freq=None and args=[]
2012-09-11 13:42:35,196 - cc_resizefs.
2012-09-11 13:42:35,196 - cc_resizefs.
2012-09-11 13:42:35,197 - __init__.py[DEBUG]: handling set_hostname with freq=None and args=[]
2012-09-11 13:42:35,198 - __init__.py[DEBUG]: config-set_hostname already ran once-per-instance
2012-09-11 13:42:35,198 - __init__.py[DEBUG]: handling update_hostname with freq=None and args=[]
2012-09-11 13:42:35,200 - cc_update_
2012-09-11 13:42:35,200 - __init__.py[DEBUG]: handling update_etc_hosts with freq=None and args=[]
2012-09-11 13:42:35,209 - cc_update_
2012-09-11 13:42:35,209 - __init__.py[DEBUG]: handling ca-certs with freq=None and args=[]
2012-09-11 13:42:35,210 - __init__.py[DEBUG]: handling rsyslog with freq=None and args=[]
2012-09-11 13:42:35,211 - __init__.py[DEBUG]: handling ssh with freq=None and args=[]
2012-09-11 13:42:35,220 - __init__.py[DEBUG]: config-ssh already ran once-per-instance
2012-09-11 13:42:37,221 - cloud-init-
2012-09-11 13:42:37,221 - __init__.py[DEBUG]: handling mounts with freq=None and args=[]
2012-09-11 13:42:37,305 - __init__.py[DEBUG]: config-mounts already ran once-per-instance
2012-09-11 13:42:37,315 - __init__.py[DEBUG]: handling ssh-import-id with freq=None and args=[]
2012-09-11 13:42:37,320 - cc_ssh_
2012-09-11 13:42:39,443 - __init__.py[DEBUG]: handling locale with freq=None and args=[]
2012-09-11 13:42:39,464 - __init__.py[DEBUG]: config-locale already ran once-per-instance
2012-09-11 13:42:39,464 - __init_