I'm on Debian 12 (Bookworm). I have had Mono installed (from https://download.mono-project.com/repo/debian, to run Duplicati backup software) for years. I'm trying to get Wine working smoothly.
Wine works well enough when invoked directly: wine hello.exe
does the right thing. But I can't run hello.exe
directly from the command line.
I did sudo apt install wine-binfmt
to get the Wine binary-format handlers installed. But still:
$ ./hello.exe
Cannot open assembly './hello.exe': File does not contain a valid CIL image.
I think that's because I've got two handlers registered for MS-DOS ("MZ" executables "4d5a"):
$ cat /proc/sys/fs/binfmt_misc/cli
enabled
interpreter /usr/lib/binfmt-support/run-detectors
flags:
offset 0
magic 4d5a
$ cat /proc/sys/fs/binfmt_misc/wine
enabled
interpreter /usr/lib/binfmt-support/run-detectors
flags:
offset 0
magic 4d5a
Oh, but they both point to run-detectors
as the handler, which ... stores its config files in /usr/share/binfmts/ ... and I've got two overlapping handlers in there:
$ cat /usr/share/binfmts/cli
package mono-runtime
detector /usr/lib/cli/binfmt-detector-cli
interpreter /usr/bin/cli
magic MZ
$ cat /usr/share/binfmts/wine
package wine
interpreter /usr/bin/wine
magic MZ
The cli
command is Mono (readlink -f /usr/bin/cli
=> /usr/bin/mono-sgen
). I assume the Mono "binaries" that cli
expects are .NET bytecode packaged to look like an MS-DOS binary? Is there some "detector" I can install that disambiguates a Mono binary from a "regular" MS-DOS binary and sends one kind to Mono and one kind to Wine?