Re: Problem while starting binary...-No such file or directory

Michael Mess (michael@kawo2.rwth-aachen.de)
Tue, 16 Feb 1999 21:34:06 +0100


Hi!

Thank you for your responses.

ldd doesn't seem to work. It seems that the exec-call can't find the
file. And ldd doesn't work, and if i remember right it is because it
executes a binary with 0 command line parameters.

<test@michael>:~/ns45/communicator-v45.x86-unknown-linux2.0/netsc>ldd
./netscape
ldd: can't execute ./netscape (No such file or directory)
<test@michael>:~/ns45/communicator-v45.x86-unknown-linux2.0/netsc>

So I tried another trick: I straced a bash shell in which I tried to
start the program.

<test@michael>:~/ns45/communicator-v45.x86-unknown-linux2.0/netsc>strace
-o xxxxx -ff bash
<test@michael>:~/ns45/communicator-v45.x86-unknown-linux2.0/netsc>./netscape
Process 9567 attached
Process 9566 suspended
bash: ./netscape: No such file or directory
Process 9566 resumed
Process 9567 detached
<test@michael>:~/ns45/communicator-v45.x86-unknown-linux2.0/netsc>exit
<test@michael>:~/ns45/communicator-v45.x86-unknown-linux2.0/netsc>

In the file xxxxx.9567 (see below) the execve-call returns ENOENT. So
the bug must be somewhere in the execve-call.
As the file isn't executed at all, this can't be a library-problem here,
because the libraries normally are loaded after the exec succeeded.
The following stat on the file is successful.

...
sigaction(SIGQUIT, {SIG_DFL}, {SIG_IGN}) = 0
sigaction(SIGTERM, {SIG_DFL}, {SIG_IGN}) = 0
sigaction(SIGCHLD, {SIG_DFL}, {0x8013d90, [], 0}) = 0
execve("./netscape", ["./netscape"], [32 vars]) = -1 ENOENT (No such
file or dir
ectory)
stat("./netscape", {st_mode=S_IFREG|0555, st_size=12179036, ...}) = 0
open("/usr/share/locale/C/LC_MESSAGES", O_RDONLY) = -1 ENOENT (No such
file or d
irectory)
stat("/etc/locale/C/libc.cat", 0xbfffecf8) = -1 ENOENT (No such file or
director
y)
stat("/usr/lib/locale/C/libc.cat", 0xbfffecf8) = -1 ENOENT (No such file
or dire
ctory)
stat("/usr/lib/locale/libc/C", 0xbfffecf8) = -1 ENOENT (No such file or
director
y)
stat("/usr/share/locale/C/libc.cat", 0xbfffecf8) = -1 ENOENT (No such
file or di
rectory)
stat("/usr/local/share/locale/C/libc.cat", 0xbfffecf8) = -1 ENOENT (No
such file
or directory)
write(2, "bash: ./netscape: No such file o"..., 44) = 44
_exit(126) = ?

For a comparison I straced a bash which executed the command
/bin/echo test

<test@michael>:~/ns45/communicator-v45.x86-unknown-linux2.0/netsc>strace
-o yyyyyy -ff bash
<test@michael>:~/ns45/communicator-v45.x86-unknown-linux2.0/netsc>/bin/echo
test
Process 9584 attached
Process 9581 suspended
test
Process 9581 resumed
Process 9584 detached
<test@michael>:~/ns45/communicator-v45.x86-unknown-linux2.0/netsc>exit
<test@michael>:~/ns45/communicator-v45.x86-unknown-linux2.0/netsc>

Then the file yyyyyy.9584 contained:

...
sigaction(SIGCHLD, {SIG_DFL}, {0x8013d90, [], 0}) = 0
execve("/bin/echo", ["/bin/echo", "test"], [32 vars]) = 0
mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|0x20, 4294967295, 0) =
0x4000600
0
mprotect(0x8000000, 3742, PROT_READ|PROT_WRITE|PROT_EXEC) = 0
stat("/etc/ld.so.cache", {st_mode=S_IFREG|0644, st_size=6401, ...}) = 0
open("/etc/ld.so.cache", O_RDONLY) = 4
mmap(0, 6401, PROT_READ, MAP_SHARED, 4, 0) = 0x40007000
close(4) = 0
open("/usr/local/kde/lib/libc.so.5", O_RDONLY) = -1 ENOENT (No such file
or dire
ctory)
open("/usr/local/qt/lib/libc.so.5", O_RDONLY) = -1 ENOENT (No such file
or direc
tory)
open("/usr/lib/libc.so.5", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("/usr/local/lib/libc.so.5", O_RDONLY) = -1 ENOENT (No such file or
director
y)
open("/usr/X11/lib/libc.so.5", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("/lib/libc.so.5.3.12", O_RDONLY) = 4
read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3"..., 4096) = 4096
mmap(0, 724992, PROT_NONE, MAP_PRIVATE|0x20, 4294967295, 0) = 0x40009000
...

After the (successful) execve the process searches for the libraries.

Greetings, Michael

Eric@KPN.com wrote:
>
> >
> > Hi!
> >
> > When I try to start the netscape-binary (netscape 4.5) I only get the
> > message "No such file or directory".
> > Is this a (known) kernel bug?
> > It seems that strace cannot exec the file at all. But it doesn't seem to
> > be a problem of the PATH environement.
> > But why does it say "No such file or directory"?
> >
> Hi,
>
> It looks like you are missing a library file.
> Instead try "ldd ./netscape" it will show you which libs are missing.
>
> Greetings, Eric.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/