Click to See Complete Forum and Search --> : cannot execute binary file


Sepero
11-03-2006, 05:42 AM
How I solved it:# gpg
bash: /usr/bin/gpg: cannot execute binary file
# apt-get install gnupg --reinstall

In 4 1/2 years of using Linux, I've never gotten the "cannot execute binary file" error before now. I think it's a _terrible_ error message. ("bad binary" would have made much more sense to me)

Also, since I left Microsoft, this is the first time that a program reinstall has ever solved a problem for me.

je_fro
11-03-2006, 09:41 AM
what does

file /usr/bin/gpg

and

ldd /usr/bin/gpg

return?

xrx
11-03-2006, 11:57 AM
I'm guessing its a bit too late for those commands now :)

voidinit
11-04-2006, 06:03 AM
Actually, the ldd /path/to/binary will probably tell quite a bit.

I've seen this error message several times, and every single time I've seen it the problem has been a 32 binary on a 64 bit system without kernel support for executing said 32-bit binary. Or it has been the opposite, a 64 bit cross-compiled binary on a 32-bit system. For instance when someone --nodeps and --forces an .rpm that is clearly for x86_64 on an i686 system.

As an aside, its certainly possible to create an x86_64 binary on a i686 system if gcc was compiled as a cross-compiler (and vice-verca).

If your running an x86 multilib system and ldd shows that the binary is linked to 32-bit libraries, then you may need to enable 32-bit elf binary emulation (or a.out binary emulation) in your kernel.