cannot execute binary file

26,318

I ran into the same problem and this is the answer I came up with

$ ~/opt/Linux-3.11.0-i686/svn/bin/svn --version
-bash: /home/fennellb/opt/Linux-3.11.0-i686/svn/bin/svn: cannot execute binary file

$ file ~/opt/Linux-3.11.0-i686/svn/bin/svn
/home/fennellb/opt/Linux-3.11.0-i686/svn/bin/svn: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, BuildID[sha1]=0x6b38ac5ac15af4334712b9bacc6646cabaefde9a, not stripped

$ find /bin /usr/bin -maxdepth 1 -type f -print0 | 
        xargs -0 file | 
        awk 'BEGIN           {c32=0;c64=0} 
             /ELF 64-bit/    {c64++} 
             /ELF 32-bit/    {c32++} 
             END             {print "ELF 32-bit count "c32; 
                              print "ELF 64-bit count "c64}'

ELF 32-bit count 1639
ELF 64-bit count 0

Well... that explains it!

Possible solutions: check to see if your CPU supports 64-bit Linux:

$ cat /proc/cpuinfo  | egrep '^(model name|cpu MH|vend)'
cpu MHz         : 1200.000
model name      : Intel(R) Pentium(R) Dual  CPU  E2140  @ 1.60GHz
vendor_id       : GenuineIntel

(then Google the exact CPU name to find its specifications)

Then upgrade to a 64-bit Linux (if you can) - Download Ubuntu Desktop

One Alternative to run 64-bit code on 32-bit Linux is to use an true cpu emulator like qemu/bochs - Bochs - OSDev Wiki - with a 64-bit Linux image (or VM like xen if your CPU supports it).

Another is to ask your software provider to recompile for 32-bit.

(For me I am going to recompile from source.)

Share:
26,318
user1473883
Author by

user1473883

Updated on July 09, 2022

Comments

  • user1473883
    user1473883 almost 2 years

    I have a binary executable that's a part of an academic software package I've downloaded. I can't seem to get it to run, and I don't have access to the source code. I've tried the following things. Any thoughts?

    Many thanks.

    $ chmod +x random_cell
    $ ./random_cell
    -bash: ./random_cell: cannot execute binary file
    $ file random_cell
    random_cell: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.4, not stripped
    $ ldd random_cell
    random_cell: is not an object file
    $ uname -m
    x86_64
    
  • user1473883
    user1473883 over 10 years
    How do I tell if I'm running a 32 bit operating system? I think I should be on a 64 bit, but I'd be happy to check to be sure.
  • Claudio
    Claudio over 10 years
    Oh.. wait. Now I see you used uname -m and it returned it is indeed a 64bit system: x86_64. Are you sure you set the execute bit on random_cell? Was it owned by your user?
  • user1473883
    user1473883 over 10 years
    I'm reasonably certain I've set the execute bit - $ ls -l random_cell -rwxr-xr-x@ 1 hippo staff 1048235 Jul 24 2012 random_cell
  • Claudio
    Claudio over 10 years
    Hmm. Have you tried executing it starting another shell? Like sh random_cell?
  • Claudio
    Claudio over 10 years
    Oh. You don't have enough reputation yet to go into chat. Try running strace random_cell. It should output a great deal of info, but it will show all system calls happening till the execution finally fails, so we will certainly get come clues.
  • user1473883
    user1473883 over 10 years
    Unfortunately, strace doesn't seem to come with Mac (I'm running os 10.8.4). I did a little google-fu and found that people recommend 'dtruss' on mac; this is what I got : $ sudo dtruss random_cell dtrace: failed to execute random_cell: file is set-id or unreadable [Note: the '-c' option requires a full pathname to the file]
  • Claudio
    Claudio over 10 years
    Hmm.. so you're on a MAC. I supposed you were using Linux. Maybe that's the problem... if this binary is for 64-bit Linux it might not run on MAC (the MAC OS kernel is based on BSD unix, if I'm not mistaken). Well, I might be wrong about how much binary incompatible they are, but you should check that, its probably the reason it doesn't work for you (see on file response: for GNU/Linux 2.6.4).