Why would an executable say it doesn't exist when I try to run it?
Solution 1:
The program was compiled for an incompatible architecture, resulting in a non-executable program. The error message stating "does not exist" instead of "invalid executable" is just a very misleading message.
Recompiling it on the target machine fixed the problem.
Solution 2:
I had a problem very similar to the OP (./lfm: Command not found.
when I was looking right at it), and some of the answers here helped me figure out how to run my executable on a different system without recompiling. Here's how I would advise my past self (if I thought past-me was smart enough to listen for a change):
1) Verify that the file isn't a broken link, that it has executable permissions, and that you aren't trying to run a 64-bit executable on a 32-bit OS (for me, file lfm
returned lfm: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
so it is 64-bit; check the output of uname -a
for x86_64
in it, to verify the OS is 64-bit, too; i386
or i686
means 32-bit) (substitute your program name for lfm
in these examples, of course).
2) ldd lfm
returned the odd not a dynamic executable
message (rather than printing the shared library dependencies), so try readelf -l ./lfm | grep ld-linux
to find out where the executable expects to find ld-linux, which is the linux loader for dynamically linked libraries (in my case, this returned [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
).
3) Checking the directory indicated by the previous command shows that the indicated ld-linux file is not there; copy it over from the machine the program was originally compiled on (or a similar system, if necessary) to that directory.
4) Try running the original program again. (Worked for me.) Also, ldd ./lfm
should work now (but you can always use readelf -d ./lfm
to see what libraries are needed, and then verify that they're available.)
Solution 3:
Probably tagger is a soft-link and the target of the link isn't there. Reproduce like this:
$ cp /usr/bin/ld .
$ ln -s ld fff
$ rm ld
$ ./fff
zsh: no such file or directory: ./fff