Skip to content

Instantly share code, notes, and snippets.

@mikesager
mikesager / runcmd.md
Created July 20, 2020 04:00
SOLVED: cloud-init runcmd doesn't work

If you've added some runcmd lines to your cloud-init config, and the commands don't seem to be executing, here's a few things you should know:

WTF is going on?

  1. runcmd only has code to "shellify" your strings or array of strings (i.e: turns them into a shell script)
  2. runcmd will only write a shell script into the file /var/lib/cloud/instance/scripts/runcmd
  3. runcmd is part of the cloud_config_modules boot stage
  4. You need to execute that runcmd shell script using the scripts-user module
  5. scripts-user is part of the cloud_final_modules boot stage