0

Trying to add a startup script following the sample here: https://cloud.google.com/compute/docs/startupscript

The instance is created with no problems but the script does not execute. Console shows the following output:

Jul 28 15:54:39 testclient-pbx startup-script: INFO Starting startup scripts.

Jul 28 15:54:39 testclient-pbx startup-script: INFO Found startup-script in metadata.

Jul 28 15:54:39 hostname startup-script: INFO startup-script: /bin/bash: /startup-aVpN6i/tmpVVdFyB: /bin/bash^M: bad interpreter: No such file or directory

Jul 28 15:54:39 hostname startup-script: INFO startup-script: Return code 126.

Jul 28 15:54:39 hostname startup-script: INFO Finished running startup scripts.

I'm actually trying to run more complex script but was receiving same error. Using debian-cloud/debian-9 image.

1

I'm using VScode on Win platform and as you can see above the message hinted file was not found. I had to change CRLF in VScode to LF "Unix" style and script now runs correctly! In VScode just click the CRLF bottom right and change to LF.

image

0

It looks like you are passing a hidden symbol ^M

I would recommend you to inspect the file with vim and set the following command to show you the hidden characters:

:set list
  • Thank you @miguelfrancisco85. Yes, this would have helped me find the issue. As stated above this was due to file being created in windows platform and using CRLF instead of *nix LF. – RT2 Tech Aug 2 '18 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.