LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-08-2010, 06:17 PM   #1
sllinux
Member
 
Registered: Feb 2009
Posts: 31

Rep: Reputation: 15
Cannot execute a file?


Trying to run an executable, but it's not working for some reason:
Code:
test@olds:~/simulation$ ls -lrt x86/bin/console
-rwxr-xr-x 1 test test 373645 2010-02-12 12:27 x86/bin/console
test@olds:~/simulation$ x86/bin/console
-bash: x86/bin/console: No such file or directory
test@olds:~/simulation$ ./x86/bin/console
-bash: ./x86/bin/console: No such file or directory
test@olds:~/simulation$ cd x86/bin
test@olds:~/simulation/x86/bin$ ls -l console
-rwxr-xr-x 1 test test 373645 2010-02-12 12:27 console
test@olds:~/simulation/x86/bin$ ./console
-bash: ./console: No such file or directory
What's going on here?
 
Old 03-08-2010, 06:19 PM   #2
jamescondron
Member
 
Registered: Jul 2007
Location: Scunthorpe, UK
Distribution: Ubuntu 8.10; Gentoo; Debian Lenny
Posts: 961

Rep: Reputation: 69
Okay, ls spots it, what does the file command do?

Last edited by jamescondron; 03-08-2010 at 06:23 PM. Reason: rm sarky answer, replaced with a less twatish one
 
Old 03-08-2010, 06:22 PM   #3
sllinux
Member
 
Registered: Feb 2009
Posts: 31

Original Poster
Rep: Reputation: 15
If I do "vi x86/bin/console" (from the simulation directory) or "vi console" (from the simulation/x86/bin directory), then it loads the file, so the file exists.
 
Old 03-08-2010, 06:32 PM   #4
sllinux
Member
 
Registered: Feb 2009
Posts: 31

Original Poster
Rep: Reputation: 15
File command returns:
Code:
test@olds:~/simulation$ file x86/bin/console
x86/bin/console: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, not stripped
 
Old 03-08-2010, 06:51 PM   #5
dsmyth
LQ Newbie
 
Registered: Mar 2010
Location: Glasgow, Scotland
Distribution: Fedora 12
Posts: 26
Blog Entries: 6

Rep: Reputation: 17
could it be a command used in the script that is not found?

oh right it's an exe...

Code:
ldd console
will tell you if the console is missing some shared libraries. You might have the library on your machine but the console application is looking for it under a different name.

So the library file might be called libexample.so.1 but the console application is looking for lib.example.1.so or something.

If that is the case then create a symbolic link called lib.example.1.so to libexample.so.1.

Last edited by dsmyth; 03-08-2010 at 06:54 PM.
 
Old 03-08-2010, 06:53 PM   #6
sllinux
Member
 
Registered: Feb 2009
Posts: 31

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by dsmyth View Post
could it be a command used in the script that is not found?
The "console" file is a binary file, so I don't think that would be the case.

I'm wondering if this "console" file is compiled for the wrong machine type, but still... shouldn't it give a better error than "No such file or directory"?
 
Old 03-08-2010, 06:55 PM   #7
dsmyth
LQ Newbie
 
Registered: Mar 2010
Location: Glasgow, Scotland
Distribution: Fedora 12
Posts: 26
Blog Entries: 6

Rep: Reputation: 17
Quote:
Originally Posted by sllinux View Post
The "console" file is a binary file, so I don't think that would be the case.

I'm wondering if this "console" file is compiled for the wrong machine type, but still... shouldn't it give a better error than "No such file or directory"?
Hi, yes I missed the obvious sorry... I've updated the post to include some additional info.
 
Old 03-08-2010, 06:57 PM   #8
sllinux
Member
 
Registered: Feb 2009
Posts: 31

Original Poster
Rep: Reputation: 15
Here is what ldd returned:
Code:
test@olds:~/simulation$ ldd x86/bin/console
    not a dynamic executable
 
Old 03-08-2010, 07:25 PM   #9
dsmyth
LQ Newbie
 
Registered: Mar 2010
Location: Glasgow, Scotland
Distribution: Fedora 12
Posts: 26
Blog Entries: 6

Rep: Reputation: 17
Hi, your idea of the exe being compiled for the wrong architecture is exactly what someone at the link below suggests...

http://forum.xda-developers.com/arch.../t-444338.html

but it seems very specific. Got to admit I'm out my depth here. Sorry and good luck.
 
Old 03-09-2010, 02:35 AM   #10
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
When an executable file is compiled for another arch you will get a very different error, about it being unable to run an illegal instruction. So that shouldn't be the problem.

