[Docker M1/M2 Mac] qemu-x86_64: Could not open /lib64/ld-linux-x86-64.so.2: No such file or directory AWS CLI


% aws --version

qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': 
No such file or directory

If you have installed AWS CLI on the Ubuntu docker image on your M1/M2 Mac and are trying to run the aws commands and you get the above error, then the reason could be that the underlying Ubuntu image will be an ARM one and not x86-64 one.

Solution 1:

Download the AWS CLI2 for ARM Linux and get it installed.

Download awscli (AWS LINK: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
$ curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
Solution 2:

While running your docker image for Ubuntu set the --platform option as linux/x86_64

|CBS|BASH|% docker run --platform linux/x86_64 ubuntu
Fix - Docker Ubuntu Could not open linux-x86-64-so.2
Fix - Docker Ubuntu Could not open linux-x86-64-so.2
Advertisements
Try Out Code2care Dev Tools:

Advertisements

Advertisements
Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.