13

Why would bash claim that a file doesn't exist when it clearly does?

$ ls -l a
-r-x------ 1 configurator configurator 3904 Dec  7 10:36 a

$ file a
a: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.2.5, stripped

$ ./a
-bash: ./a: No such file or directory

2 Answers2

15

You get this error because you try to run a 32-bit executable on a 64-bit operating system.

And the message No such file or directory does not refer to your executable file called a. Instead the error it refers to a helper program that's needed to run the 32-bit dynamically linked executable a.

You can find more information referring to static and dynamic linkage in this answer.

Radu Rădeanu
  • 169,590
  • 1
    I just wish the error message was a little friendlier and told me which file it couldn't find so I wouldn't have had to ask this question in the first place... – configurator Dec 09 '13 at 18:46
3

The problem likely isn't the file you're trying to run, but a file it depends on. Run ldd on the file to see if any of its dependencies can't be found.

Wutaz
  • 541