When dynamic libs are missing you see the given error that you are getting, so, assuming that the file is truly there, and it is not a symlink, and that your fs is not corrupt (funny things like this can happen) then this could be the cause. If ldd doesn't work you should check the documentation or compile it yourself in your machine (this way you ensure everything is in place, otherwise it won't compile).

If those are not possibilities you can always try strace or gdb, they will surely succeed where ldd failed, though they are a bit more complicated to handle.
 
Old 03-09-2010, 02:54 AM   #11
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 675

Rep: Reputation: 136Reputation: 136
What is output of
Code:
readelf -l x86/bin/console
?
 
Old 03-09-2010, 10:00 AM   #12
sllinux
Member
 
Registered: Feb 2009
Posts: 31

Original Poster
Rep: Reputation: 15
Here is the output of readelf:

Code:
test@olds:~/simulation$ readelf -l x86/bin/console

Elf file type is EXEC (Executable file)
Entry point 0x8049520
There are 7 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  PHDR           0x000034 0x08048034 0x08048034 0x000e0 0x000e0 R E 0x4
  INTERP         0x000114 0x08048114 0x08048114 0x00013 0x00013 R   0x1
      [Requesting program interpreter: /lib/ld-linux.so.2]
  LOAD           0x000000 0x08048000 0x08048000 0x1f704 0x1f704 R E 0x1000
  LOAD           0x020000 0x08068000 0x08068000 0x00914 0x05a88 RW  0x1000
  DYNAMIC        0x020014 0x08068014 0x08068014 0x000d0 0x000d0 RW  0x4
  NOTE           0x000128 0x08048128 0x08048128 0x00020 0x00020 R   0x4
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x4

 Section to Segment mapping:
  Segment Sections...
   00
   01     .interp
   02     .interp .note.ABI-tag .hash .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata .eh_frame
   03     .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
   04     .dynamic
   05     .note.ABI-tag
   06
 
Old 03-09-2010, 10:20 AM   #13
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 675

Rep: Reputation: 136Reputation: 136
Quote:
Originally Posted by sllinux View Post
Here is the output of readelf:

Code:
test@olds:~/simulation$ readelf -l x86/bin/console

Elf file type is EXEC (Executable file)
Entry point 0x8049520
There are 7 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  PHDR           0x000034 0x08048034 0x08048034 0x000e0 0x000e0 R E 0x4
  INTERP         0x000114 0x08048114 0x08048114 0x00013 0x00013 R   0x1
      [Requesting program interpreter: /lib/ld-linux.so.2]
  LOAD           0x000000 0x08048000 0x08048000 0x1f704 0x1f704 R E 0x1000
  LOAD           0x020000 0x08068000 0x08068000 0x00914 0x05a88 RW  0x1000
  DYNAMIC        0x020014 0x08068014 0x08068014 0x000d0 0x000d0 RW  0x4
  NOTE           0x000128 0x08048128 0x08048128 0x00020 0x00020 R   0x4
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x4

 Section to Segment mapping:
  Segment Sections...
   00
   01     .interp
   02     .interp .note.ABI-tag .hash .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt .init .plt .text .fini .rodata .eh_frame
   03     .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
   04     .dynamic
   05     .note.ABI-tag
   06
And is it /lib/ld-linux.so.2 on your system ?
 
Old 03-09-2010, 10:31 AM   #14
sllinux
Member
 
Registered: Feb 2009
Posts: 31

Original Poster
Rep: Reputation: 15
That file is not on my system:
Code:
test@olds:~/simulation$ ls -l /lib/ld-linux.so.2
ls: cannot access /lib/ld-linux.so.2: No such file or directory
 
Old 03-09-2010, 10:45 AM   #15
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 675

Rep: Reputation: 136Reputation: 136
Quote:
Originally Posted by sllinux View Post
That file is not on my system:
Code:
test@olds:~/simulation$ ls -l /lib/ld-linux.so.2
ls: cannot access /lib/ld-linux.so.2: No such file or directory
It's looks like you copied executable built on x86 Linux to the x86-64 system without multilib
Is it correct ?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gcc will not execute, responds with 'no such file or directory' and 'no input file' nckeecho Ubuntu 9 07-24-2016 02:04 PM
Execute file Xzibit Linux - Newbie 3 12-21-2009 09:57 AM
File Permission - Read an execute only file e_x_p Linux - Security 1 12-16-2009 08:08 AM
how to execute a script file? Have file/directory not found error sirius57 Linux - Software 2 11-22-2007 12:43 AM
cannot execute binary file on a selfx file brucifer Linux - Software 4 03-21-2006 05:44 AM


All times are GMT -5. The time now is 02:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration