0

While trying to use the AWS userdata option to run a script on instance boot, I noticed that some times (Not always) the cloud init part gets stuck somewhere in the middle and does not reach the part where it runs the user script.

This is how it should look in the /var/log/cloud-init-output.log file:

Cloud-init v. 0.7.5 running 'init-local' at Tue, 30 May 2017 06:38:40 +0000. Up 18.56 seconds.
Cloud-init v. 0.7.5 running 'init' at Tue, 30 May 2017 06:38:45 +0000. Up 23.39 seconds.
SOME_NETWORK_AND_SSH_KEYS_INFO_HERE
Cloud-init v. 0.7.5 running 'modules:config' at Tue, 30 May 2017 06:38:51 +0000. Up 28.80 seconds.
Generating locales...
  en_US.UTF-8... up-to-date
Generation complete.
Cloud-init v. 0.7.5 running 'modules:final' at Tue, 30 May 2017 06:39:35 +0000. Up 73.20 seconds.
MY_USERDATA_SCRIPT_OUTPUT_HERE

But here is how it looks when its stuck:

Cloud-init v. 0.7.5 running 'init-local' at Tue, 30 May 2017 06:36:43 +0000. Up 21.80 seconds.
Cloud-init v. 0.7.5 running 'init' at Tue, 30 May 2017 06:36:51 +0000. Up 30.13 seconds.
SOME_NETWORK_AND_SSH_KEYS_INFO_HERE
Cloud-init v. 0.7.5 running 'modules:config' at Tue, 30 May 2017 06:36:59 +0000. Up 37.66 seconds.
Generating locales...
  en_US.UTF-8... up-to-date
Generation complete.

As you can see, its stuck after the Generation complete and thats it.

Any idea what can cause it and how I should mitigate it?

Btw, OS is Ubuntu 14.04

3
  • Add set -x to your user-data script so you can see where it's hanging.
    – jordanm
    May 30, 2017 at 16:02
  • @jordanm it will not help because my script it not even starting. The cloud-init is stuck before
    – shaharmor
    Jun 2, 2017 at 11:21
  • Why do you believe that?
    – jordanm
    Jun 3, 2017 at 2:07

1 Answer 1

0

So the issue was the another not-related script that was also set to run at the same run-level was stuck, which caused the whole run-level to wait for it to finish before starting the next level (In which module:final is at).

Once we fixed that script the issue was gone.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .