cannot execute binary file

user1473883 picture user1473883 · Aug 2, 2013 · Viewed 25.1k times · Source

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

Answer

Fenn picture Fenn · Mar 24, 2015

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.)