I'm trying to compile the firmware for my linksys WRVS4400N.

ls shows that exist but when it try to run it bash says it does not exist. I can also cat it, and it is an executable, not a shell script.

  • what is output of ls -la for that particular file? – user389238 Aug 18 '11 at 21:29
  • @Ansis -rwxrwxrwx 1 1011 1011 31991 May 18 2006 mkdep – Avery3R Aug 18 '11 at 21:37
  • 1
    show us the line from your script, and the exact error message. What is your current directory when you try to invoke the "missing" file? – glenn jackman Aug 18 '11 at 22:15
  • @glenn It's not my script that's invoking it, it's cisco's makefile, I cant get the exact error message since it's running in a vm, but, bash: /pathto/mkdep file or folder not found – Avery3R Aug 18 '11 at 22:19
  • So that's where those trolls are hiding... – Breakthrough Aug 19 '11 at 0:30

You mentioned that the output of file mkdep is 32-bit elf. You're running a 64-bit VM.


$ uname -m
$ ls -l ./example 
-rwxr-xr-x 1 root root 92312 2011-08-18 16:52 ./example
$ file ./example 
example: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, stripped
$ ./example 
-bash: ./example: No such file or directory

Just make a new 32-bit VM and compile it there.

  • 1
    If you install ia32-libs, it should work afterwards. No need to create a 32bit VM. – Phil Feb 19 '13 at 15:32

Is it set to being executable? If not, then chmod +x filename. Is it in your PATH? If not, then call it as ./filename rather than just filename.

  • Its' set to executable, I've done ./mkdep to call it as well as using the full path, no dice. – Avery3R Aug 18 '11 at 21:26
  • You may need to run the file as sudo. – D'Arvit Aug 18 '11 at 23:17

When you try to execute a file and bash says it doesn't exist it sometimes means that bash believes the file is a script and that the interpreter specified in the first line (#!) does not exist.

If the files is named mkdep I would post the output of

file mkdep
hd mkdep | head
strace ./mkdep 2>mkdep.strace.txt

The strace command give info about system calls made, for example strace ls 2>ls.t puts the following into ls.t

execve("/bin/ls", ["ls"], [/* 22 vars */]) = 0
brk(0)                                  = 0x8061000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f82000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=32311, ...}) = 0
mmap2(NULL, 32311, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7f7a000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/librt.so.1", O_RDONLY)       = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\240\30\0\0004\0\0\0"..., 512) =512
fstat64(3, {st_mode=S_IFREG|0644, st_size=30624, ...}) = 0
  • (running on vm, too lazy to type everything out) ./mkdep returns file or folder not found. file mkdep returns 32-bit elf exe, and head mkdep returns binary data – Avery3R Aug 18 '11 at 21:53
  • 1
    mkdep is possibly generating this message because it can't find a file it needs?? – Linker3000 Aug 18 '11 at 22:04
  • @linker3000: Nope, it says Bash: /dirto/mkdep: file or folder not found – Avery3R Aug 18 '11 at 22:12
  • @MMavipc: try strace ./mkdep 2>mkdep.strace.txt this should give you some idea of what is going on. You may need to install strace from repositories. – RedGrittyBrick Aug 18 '11 at 23:08

Are you changing IFS in your script? I too encountered the same problem in one of my scripts and thought the same (32 bit file being read by shell script on 64 bit machine). But that wasn't the issue in my case. Instead, I was changing IFS to comma ',' and back to new line which somehow confused the parser and caused this error.

I just removed any change in IFS and it works just fine now!!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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