On 64-bit Ubuntu 14.04.2 LTS, I can apparently run "x86" exe files, but not "x64" ones.
If I use monodevelop to build the x86 configuration of a project, resulting in x86/test.exe
, I can run it with ./x86/test.exe
, but if I instead build the x64 configuration resulting in ./x86/test.exe
, I cannot run it with ./x64/test.exe
- I get an error:
run-detectors: unable to find an interpreter for ./x64/test.exe
I can run both fine if I prefix the command with mono
(mono ./x64/test.exe
and /usr/bin/cli ./x64/test.exe
both work fine).
I can see that mono is configured to run these kinds of binaries:
$ update-binfmts --display
...
cli (enabled):
package = mono-runtime
type = magic
offset = 0
magic = MZ
mask =
interpreter = /usr/bin/cli
detector = /usr/lib/cli/binfmt-detector-cli
Both of the files appear to begin with MZ
:
$ head ./x86/test.exe
MZ\220^@^C^@^@^@^D^@^@^@\377\377^@^@\270^@...
$ head ./x64/test.exe
MZ\220^@^C^@^@^@^D^@^@^@\377\377^@^@\270^@...
But binfmt-detector-cli fails to detect one of them:
$ /usr/lib/cli/binfmt-detector-cli ./x86/test.exe; echo $?
0
$ /usr/lib/cli/binfmt-detector-cli ./x64/test.exe; echo $?
1
More information about the exe files:
$ file ./x86/test.exe
./x86/test.exe: PE32 executable (console) Intel 80386 Mono/.Net assembly, for MS Windows
$ file ./x64/test.exe
./x64/bin/ShapeSearch.exe: PE32+ executable (console) x86-64 Mono/.Net assembly, for MS Windows
I don't really understand what I'm talking about, unfortunately. I started this investigation by reading Recovering from messed up binfmts configuration, but it's a little bit over my head.