Lib linux bad elf interpreter such file directory

others-how to solve bad ELF interpreter error

When we do some operations on Linux operating System, sometimes, we get this error:

/lib/ld-linux.so.2: bad ELF interpreter: No such file or directory 

Environment

[[email protected]]$ uname -m&&uname -r x86_64 2.6.32-220.el6.x86_64 [x@localhost]$ cat /etc/redhat-release CentOS release 6.2 (Final) 

Solution #1

This error is caused by installing 32x app into 64x system. You can install this to avoid this error:

glibc is the libc library released by GNU, that is, the c runtime library. glibc is the lowest api in the linux system, and almost any other runtime library will depend on glibc. In addition to encapsulating the system services provided by the Linux operating system, glibc itself also provides the realization of many other necessary functional services. Since glibc covers almost all the common UNIX standards, it can be imagined that its content is all-encompassing. And just like other UNIX systems, its contained file groups are scattered in the system’s tree-like directory structure, supporting the entire operating system like a bracket.

If you still get error after installing glibc.i686:

error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory 
error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory 
yum install zlib.i686 --setopt=protected_multilib=false

Solution #2

If you don’t want to install the dependencies one by one, you can install all the dependencies of 32x apps in 64x system by executing this command:

yum install libstdc++.i686 yum install xulrunner.i686 

Источник

Читайте также:  Zip all file linux

/lib/ld-linux.so.2: bad ELF interpreter: No such file or directory

When I exectued command to install application following error accured: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory I was not aware of how to fix this problem, to find out resolution I searched for solotutions on net and found following resolution:

yum install glibc.i686 or yum install glibc.i386 
Loaded plugins: fastestmirror, refresh-packagekit, security Loading mirror speeds from cached hostfile Setting up Install Process No package glibc.i686 available. Error: Nothing to do 
Download glibc rpm packge for centos 6 and install them. 
glibc-2.12-1.80.el6.i686.rpm glibc-common-2.12-1.80.el6.i686.rpm glibc-devel-2.12-1.80.el6.i686.rpm glibc-headers-2.12-1.80.el6.i686.rpm glibc-static-2.12-1.80.el6.i686.rpm glibc-utils-2.12-1.80.el6.i686.rpm 
yum install glibc.i686 rpm -U glibc-2.12-1.80.el6.i686.rpm rpm -ivh glibc-2.12-1.80.el6.i686.rpm 
[root@demo tmp_glibc]# rpm -ivh glibc-2.12-1.80.el6.i686.rpm error: Failed dependencies: glibc-common = 2.12-1.80.el6 is needed by glibc-2.12-1.80.el6.i686 libfreebl3.so is needed by glibc-2.12-1.80.el6.i686 libfreebl3.so(NSSRAWHASH_3.12.3) is needed by glibc-2.12-1.80.el6.i686 

To resolve dependency problem tried to install «glibc-common-2.12-1.80.el6.i686.rpm», but again bad luck runs and gives error:

[root@demo tmp_glibc]# rpm -ivh glibc-common-2.12-1.80.el6.i686.rpm error: Failed dependencies: glibc = 2.12-1.80.el6 is needed by glibc-common-2.12-1.80.el6.i686 libc.so.6 is needed by glibc-common-2.12-1.80.el6.i686 libc.so.6(GLIBC_2.0) is needed by glibc-common-2.12-1.80.el6.i686 libc.so.6(GLIBC_2.1) is needed by glibc-common-2.12-1.80.el6.i686 libc.so.6(GLIBC_2.1.1) is needed by glibc-common-2.12-1.80.el6.i686 libc.so.6(GLIBC_2.1.3) is needed by glibc-common-2.12-1.80.el6.i686 libc.so.6(GLIBC_2.10) is needed by glibc-common-2.12-1.80.el6.i686 libc.so.6(GLIBC_2.2) is needed by glibc-common-2.12-1.80.el6.i686 libc.so.6(GLIBC_2.3) is needed by glibc-common-2.12-1.80.el6.i686 libcap.so.2 is needed by glibc-common-2.12-1.80.el6.i686 libdl.so.2 is needed by glibc-common-2.12-1.80.el6.i686 libdl.so.2(GLIBC_2.0) is needed by glibc-common-2.12-1.80.el6.i686 libdl.so.2(GLIBC_2.1) is needed by glibc-common-2.12-1.80.el6.i686 

Can anyone please help me figure out how to resolve this? More Details: Operating System: centos 6.3 Yum installed packege list:

[root@demo tmp_glibc]# yum list installed glibc Loaded plugins: fastestmirror, refresh-packagekit, security Loading mirror speeds from cached hostfile Installed Packages glibc.x86_64 

