Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
“No such file or directory” lies on Optware installed binaries

I'm trying to add ebtables to a little router box. I went and got a binary compiled for the correct architecture, and put it on the box in /sbin/. When I do /sbin/ebtables, the shell says /bin/sh: /sbin/ebtables: not found, but I can do ls -l /sbin/ebtables and it shows up perfectly:

-rwxr-xr-x    1 admin    admin        4808 Aug  4 10:36 /sbin/ebtables

Any ideas about what's going on here?

share|improve this question

marked as duplicate by Gilles, Caleb, Shawn J. Goff, Michael Mrozek Aug 6 '11 at 6:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

you are logged in using admin ? – mr_eclair Aug 4 '11 at 15:16
Yes, it's a single-user system. All the other commands also are owned by admin:admin, and I can run them just fine. – Shawn J. Goff Aug 4 '11 at 15:17
up vote 12 down vote accepted

It could be a missing dependency. Notably you'll get that type of message if the runtime linker ("program interpreter") set in the ELF header does not exist on your system.

To check for that, run:

readelf -l your_executable|grep "program interpreter"

If what it gives you does not exist on your system, or has missing dependencies (check with ldd), you'll get that strange error message.


$ gcc -o test t.c
$ readelf -l test|grep "program interpreter"
      [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]
$ ./test

$ gcc -Wl,--dynamic-linker -Wl,/i/dont/exist.so -o test t.c
$ readelf -l test|grep "program interpreter"
      [Requesting program interpreter: /i/dont/exist.so]
$ ./test
bash: ./test: No such file or directory
share|improve this answer
That was the ticket: I needed a version compiled for uClibc. I compiled it myself and it worked fine. – Shawn J. Goff Aug 4 '11 at 22:45

Are you running it as root? IIRC some bash implementations refuse to run anything from /sbin and /usr/sbin if you're not root.

I found this article for an explanation (maybe not related, talks about OpenSUSE).

share|improve this answer
Yes, and I can run all the other programs in the directory with the exact same ownership and permissions just fine. – Shawn J. Goff Aug 4 '11 at 15:29
You've misunderstood the explanation on that link. It's about bash's behavior when a command is not found in the $PATH. If you give the full path to the command, bash will run it. Also, this wasn't likely to be relevant in the first place since a “little router box” is unlikely to be running bash. – Gilles Aug 4 '11 at 16:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.