/lib64/ld-linux-x86-64.so.2: No such file or directory error
Asked Answered
D

4

91

Background

I am using docker to do a school project. Specifically, I pulled an ubuntu image and here is the system config:

enter image description here

I then logged into the docker container (ubuntu) and set up elasticsearch. When I try to run

./bin/elasticsearch

I get the following error inside the docker container's terminal

/lib64/ld-linux-x86-64.so.2: No such file or directory

I have two main confusions:

  1. what does that even mean?
  2. How to solve it?
Doityourself answered 3/8, 2021 at 4:53 Comment(1)
Please show the exact steps you are running with a copy and paste from the command line. Include the command run, it's output, and post it as formatted text rather than a screenshot. This should include the steps taken to start ubuntu and install/setup elasticsearch.Mohsen
M
193

If you are running this on an M1 macbook, it's possible that you are running a native Arm image of ubuntu, instead of the emulated x86 image. If the elasticsearch distribution you are trying to install is for x86_64, then it attempts to link to the x86-64-native ld.so, which of course isn't present on different platforms.

Either install the package for the arm platform specifically if they provide one, or - more likely - run docker explicitly as the emulated x86_64 platform:

docker run --platform linux/x86_64 <image>
Morphogenesis answered 6/9, 2021 at 13:40 Comment(6)
many hours of searching, and finally found this, it was the missing piece of the puzzle. My use case was a bit different, but ultimately same root cause.Admixture
thank you so much, I've encountered the same problem on M1 with docker build command. docker build --platform linux/x86_64 helped!Polygenesis
me too. I'm new to Mac world and your answer has saved a lot of my time figuring it out. thanksPotty
My god this is the answer. Thank you so much! Also on M1 Pro here.Epistle
sure it works, but it's SLOW as hell because it uses emulation then :(Thierry
Same case for me, have to live with the emulation.Rudnick
C
35

For docker-compose, add platform: linux/x86_64 according to the docs

services:
  my-app:
    platform: linux/x86_64
Clastic answered 24/2, 2022 at 6:42 Comment(0)
M
5

No idea what you are running in your container but for me, the reason was simply because a package (Prisma https://github.com/prisma/prisma/issues/8478#) did not find openssl packages and installing them on alpine image failed even with openssl manually installed.

It was fixed by switching to slim image and installing openssl with apt-get update && apt-get -y install openssl. I highly recommend not changing your platform since with my M1 the build time increased by 200s using linux/x86_64.

Mozellamozelle answered 26/8, 2022 at 10:4 Comment(0)
A
3

Completing @misnomer answer, I could not even build the image. If that is the case just add FROM --platform=linux/x86_64 ..., from this source. Ex: FROM --platform=linux/x86_64 python:slim ...

Apicella answered 22/11, 2022 at 0:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.