Источник

«/usr/bin/javac: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory»

I installed jdk1.8.0_161 in linux server RHEL 7.. I am not able to check java version due to «/usr/bin/javac: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory» below are the steps i followed to install jdk,

cd /opt/jdk1.8.0_161/ alternatives --install /usr/bin/java java /opt/jdk1.8.0_161/bin/java 2 alternatives --config java There is 1 program that provides 'java'. Selection Command ----------------------------------------------- *+ 1 /opt/jdk1.8.0_161/bin/java Enter to keep the current selection[+], or type selection number: 1 alternatives --install /usr/bin/jar jar /opt/jdk1.8.0_161/bin/jar 2 alternatives --install /usr/bin/javac javac /opt/jdk1.8.0_161/bin/javac 2 alternatives --set jar /opt/jdk1.8.0_161/bin/jar alternatives --set javac /opt/jdk1.8.0_161/bin/javac java -version -bash: /usr/bin/java: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory export JAVA_HOME=/opt/jdk1.8.0_161 export JRE_HOME=/opt/jdk1.8.0_161/jre export PATH=$PATH:/opt/jdk1.8.0_161/bin:/opt/jdk1.8.0_161/jre/bin 

1 Answer 1

Looks like you unpacked a tar.gz file in /opt/. This version is obviously trying to use the 32bits /lib/ld-linux.so.2 . (The 64bits linker is /usr/lib64/ld-linux-x86-64.so.2 -> ld-2.17.so )

Читайте также:  Linux display on windows

# cd Downloads/ && yum install ./jdk-8u162-linux-x64.rpm

# alternatives --install /usr/bin/java java /usr/java/jdk1.8.0_162/bin/java 2 # alternatives --install /usr/bin/javac javac /usr/java/jdk1.8.0_162/bin/javac 2 # alternatives --config java # alternatives --config javac 

Источник

Docker — /bin/sh: not found — bad ELF interpreter — how to add 32bit lib support to a docker image

UPDATE – Old question title:
Docker — How to execute unzipped/unpacked/extracted binary files during docker build (add files to docker build context) — I’ve been trying (half a day :P) to execute a binary extracted during docker build. My dockerfile contains roughly:

. COPY setup /tmp/setup RUN \ unzip -q /tmp/setup/x/y.zip -d /tmp/setup/a/b . 
/bin/sh: 1: /tmp/setup/a/b/imcl: not found 

What was confusing, was that displaying the directory b (inside the dockerfile, during build) before trying to execute the binary, showed the correct file in place:

RUN ls -la /tmp/setup/a/b/imcl -rwxr-xr-x 1 root root 63050 Aug 9 2012 imcl RUN file /tmp/setup/a/b/imcl ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.2.5, not stripped` 

Being a Unix noob at first I thought it was a permission issue (root of the host being different than root of the container or something) but, after checking, the UID was 0 for both so it got even weirder. Docker asks not to use sudo so I tried with su combinations:

su - -c "/tmp/setup/a/b/imcl" su - root -c "/tmp/setup/a/b/imcl" 
stdin: is not a tty -su: /tmp/setup/a/b: No such file or directory 

Well heck, I even went and defied Docker recommendations and changed my base image from debian:jessie to the bloatish ubuntu:14.04 so I could try with sudo 😀 Guess how that turned out?

sudo: unable to execute /tmp/setup/a/b/imcl: No such file or directory 
  • Is there a workaround to this?
  • Is there a way to add extracted files to docker build context during a build (within the dockerfile)?
Читайте также:  Remove ssh key linux

Oh and the machine I’m building this is not connected to the internet.

I guess what I’m asking is similar to this (though I see no answer):
How to include files outside of Docker’s build context?

Do I need to unzip with a shell script before sending the build context to Docker daemon so all files are used exactly as they were during build command?

UPDATE:
Meh, the build context actually wasn’t the problem. I tested this and was able to execute unpacked binary files during docker build.

My problem is actually this one: CentOS 64 bit bad ELF interpreter

Using debian:jessie and ubuntu:14.04 as base images only gave No such file or directory error but trying with centos:7 and fedora:23 gave a better error message:

/bin/sh: /tmp/setup/a/b/imcl: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory 

So that led me to the conclusion that this is actually the problem of running a 32-bit application on a 64-bit system.

Now the solution would be simple if I had internet access and repos enabled:

So the question becomes now:

According to IBM, the precise libraries I need are gtk2.i686 and libXtst.i686 and possibly libstdc++

[root@localhost]# yum install gtk2.i686 [root@localhost]# yum install libXtst.i686 [root@localhost]# yum install compat-libstdc++ 

Источник

Оцените статью
Adblock
detector