Home >Backend Development >Golang >How to Fix 'Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory' Error in QEMU on M1 Macs?

How to Fix 'Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory' Error in QEMU on M1 Macs?

Barbara Streisand
Barbara StreisandOriginal
2024-12-16 17:54:12204browse

How to Fix

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

When attempting to build a Docker image on an M1 MacOS using Rancher Desktop, users may encounter the following error:

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

This issue arises due to the ARM64 architecture of the M1 processor, which is incompatible with the x86_64 architecture of the Docker image.

Resolution:

To resolve this issue, specify the desired Docker image architecture explicitly in the Dockerfile. Instead of using general-purpose platforms like "linux/amd64," specify either "linux/arm64" or "linux/arm64/v8." This ensures that the Docker image is built for the correct architecture and prevents the "Could not open" error.

Example:

FROM --platform=linux/arm64 ubuntu:focal

Alternatively, in certain cases, it might be necessary to modify the platform configuration in the docker build command itself. For instance, adding --platform=linux/amd64 to the command may work for some users on M1 Macs.

Customizing the Platform Configuration:

docker build --platform=linux/arm64 -t te-grafana-dashboards-toolchain --no-cache .

By explicitly specifying the desired architecture, users can ensure that the Docker image is built with the proper compatibility for their M1 MacOS system and avoid the aforementioned error.

The above is the detailed content of How to Fix 'Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory' Error in QEMU on M1 Macs?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn