Executable is not executable

Executable is not executable

Post by Ulrich Hage » Thu, 01 May 2003 16:12:23



Hello guys,

I am having a problem with a executable I made, that the system refuses to, ehm,
execute. And it's not the simple 'execute bit not set'.

I build all my libraries in two versions, static (.a) and dynamic (.so).
The version of my executable that links the .so version works without a glitch.
When I build the statically linked version, the result is as follows:

pluto_hagen% ls -al ./TestProg
-rwxr-xr-x    1 hagen    users    11102630 Apr 29 09:12 ./TestProg

pluto_hagen% file ./TestProg
./TestProg: ELF 64-bit LSB executable, Alpha (unofficial), version 1,
dynamically linked (uses shared libs), not stripped

So far, so good. Looks like TestProg should work.

pluto_hagen% ./TestProg
./TestProg: Command not found.

Oops. Further examination of the executable yields:

pluto_hagen% ldd ./TestProg
/usr/bin/ldd: ./TestProg: No such file or directory

pluto_hagen% strace ./TestProg
execve("./TestProg", ["./TestProg"], [/* 60 vars */]) = 0
strace: exec: No such file or directory

pluto_hagen% gdb ./TestProg
GNU gdb Red Hat Linux (5.2-2)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "alpha-redhat-linux"...
(gdb) run
Starting program: /tmp/TestProg
~hagen/.cshrc: running!
/tmp/TestProg: Command not found.

Program exited with code 01.
You can't do that without a process to debug.
(gdb) quit

pluto_hagen% nm ./TestProg
000000012027b140 r a1
000000012027b148 r a2
0000000120272990 r aa
0000000120301e20 d aatEchoPara
00000001201be590 T abort
0000000000000000 a *ABS*
0000000000000000 a *ABS*
...
lots and lots more symbols, no problem.

So, I am stumped. nm seems to be the only tool that likes my executable. Can
anybody give me a hint how to examine this further? Or even had this problem
before, and solved it?

Any help very much appreciated.

Ulrich

 
 
 

Executable is not executable

Post by Josef M?ller » Thu, 01 May 2003 16:32:39



> Hello guys,

> I am having a problem with a executable I made, that the system refuses to, ehm,
> execute. And it's not the simple 'execute bit not set'.

> I build all my libraries in two versions, static (.a) and dynamic (.so).
> The version of my executable that links the .so version works without a glitch.
> When I build the statically linked version, the result is as follows:

> pluto_hagen% ls -al ./TestProg
> -rwxr-xr-x    1 hagen    users    11102630 Apr 29 09:12 ./TestProg

> pluto_hagen% file ./TestProg
> ./TestProg: ELF 64-bit LSB executable, Alpha (unofficial), version 1,
> dynamically linked (uses shared libs), not stripped

> So far, so good. Looks like TestProg should work.

> pluto_hagen% ./TestProg
> ./TestProg: Command not found.

> Oops. Further examination of the executable yields:

> pluto_hagen% ldd ./TestProg
> /usr/bin/ldd: ./TestProg: No such file or directory

> pluto_hagen% strace ./TestProg
> execve("./TestProg", ["./TestProg"], [/* 60 vars */]) = 0
> strace: exec: No such file or directory

I've seen the very same problem and IIRC it happened due to a missing
version of libc.
I solved it through re-building the application.

--
Josef M?llers (Pinguinpfleger bei FSC)
        If failure had no penalty success would not be a prize
                                                -- T.  Pratchett

 
 
 

Executable is not executable

Post by Erik Max Franci » Thu, 01 May 2003 17:15:32



> So, I am stumped. nm seems to be the only tool that likes my
> executable. Can
> anybody give me a hint how to examine this further? Or even had this
> problem
> before, and solved it?

This means that the executable is relying on an absolutely fundamental
library like the dynamic library loader itself and is unable to find it.
Probably the executable was built/targeted at an older system with, say,
ld-linux.so.1, and your new system only has ld-linux.so.2 and so is
refusing to even pretend it's an executable.

Unfortunately, the only robust solution I'm familiar with is rebuilding
the executable (or getting an updated version from whatever source).

--

 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ Once the people begin to reason, all is lost.
\__/ Voltaire
    Bosskey.net: Quake III Arena / http://www.bosskey.net/q3a/
 A personal guide to Quake III Arena.

 
 
 

Executable is not executable

Post by M?ns Rullg? » Thu, 01 May 2003 17:11:08



> I am having a problem with a executable I made, that the system
> refuses to, ehm, execute. And it's not the simple 'execute bit not
> set'.

> I build all my libraries in two versions, static (.a) and dynamic
> (.so).  The version of my executable that links the .so version
> works without a glitch.  When I build the statically linked version,
> the result is as follows:

> pluto_hagen% ls -al ./TestProg
> -rwxr-xr-x    1 hagen    users    11102630 Apr 29 09:12 ./TestProg

> pluto_hagen% file ./TestProg
> ./TestProg: ELF 64-bit LSB executable, Alpha (unofficial), version 1,
> dynamically linked (uses shared libs), not stripped

> So far, so good. Looks like TestProg should work.

> pluto_hagen% ./TestProg
> ./TestProg: Command not found.

It looks like the dynamic linker specified in the executable doesn't
exist.  Did you compile it on the same machine you're trying to run it
on?  Try the command "/lib/ld-linux.so.2 --list ./TestProg" and look
for a line similar to

        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x0000020001000000)

--
M?ns Rullg?rd

 
 
 

Executable is not executable

Post by Ulrich Hage » Thu, 01 May 2003 19:40:49


On Wed, 30 Apr 2003 09:32:39 +0200, Josef M?llers


>I've seen the very same problem and IIRC it happened due to a missing
>version of libc.
>I solved it through re-building the application.

I have rebuilt the application lots of times. But no matter how I change the
link statement, result is always the same.

Thanks anyway,

Ulrich

 
 
 

Executable is not executable

Post by Ulrich Hage » Thu, 01 May 2003 19:50:27



Quote:>It looks like the dynamic linker specified in the executable doesn't
>exist.  Did you compile it on the same machine you're trying to run it
>on?  Try the command "/lib/ld-linux.so.2 --list ./TestProg" and look
>for a line similar to

>        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x0000020001000000)

OK, tried this:

pluto_hagen% /lib/ld-linux.so.2 --list ./TestProg
        libACE.so.5.3.0 => /home/hagen/n5/alpha/prod/bin/libACE.so.5.3.0
(0x0000020000002000)
        libdl.so.2.1 => /lib/libdl.so.2.1 (0x0000020000242000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x0000020000256000)
        /usr/lib/ld.so => /lib/ld-linux.so.2 (0x0000020001000000)
        librt.so.1 => /lib/librt.so.1 (0x0000020000286000)
        libstdc++.so.5 => /home/hagen/bin/gcc32/lib/libstdc++.so.5
(0x00000200002b0000)
        libm.so.6.1 => /lib/libm.so.6.1 (0x00000200003be000)
        libgcc_s.so.1 => /home/hagen/bin/gcc32/lib/libgcc_s.so.1
(0x0000020000454000)
        libc.so.6.1 => /lib/libc.so.6.1 (0x000002000046e000)
pluto_hagen%

I have looked up all these libraries, they are all there.
One thing is interesting though: While this executable references
'/usr/lib/ld.so', the (working) dynamically linked version has

        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x0000020001000000)

instead. They both point to the same thing, though.
Would it be worth investigating this further?

Thanks,

Ulrich

 
 
 

Executable is not executable

Post by Ulrich Hage » Thu, 01 May 2003 19:52:57




Quote:>This means that the executable is relying on an absolutely fundamental
>library like the dynamic library loader itself and is unable to find it.
>Probably the executable was built/targeted at an older system with, say,
>ld-linux.so.1, and your new system only has ld-linux.so.2 and so is
>refusing to even pretend it's an executable.

No, I have built this application on the very same workstation I want to
run it on.

Quote:>Unfortunately, the only robust solution I'm familiar with is rebuilding
>the executable (or getting an updated version from whatever source).

I have rebuilt it several times, after tweaking the link statement. No
luck.

Thanks,

Ulrich

 
 
 

Executable is not executable

Post by AndrĂ© P?nit » Thu, 01 May 2003 20:23:24



> I am having a problem with a executable I made, that the system refuses
> to, ehm, execute. And it's not the simple 'execute bit not set'.
> [...]

Maybe your executable is on a partition mounted with  -o noexec?

Andre'

--
Those who desire to give up Freedom in order to gain Security, will not have,
nor do they deserve, either one.     (T. Jefferson or B. Franklin or both...)

 
 
 

Executable is not executable

Post by M?ns Rullg? » Fri, 02 May 2003 02:09:23



> >It looks like the dynamic linker specified in the executable doesn't
> >exist.  Did you compile it on the same machine you're trying to run it
> >on?  Try the command "/lib/ld-linux.so.2 --list ./TestProg" and look
> >for a line similar to

> >        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x0000020001000000)

> OK, tried this:

> pluto_hagen% /lib/ld-linux.so.2 --list ./TestProg
>    /usr/lib/ld.so => /lib/ld-linux.so.2 (0x0000020001000000)

> I have looked up all these libraries, they are all there.

If they were not, they would be reported as "not found".

Quote:> One thing is interesting though: While this executable references
> '/usr/lib/ld.so', the (working) dynamically linked version has

>    /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x0000020001000000)

> instead. They both point to the same thing, though.
> Would it be worth investigating this further?

The executable is has /usr/lib/ld.so hard coded, but /lib/ld-linux.so.2
apparently prints itself instead, since it is equivalent.  Make a
symlink from /lib/ld-linux.so.2 to /usr/lib/ld.so.  The real solution
is to fix the compiler/linker to code the right name into executables.

--
M?ns Rullg?rd

 
 
 

Executable is not executable

Post by Ulf-Rainer Tiet » Fri, 02 May 2003 05:51:09



> Hello guys,

> I am having a problem with a executable I made, that the system refuses
> to, ehm, execute. And it's not the simple 'execute bit not set'.

> I build all my libraries in two versions, static (.a) and dynamic (.so).
> The version of my executable that links the .so version works without a
> glitch. When I build the statically linked version, the result is as
> follows:

> pluto_hagen% ls -al ./TestProg
> -rwxr-xr-x    1 hagen    users    11102630 Apr 29 09:12 ./TestProg

> pluto_hagen% file ./TestProg
> ./TestProg: ELF 64-bit LSB executable, Alpha (unofficial), version 1,
> dynamically linked (uses shared libs), not stripped

> So far, so good. Looks like TestProg should work.

> pluto_hagen% ./TestProg
> ./TestProg: Command not found.

> Oops. Further examination of the executable yields:

> pluto_hagen% ldd ./TestProg
> /usr/bin/ldd: ./TestProg: No such file or directory

> pluto_hagen% strace ./TestProg
> execve("./TestProg", ["./TestProg"], [/* 60 vars */]) = 0
> strace: exec: No such file or directory

> pluto_hagen% gdb ./TestProg
> GNU gdb Red Hat Linux (5.2-2)
> Copyright 2002 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you
> are welcome to change it and/or distribute copies of it under certain
> conditions. Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for
> details. This GDB was configured as "alpha-redhat-linux"...
> (gdb) run
> Starting program: /tmp/TestProg
> ~hagen/.cshrc: running!
> /tmp/TestProg: Command not found.

> Program exited with code 01.
> You can't do that without a process to debug.
> (gdb) quit

> pluto_hagen% nm ./TestProg
> 000000012027b140 r a1
> 000000012027b148 r a2
> 0000000120272990 r aa
> 0000000120301e20 d aatEchoPara
> 00000001201be590 T abort
> 0000000000000000 a *ABS*
> 0000000000000000 a *ABS*
> ...
> lots and lots more symbols, no problem.

> So, I am stumped. nm seems to be the only tool that likes my executable.
> Can anybody give me a hint how to examine this further? Or even had this
> problem before, and solved it?

> Any help very much appreciated.

> Ulrich

Are any libs in /usr/lib different to /lib ?
Is there any subdirectories in /lib with libraries ?
maybe libc or some other differs between runtime and compile time linking
ulf
 
 
 

Executable is not executable

Post by Pete Zaitc » Fri, 02 May 2003 07:47:17



> When I build the statically linked version, the result is as follows:
> pluto_hagen% file ./TestProg
> ./TestProg: ELF 64-bit LSB executable, Alpha (unofficial), version 1,
> dynamically linked (uses shared libs), not stripped

So, is it static of dynamic after all? Check your ld
command line with gcc -v.

-- Pete

 
 
 

Executable is not executable

Post by Craig Bergre » Sat, 03 May 2003 13:55:14



> Hello guys,

> I am having a problem with a executable I made, that the system refuses to, ehm,
> execute. And it's not the simple 'execute bit not set'.

> I build all my libraries in two versions, static (.a) and dynamic (.so).
> The version of my executable that links the .so version works without a glitch.
> When I build the statically linked version, the result is as follows:

> pluto_hagen% ls -al ./TestProg
> -rwxr-xr-x    1 hagen    users    11102630 Apr 29 09:12 ./TestProg

> pluto_hagen% file ./TestProg
> ./TestProg: ELF 64-bit LSB executable, Alpha (unofficial), version 1,
> dynamically linked (uses shared libs), not stripped

> So far, so good. Looks like TestProg should work.

> pluto_hagen% ./TestProg
> ./TestProg: Command not found.

> Oops. Further examination of the executable yields:

> pluto_hagen% ldd ./TestProg
> /usr/bin/ldd: ./TestProg: No such file or directory

> pluto_hagen% strace ./TestProg
> execve("./TestProg", ["./TestProg"], [/* 60 vars */]) = 0
> strace: exec: No such file or directory

> pluto_hagen% gdb ./TestProg
> GNU gdb Red Hat Linux (5.2-2)
> Copyright 2002 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for details.
> This GDB was configured as "alpha-redhat-linux"...
> (gdb) run
> Starting program: /tmp/TestProg
> ~hagen/.cshrc: running!
> /tmp/TestProg: Command not found.

> Program exited with code 01.
> You can't do that without a process to debug.
> (gdb) quit

> pluto_hagen% nm ./TestProg
> 000000012027b140 r a1
> 000000012027b148 r a2
> 0000000120272990 r aa
> 0000000120301e20 d aatEchoPara
> 00000001201be590 T abort
> 0000000000000000 a *ABS*
> 0000000000000000 a *ABS*
> ...
> lots and lots more symbols, no problem.

> So, I am stumped. nm seems to be the only tool that likes my executable. Can
> anybody give me a hint how to examine this further? Or even had this problem
> before, and solved it?

> Any help very much appreciated.

> Ulrich

Try ldconfig
 
 
 

Executable is not executable

Post by Ulrich Hage » Sat, 03 May 2003 17:15:28




Quote:>The executable is has /usr/lib/ld.so hard coded, but /lib/ld-linux.so.2
>apparently prints itself instead, since it is equivalent.  Make a
>symlink from /lib/ld-linux.so.2 to /usr/lib/ld.so.

Ahhh, thank you very much, that helped! Now the system acknowledges that
I do have an executable here. Unfortunately, it (the program, not the
system) crashes immediately, but now I have chance to debug it.

Quote:>The real solution
>is to fix the compiler/linker to code the right name into executables.

Hmm, yes. I think I will install the latest version of gcc (and possibly
binutils), and if I can reproduce the behaviour, I will tell GNATS about
it.

Thanks again,

Ulrich

 
 
 

Executable is not executable

Post by Sybren Stuve » Mon, 05 May 2003 22:56:31


Ulrich Hagen enlightened us with:

Quote:> Starting program: /tmp/TestProg
> ~hagen/.cshrc: running!
> /tmp/TestProg: Command not found.

Perhaps you are not allowed to run programs from /tmp?

Sybren
--
| Somebody ought to cross ball point pens with coat hangers so that |
| the pens will multiply instead of disappear.                      |
\-------------------------------------------------------------------/
If you have to use Outlook, fix it: http://jump.to/oe-quotefix

 
 
 

1. Loading an executable from within an executable

Hi,
    I am trying to port a program I wrote on an IBM AIX operating system
to a linux system, and I have a bit of a problem I have yet to find a
solution to.  In this program, I use an AIX Base Operating System subroutine
called load to load an executable program into memory.  This load subroutine
effectively invokes the linker/loader and brings the program into the
data memory space of the current process, returning a pointer to the
beginning of the program text area (more or less).  This lets one then
examine the loaded program image in memory, etc.

    The problem I am having is that I cannot find a similar facility within
linux, and I'm getting a bit stumped as to how one might be able to do this.
So, the question: is anyone familiar with a facility, etc. that allows one
executing process to load an executable program into memory, _AND_ to
automatically resolve the relocatable linkages in the file, etc. as if the
program were loaded by the loader for execution?  If not, can anyone tell
me any way to even load an executable program image into memory that would
even approximate this?

        Thanks for any pointers,

                J-D

--
J-D Wellman   IMB Research  :  wellman at watson <dot> ibm <dot> com
--
------------------------------------------------------------------------------

IBM T. J. Watson Research Center                phone: 914-945-2523
P.O. Box 218, Yorktown Hts, NY, 10598           fax:   914-945-4469

2. Linux and External Print Servers

3. Executable Binary File vs. Executable Script File

4. Installing stuff from CD

5. /usr/sbin/pppd does not exist or is not executable

6. Help: SXTs

7. gdb: core file not in executable format: File format not recognized

8. problem with /etc/ldsysdump on SCO-ODT system

9. /bsd is executable or not (to chmod or not)?

10. libc_psr.so.1 not in executable format, using GDB under Solaris?

11. script not executable

12. Executable not downloded correctly

13. Apparent hard disk lockup during boot / executable not seen