2

I am using 'eb deploy' for deploying my commits but getting this error

WARNING: You have uncommitted changes.
Creating application version archive "6fea".
Uploading: [##################################################] 100% Done...
INFO: Environment update is starting.
INFO: Deploying new version to instance(s).
ERROR: [Instance: i-10d1f9ec] Command failed on instance. Return code: 126
Output: /bin/sh: ./scripts/update-ftp-dns.sh: /bin/sh^M: bad interpreter: No such file or directory.
container_command 07-update_ftp_dns in .ebextensions/03-vsftpd.config failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
INFO: Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
INFO: New application version was deployed to running EC2 instances.
ERROR: Update environment operation is complete, but with errors. For more information, see troubleshooting documentation.

Please help me to solve this.

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
Parveen Kumar
  • 59
  • 1
  • 7

2 Answers2

0

The error message is a bit hidden, but it's in there:

Output: /bin/sh: ./scripts/update-ftp-dns.sh: /bin/sh^M: bad interpreter: No such file or directory.

If I had to guess, you have a line break with both a line feed and a carriage return in it. It's treating the carriage return character as if it's part of the name of the executable.

Make sure that you've converted the /scripts/update-ftp-dns.sh script so that it uses Unix line endings only.

See ./configure : /bin/sh^M : bad interpreter

Community
  • 1
  • 1
Jordan Reiter
  • 20,467
  • 11
  • 95
  • 161
0

I had something similar, and the cause was having Git's autocrlf value set to true. What this means is that Git will convert the file to a Windows-formatted one when git checkout is run - which unfortunately means that the Elastic Beanstalk tool tries to upload Windows-formatted files to your Linux server, which will manifest in errors like this.

I fixed it by switching autoclrf to false, and committing the relevant file again. Do be aware of the repercussions of this however.

Kylotan
  • 18,290
  • 7
  • 46
  • 74