让 Wine 和 Mono 命令行调用在 Debian 上很好地协同运行吗?

让 Wine 和 Mono 命令行调用在 Debian 上很好地协同运行吗?

我使用的是 Debian 12 (Bookworm)。我已经安装了 Mono(来自https://download.mono-project.com/repo/debian,运行 Duplicati 备份软件)多年。我正在尝试让 Wine 顺利运行。

直接调用 Wine 时,它​​运行良好:wine hello.exe执行正确的操作。但我无法hello.exe直接从命令行运行。

我确实sudo apt install wine-binfmt安装了 Wine 二进制格式处理程序。但仍然:

$ ./hello.exe
Cannot open assembly './hello.exe': File does not contain a valid CIL image.

我认为这是因为我已经为 MS-DOS 注册了两个处理程序(“MZ”可执行文件“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

哦,但是它们都指向run-detectors处理程序,它...将其配置文件存储在 /usr/share/binfmts/ 中...并且我在那里有两个重叠的处理程序:

$ 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

命令cli是 Mono ( readlink -f /usr/bin/cli=> /usr/bin/mono-sgen)。我假设预期的 Mono“二进制文件”cli是打包成看起来像 MS-DOS 二进制文件的 .NET 字节码?我可以安装一些“检测器”来区分 Mono 二进制文件和“常规”MS-DOS 二进制文件,并将一种发送给 Mono,另一种发送给 Wine?

答案1

当前版本/usr/lib/cli/binfmt-detector-cli有一个错误,将大多数 PE32+ 二进制文件归类为“CLR”(即 Mono)。2022 年 5 月之前,分类器有一个错误,所有 PE32+ 二进制文件都被归类为本机。请参阅https://github.com/mono/linux-packaging-mono/pull/38

修复分类器以正确地将 PE32+ 二进制文件分类为 CLR 或不分类,可以解决我的问题(Wine/Mono 堆栈的其余部分和 wine-binfmt 均按预期工作)。

相关内容