Monday, August 3, 2015

[Linux] “No such file or directory” on files that exist?

First, this kind of problem is almost related with dynamic loader. You can check out what it is:
To understand Linux Dynamic Loader
http://www.cs.virginia.edu/~dww4s/articles/ld_linux.html

After verifying it with several ways:
# file "your binary"
# readelf -l  "your binary"
# strings "your binary" | grep ld-

Then you can find out which dynamic loader your binary uses.
For my case, I just create a symbolic link to my loader, and then it works.
liudanny@Debian7 x64_lsb $ ll /lib64/
total 8
drwxr-xr-x  2 root root 4096 Aug  2 20:49 .
drwxr-xr-x 24 root root 4096 Jun 20 18:14 ..
lrwxrwxrwx  1 root root   32 Feb 22 06:41 ld-linux-x86-64.so.2 -> /lib/x86_64-linux-gnu/ld-2.13.so
lrwxrwxrwx  1 root root   20 Aug  2 20:49 ld-lsb-x86-64.so.3 -> ld-linux-x86-64.so.2

I also find some other issue about running a 32-bit binary on a 64-bit system. Here is a good answer in the following link:
Quote:
"But the program is a 32-bit program (as the file output indicates), looking for the 32-bit loader /lib/ld-linux.so.2, and you've presumably only installed the 64-bit loader /lib64/ld-linux-x86-64.so.2 in the chroot."
http://unix.stackexchange.com/questions/13391/getting-not-found-message-when-running-a-32-bit-binary-on-a-64-bit-system



To install ia32-libs on debian wheezy amd64:
dpkg --add-architecture i386 
apt-get update
apt-get install libc6:i386
or:
sudo dpkg --add-architecture i386
sudo apt-get update
sudo aptitude install ia32-libs

No comments: