aws / aws-mwaa-local-runner

This repository provides a command line interface (CLI) utility that replicates an Amazon Managed Workflows for Apache Airflow (MWAA) environment locally.
MIT No Attribution
687 stars 695 forks source link

Can't ./mwaa-local-env build-image, executor fails running 6/13 RUN chmod u+x /systemlibs.sh && /systemlibs.sh #96

Closed nrivas7 closed 2 years ago

nrivas7 commented 2 years ago

Having issue with building image in the step 6:

=> ERROR [ 6/13] RUN chmod u+x /systemlibs.sh && /systemlibs.sh 1.4s

[ 6/13] RUN chmod u+x /systemlibs.sh && /systemlibs.sh:

10 1.045 /bin/sh: /systemlibs.sh: /bin/sh^M: bad interpreter: No such file or directory


executor failed running [/bin/sh -c chmod u+x /systemlibs.sh && /systemlibs.sh]: exit code: 126

someone who can help me please?

FergusDevelopmentLLC commented 2 years ago

maybe try to add --network host to mwaa-local-env line 53:

build_image() {
   docker build --network host --rm --compress -t amazon/mwaa-local:$AIRFLOW_VERSION ./docker
}

When I added this the build worked.

RayCatLovesCoffee commented 2 years ago

Hello @nrivas7, this issue is caused by Windows changing line endings in .sh files (that ^M was added by Windows). Try running these commands before building the image:

sed -i -e 's/\r$//' docker/script/bootstrap.sh
sed -i -e 's/\r$//' docker/script/entrypoint.sh
sed -i -e 's/\r$//' docker/script/systemlibs.sh

Alternatively, you can also open those files in Vi editor and run command :set fileformat=unix and then save it.

That should take care of the issue.

nrivas7 commented 2 years ago

Hi!, thanks for the answer, it worked for me!

mkaja commented 2 years ago

hi I tried docker --network host and didnt help

=> ERROR [ 6/13] RUN chmod u+x /systemlibs.sh && /systemlibs.sh 1.3s

[ 6/13] RUN chmod u+x /systemlibs.sh && /systemlibs.sh:

10 0.384 Loaded plugins: ovl, priorities

10 1.268 https://cdn.amazonlinux.com/2/core/2.0/x86_64/0fb73a8ab81f81d99df2464697d2f9184330ea58b58038a4af4c2e8b61809eae/repodata/repomd.xml?instance_id=imds_disabled&region=unknown: [Errno 14] curl#60 - "SSL certificate problem: unable to get local issuer certificate"

10 1.268 Trying other mirror.

10 1.268

10 1.268

10 1.268 One of the configured repositories failed (Amazon Linux 2 core repository),

10 1.268 and yum doesn't have enough cached data to continue. At this point the only

10 1.268 safe thing yum can do is fail. There are a few ways to work "fix" this:

10 1.268

10 1.268 1. Contact the upstream for the repository and get them to fix the problem.

10 1.268

10 1.268 2. Reconfigure the baseurl/etc. for the repository, to point to a working

10 1.268 upstream. This is most often useful if you are using a newer

10 1.268 distribution release than is supported by the repository (and the

10 1.268 packages for the previous distribution release still work).

10 1.268

10 1.268 3. Run the command with the repository temporarily disabled

10 1.268 yum --disablerepo=amzn2-core ...

10 1.268

10 1.268 4. Disable the repository permanently, so yum won't use it by default. Yum

10 1.268 will then just ignore the repository until you permanently enable it

10 1.268 again or use --enablerepo for temporary usage:

10 1.268

10 1.268 yum-config-manager --disable amzn2-core

10 1.268 or

10 1.268 subscription-manager repos --disable=amzn2-core

10 1.268

10 1.268 5. Configure the failing repository to be skipped, if it is unavailable.

10 1.268 Note that yum will try to contact the repo. when it runs most commands,

10 1.268 so will have to try and fail each time (and thus. yum will be be much

10 1.268 slower). If it is a very temporary problem though, this is often a nice

10 1.268 compromise:

10 1.268

10 1.268 yum-config-manager --save --setopt=amzn2-core.skip_if_unavailable=true

10 1.268

10 1.268 failure: repodata/repomd.xml from amzn2-core: [Errno 256] No more mirrors to try.

10 1.268 https://cdn.amazonlinux.com/2/core/2.0/x86_64/0fb73a8ab81f81d99df2464697d2f9184330ea58b58038a4af4c2e8b61809eae/repodata/repomd.xml?instance_id=imds_disabled&region=unknown: [Errno 14] curl#60 - "SSL certificate problem: unable to get local issuer certificate"


executor failed running [/bin/sh -c chmod u+x /systemlibs.sh && /systemlibs.sh]: exit code: 1

mkaja commented 2 years ago

any update @here

KapilTandon-Dentsu commented 2 years ago

Hi @mkaja , Did you find any solution ?

mkaja commented 2 years ago

No @KapilTandon-Dentsu we ran it in ec2 and it was successful , but still trying from my local mac

hmsith commented 2 years ago

Adding proxy env variables to systemlibs.sh helped get past the error

--- a/docker/script/systemlibs.sh
+++ b/docker/script/systemlibs.sh
@@ -1,6 +1,8 @@
 #!/bin/sh

 set -e
+export HTTPS_PROXY=http://{PROXY_URL}:{PROXY_PORT}
+export HTTP_PROXY=http://{PROXY_URL}:{PROXY_PORT}
...
...
anupash147 commented 1 year ago

i tried running it in amazon ec2 machines still does not work... lost hopes now

kasper-kooijman commented 1 year ago

@RayCatLovesCoffee Thanks for the answer! I had to add one extra thing to it though. For future readers: sed -i -e 's/\r$//' docker/script/generate_key.sh

Chiheb-Zoghlami commented 3 months ago

To recap, the solution is to use the following commands: sed -i -e 's/\r$//' docker/script/generate_key.sh

sed -i -e 's/\r$//' docker/script/bootstrap.sh

sed -i -e 's/\r$//' docker/script/entrypoint.sh

sed -i -e 's/\r$//' docker/script/systemlibs.sh

garrett-groff-ch commented 2 months ago

For the line endings issue, this should work. Run from aws-mwaa-local-runner directory.

find . -type f -exec dos2unix -v {} \;

Note: install dos2unix on your WSL distro before running the command, obviously. For eg, if using Ubuntu: sudo apt install dos2unix