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.

0

2 Answers 2

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

1

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
1
  • 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. Commented Aug 2, 2018 at 12:55

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.