Public bug reported: I've managed to reproduce using multipass and KVM on a local machine.
To reproduce this you just need to have echo command in runcmd section of a cloud-init config file that have white space before any alphanumeric characters. For example the following runcmd stanza successfully updates /etc/motd: runcmd: - echo '############' > /etc/motd - echo 'Test Message' >> /etc/motd The follow runcmd stanza fails to execute the commands: runcmd: - echo ' ############' > /etc/motd - echo ' Test Message' >> /etc/motd These fail to run whether there is a single quotation mark or double quotation mark. It also appears to fail if it's a tab rather than a space, e.g. \t Not sure what logs to provide here, the cloud-init logs inside the VM are probably the most pertinent I would suspect as in both cases the VM build completes, it's just the commands are not run in one case, but I suspect the following lines in the cloud-init-output.log file in /var/log may be relevant: /var/lib/cloud/instance/scripts/runcmd: 12: Syntax error: Unterminated quoted string 2022-06-06 06:09:45,045 - cc_scripts_user.py[WARNING]: Failed to run module scripts-user (scripts in /var/lib/cloud/instance/scripts) 2022-06-06 06:09:45,045 - util.py[WARNING]: Running module scripts-user (<module 'cloudinit.config.cc_scripts_user' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_scripts_user.py'>) failed ** Affects: cloud-init Importance: Undecided Status: New ** Attachment added: "cloud-init.tar.gz" https://bugs.launchpad.net/bugs/1977780/+attachment/5595138/+files/cloud-init.tar.gz -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to cloud-init. https://bugs.launchpad.net/bugs/1977780 Title: cloud-init appears to fail to run echo commands in runcmd that have whitespace before alphanumeric characters Status in cloud-init: New Bug description: I've managed to reproduce using multipass and KVM on a local machine. To reproduce this you just need to have echo command in runcmd section of a cloud-init config file that have white space before any alphanumeric characters. For example the following runcmd stanza successfully updates /etc/motd: runcmd: - echo '############' > /etc/motd - echo 'Test Message' >> /etc/motd The follow runcmd stanza fails to execute the commands: runcmd: - echo ' ############' > /etc/motd - echo ' Test Message' >> /etc/motd These fail to run whether there is a single quotation mark or double quotation mark. It also appears to fail if it's a tab rather than a space, e.g. \t Not sure what logs to provide here, the cloud-init logs inside the VM are probably the most pertinent I would suspect as in both cases the VM build completes, it's just the commands are not run in one case, but I suspect the following lines in the cloud-init-output.log file in /var/log may be relevant: /var/lib/cloud/instance/scripts/runcmd: 12: Syntax error: Unterminated quoted string 2022-06-06 06:09:45,045 - cc_scripts_user.py[WARNING]: Failed to run module scripts-user (scripts in /var/lib/cloud/instance/scripts) 2022-06-06 06:09:45,045 - util.py[WARNING]: Running module scripts-user (<module 'cloudinit.config.cc_scripts_user' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_scripts_user.py'>) failed To manage notifications about this bug go to: https://bugs.launchpad.net/cloud-init/+bug/1977780/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp