I'm having a perplexing issue. If I try to run a script via:

root@myServer:~/dig# ./minerd.sh

I get:

-bash: ./minerd.sh: No such file or directory

If I try:

root@myServer:~/dig# ~/dig/minerd.sh

I still get:

-bash: /root/dig/minerd.sh: No such file or directory

If I do:

root@myServer:~/dig# ls ~/dig/minerd.sh

Then I get:


So, the file is clearly there. I have also previously done chmod +x on it. But still, its not allowing me to run it for some reason. What am I doing wrong?

Edit: Even moving the file to a different name doesn't work:

root@myServer:~/dig# mv minerd.sh test.sh
root@myServer:~/dig# ./test.sh
-bash: ./test.sh: No such file or directory
  • What is the output of ls -la ./minerd.sh – David Wilkins Feb 27 '14 at 19:51
  • @DavidWilkins -rwxr-xr-x 1 1000 1000 379680 Jul 10 2013 ./minerd.sh – Click Upvote Feb 27 '14 at 19:52
  • Well that shows that it is executable, so that isn't the problem – David Wilkins Feb 27 '14 at 19:53
  • @DavidWilkins Yes. I downloaded the file via links http://sourceforge.net/projects/cpuminer/files/pooler-cpuminer-2.3.2-linux-x86.tar.gz/download and then extracted it via tar -xvf *.gz if that might have any bearing on it – Click Upvote Feb 27 '14 at 19:55
  • 1
    Next thing to check (although a different error message would have been produced) is to run ldd minerd. Make sure that all of the link libraries are actually found on the system. Also, If this is a 64-bit system, do you have 32-bit compatibility libraries installed? Final comment - don't run unknown programs as root - use a non-privileged account. – doneal24 Feb 27 '14 at 20:10

Check the '#!' line, the very first line of the file. If you have a typo in the shell path, you will get that message.

If the '#!' line looks good, try doing xxd minderd.sh - look carefully in the output for non-printing byte values. You can have an "invisible typo".

EDIT Since you mention it's a binary file, which I assume means a compiled executable, do this:

ldd minderd.sh

That will show you things like what dynamic libraries the file needs, and where the dynamic linker will get them. I bet you that whatever dynamic linker the executable wants (which is /lib/ld-linux.so.2 based on your comment above), doesn't exist on your system.

  • Actually this file is a binary I believe. Its original name was just minerd, I renamed to minerd.sh to see if that might help. If I nano it, i just see binary code. – Click Upvote Feb 27 '14 at 20:02
  • Strange thing is, if I follow the same steps in downloading this file locally, it works fine. Could it be that my VPS host has disabled running dogecoin miner type of applications and that's why its not running? – Click Upvote Feb 27 '14 at 20:04
  • @ClickUpvote I would think they would give a meaninfgul error if that was the case, but it is possible – David Wilkins Feb 27 '14 at 20:05
  • @DavidWilkins Exactly. I'm running Ubuntu 13 on the server if it helps. – Click Upvote Feb 27 '14 at 20:07
  • So you have systems where it works, and others where it doesn't. Are both 64 (or 32) bits? If both 64 bits, perhaps one is set up to run 32-bit executables, the other one isn't? Also note that Linux can be set up to run alien executables (e.g. Java bytecode) directly. What does file minerd.sh say? Are you sure that the executable isn't corrupt? – vonbrand Feb 27 '14 at 20:23

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