Explaining "-bash: No such file or directory" [duplicate]

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

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.


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.