+
Skip to content

[WSL2][systemd][interop] Unable to Execute Windows Binary when systemd enabled #8843

@thelastlin

Description

@thelastlin

Version

0.67.6.0

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

Linux version 5.15.62.1-microsoft-standard-WSL2 (oe-user@oe-host) (x86_64-msft-linux-gcc (GCC) 9.3.0, GNU ld (GNU Binutils) 2.34.0.20200220) #1 SMP Wed Aug 24 22:24:20 UTC 2022

Distro Version

Ubuntu 22.04

Other Software

No response

Repro Steps

  1. Edit /etc/wsl.conf, enable systemd support. (https://devblogs.microsoft.com/commandline/systemd-support-is-now-available-in-wsl/)
  2. Run wsl.exe --shutdown in wsl2 shell, and reopen the shell.
  3. Run wsl.exe --version or some other PE binaries, and shell will warn you that the "exec format error" or "MZ: not found"

Expected Behavior

Able to execute any valid PE binaries.

Actual Behavior

"exec format error" or "MZ: not found"

Diagnostic Logs

$ execve("/mnt/c/WINDOWS/system32/calc.exe", ["calc.exe"], 0x7ffc12cdd038 /* 37 vars */) = -1 ENOEXEC (Exec format error)
strace: exec: Exec format error
+++ exited with 1 +++
$ echo $WSL_INTEROP
/run/WSL/410_interop

$ ll /run/WSL
total 0
drwxrwxrwx  2 root root 100  9月 22 12:29 ./
drwxr-xr-x 26 root root 760  9月 22 12:29 ../
srwxrwxrwx  1 root root   0  9月 22 12:29 2_interop=
srwxrwxrwx  1 root root   0  9月 22 12:29 410_interop=
srwxrwxrwx  1 root root   0  9月 22 12:29 549_interop=

$ ll /proc/sys/fs/binfmt_misc/
total 0
drwxr-xr-x 2 root root 0  9月 22 12:29 ./
dr-xr-xr-x 1 root root 0  9月 22 12:29 ../
-rw-r--r-- 1 root root 0  9月 22 12:29 llvm-12-runtime.binfmt
-rw-r--r-- 1 root root 0  9月 22 12:29 llvm-14-runtime.binfmt
-rw-r--r-- 1 root root 0  9月 22 12:29 python2.7
-rw-r--r-- 1 root root 0  9月 22 12:29 python3.10
--w------- 1 root root 0  9月 22 12:29 register
-rw-r--r-- 1 root root 0  9月 22 12:29 status
$cat /proc/sys/fs/binfmt_misc/WSLInterop
cat: /proc/sys/fs/binfmt_misc/WSLInterop: No such file or directory

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载