You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
WSL 3.0.1: binfmt cli handler takes precedence over WSLInterop, breaking Windows executable interop #41739
Debian 13 - Though other users have reported the same issue with Ubuntu and Arch as well.
Other Software
Mono
Repro Steps
Setup Debian in WSL
Install Mono apt install mono-complete
Update WSL to 3.0.1
Try to run a Windows binary like notepad.exe
Expected Behavior
The binary should run in Windows via WSLInterop.
Actual Behavior
An error message is printed:
run-detectors: unable to find an interpreter for /mnt/c/WINDOWS/system32/notepad.exe
Diagnostic Logs
No response
Workaround/fix
With the help of Copilot I was able to figure out that a registered binfmt_misc handler matching Windows PE executables (MZ) takes precedence over WSLInterop. In my Debian installation this is the cli handler installed by Mono.
Temporary workaround, disable the "cli" handler with:
sudo update-binfmts --disable cli
Permanent workaround, remove the "cli" handler with (thanks joseaporo):
If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise, please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.
How to collect WSL logs
Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:
The script will output the path of the log file once done.
If this is a networking issue, please use .\collect-wsl-logs.ps1 -LogProfile networking instead, following the instructions in Collect WSL logs for networking issues
Once completed please upload the output files to this GitHub issue.
If you choose to email these logs instead of attaching them to the bug, please send them to [email protected] with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body, and reply with '/emailed-logs'.
mono-runtime 6.8.0.105+dfsg-3.6ubuntu2 (pulls in binfmt-support 2.2.2-7, which registers the cli handler on magic MZ)
Regression window
Interop worked on kernel 6.18.33.2 and broke on the first boot after the auto-update to 3.0.1. Mono and binfmt-support were installed months earlier and unchanged.
Likely cause: #40621 ("protect binfmt_misc from cross-distro wipe at shutdown"). It first shipped in prerelease 2.9.3; comparing tags shows it is in 3.0.1 but not in 2.7.14, so stable users are seeing it for the first time.
Boot journal comparison on the same machine:
Every boot before the update logged this from init, after systemd-binfmt ran: sh: 1: cannot create /proc/sys/fs/binfmt_misc/WSLInterop: Permission denied
Every boot after the update no longer shows that line, and instead shows: systemd-binfmt: Failed to flush binfmt_misc rules, ignoring: Read-only file system
So the old flow appears to have been: systemd flushed the registry, then WSLInterop was registered again last and won. With /status now read-only, the flush fails, WSLInterop is registered early, and binfmt-support.service (ExecStart=update-binfmts --enable) registers cli after it. The most recently registered matching entry wins, so cli intercepts every PE file.
Workaround notes
sudo update-binfmts --disable cli works but does not survive a restart; binfmt-support.service enables cli again on the next boot.
Lasting workaround: sudo update-binfmts --package mono-runtime --remove cli /usr/bin/cli (what the mono-runtime prerm runs on uninstall). A mono-runtime upgrade can register it again.
Any distro with binfmt-support plus a package that registers an MZ handler (mono, wine) is likely affected. WSLInterop should probably keep precedence over distro-registered MZ handlers now that the flush no longer happens.
If you choose to email these logs instead of attaching them to the bug, please send them to [email protected] with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body.
❯ systemctl status systemd-binfmt.service
× systemd-binfmt.service - Set Up Additional Binary Formats
Loaded: loaded (/usr/lib/systemd/system/systemd-binfmt.service; static)
Active: failed (Result: exit-code) since Wed 2026-09-30 22:59:01 CEST; 3s ago
Invocation: d122c0f34f70473997f796388570412f
Docs: man:systemd-binfmt.service(8)
man:binfmt.d(5)
https://docs.kernel.org/admin-guide/binfmt-misc.html
https://systemd.io/API_FILE_SYSTEMS
Process: 1149 ExecStart=/usr/lib/systemd/systemd-binfmt (code=exited, status=1/FAILURE)
Main PID: 1149 (code=exited, status=1/FAILURE)
Mem peak: 4.4M
CPU: 7ms
Sep 30 22:59:01 PC-FISSO systemd[1]: Starting Set Up Additional Binary Formats...
Sep 30 22:59:01 PC-FISSO systemd-binfmt[1149]: Failed to flush binfmt_misc rules, ignoring: Read-only file system
Sep 30 22:59:01 PC-FISSO systemd[1]: systemd-binfmt.service: Main process exited, code=exited, status=1/FAILURE
Sep 30 22:59:01 PC-FISSO systemd[1]: systemd-binfmt.service: Failed with result 'exit-code'.
Sep 30 22:59:01 PC-FISSO systemd[1]: Failed to start Set Up Additional Binary Formats.
WSL info
❯ wsl --version
Versione WSL: 3.0.1.0
Versione kernel: 6.18.40.1-1
Versione WSLg: 1.0.79
Versione MSRDC: 1.2.7214
Versione Direct3D: 1.611.1-81528511
Versione DXCore: 10.0.26100.1-240331-1435.ge-release
Versione di Windows: 10.0.26300.9550
changed the title [-]WSL 3.0.1: Debian binfmt cli handler takes precedence over WSLInterop, breaking Windows executable interop[/-][+]WSL 3.0.1: binfmt cli handler takes precedence over WSLInterop, breaking Windows executable interop[/+]on Oct 1, 2026
If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise, please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.
How to collect WSL logs
Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:
The script will output the path of the log file once done.
If this is a networking issue, please use .\collect-wsl-logs.ps1 -LogProfile networking instead, following the instructions in Collect WSL logs for networking issues
Once completed please upload the output files to this GitHub issue.
If you choose to email these logs instead of attaching them to the bug, please send them to [email protected] with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body, and reply with '/emailed-logs'.
While the fix for binfmt works and I can run now binaries like code to open VSCode from WSL, the systemd status still is flagged as degraded.
Reporting the technical info for you to eventually figure out a solution:
Arch (WSL)
❯ ls /proc/sys/fs/binfmt_misc
CLR register status WSLInterop
❯ cat /proc/sys/fs/binfmt_misc/status
enabled
❯ cat /proc/sys/fs/binfmt_misc/CLR
enabled
interpreter /usr/bin/mono
flags:
offset 0
magic 4d5a
❯ cat /proc/sys/fs/binfmt_misc/WSLInterop
enabled
interpreter /init
flags: PF
offset 0
magic 4d5a
❯ systemctl --failed
UNIT LOAD ACTIVE SUB DESCRIPTION
● systemd-binfmt.service loaded failed failed Set Up Additional Binary Formats
Legend: LOAD → Reflects whether the unit definition was properly loaded.
ACTIVE → The high-level unit activation state, i.e. generalization of SUB.
SUB → The low-level unit activation state, values depend on unit type.
1 loaded units listed.
~ on master
❯ systemctl status systemd-binfmt.service
× systemd-binfmt.service - Set Up Additional Binary Formats
Loaded: loaded (/usr/lib/systemd/system/systemd-binfmt.service; static)
Drop-In: /run/systemd/generator/systemd-binfmt.service.d
└─override.conf
Active: failed (Result: exit-code) since Mon 2026-10-05 23:13:23 CEST; 1min 10s ago
Invocation: 3e86a3c721a74abf8adce2704613004a
Docs: man:systemd-binfmt.service(8)
man:binfmt.d(5)
https://docs.kernel.org/admin-guide/binfmt-misc.html
https://systemd.io/API_FILE_SYSTEMS
Main PID: 151 (code=exited, status=1/FAILURE)
Mem peak: 2.3M
CPU: 12ms
Oct 05 23:13:23 PC-FISSO systemd[1]: Starting Set Up Additional Binary Formats...
Oct 05 23:13:23 PC-FISSO systemd-binfmt[151]: Failed to flush binfmt_misc rules, ignoring: Read-only file system
Oct 05 23:13:23 PC-FISSO systemd[1]: systemd-binfmt.service: Main process exited, code=exited, status=1/FAILURE
Oct 05 23:13:23 PC-FISSO systemd[1]: systemd-binfmt.service: Failed with result 'exit-code'.
Oct 05 23:13:23 PC-FISSO systemd[1]: Failed to start Set Up Additional Binary Formats.
WSL
❯ wsl --version
Versione WSL: 3.0.2.0
Versione kernel: 6.18.40.1-1
Versione WSLg: 1.0.79
Versione MSRDC: 1.2.7391
Versione Direct3D: 1.611.1-81528511
Versione DXCore: 10.0.26100.1-240331-1435.ge-release
Versione di Windows: 10.0.26300.9550
Versione di MSBuild: 1944
Commit: 0dc1bc1f
Tempo di compilazione: 00:19:12 Oct 3 2026
I wonder if the issue is because once you define the binfmt_misc file-system entry point you mark it also as read-only so anything else inside the container can't override it. Wouldn't be much simpler if you define your own custom unit and you make it dependant on systemd-binfmt.service and you register it forcefully on some well-known paths in /var/lib/systemd for eg. so you can generate it as read-only yet systemd picks it up and runs it as a normal unit? Just suggesting ideas as the solution "works" but is not yet in its optimal shape.
Hope this helps, thanks a lot nevertheless for working on it!
Activity
github-actions commentedon Sep 30, 2026
Logs are required for review from WSL team
If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise, please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.
How to collect WSL logs
Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:
The script will output the path of the log file once done.
If this is a networking issue, please use
.\collect-wsl-logs.ps1 -LogProfile networkinginstead, following the instructions in Collect WSL logs for networking issuesOnce completed please upload the output files to this GitHub issue.
See Collect WSL logs (recommended method).
If you choose to email these logs instead of attaching them to the bug, please send them to [email protected] with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body, and reply with '/emailed-logs'.
DavidZidar commentedon Sep 30, 2026
I don't see how logs won't be helpful here, I have described the problem.
joseaporo commentedon Sep 30, 2026
Same issue here, confirming it is not Debian-specific.
Environment
mono-runtime6.8.0.105+dfsg-3.6ubuntu2 (pulls inbinfmt-support2.2.2-7, which registers theclihandler on magicMZ)Regression window
Interop worked on kernel 6.18.33.2 and broke on the first boot after the auto-update to 3.0.1. Mono and binfmt-support were installed months earlier and unchanged.
Likely cause: #40621 ("protect binfmt_misc from cross-distro wipe at shutdown"). It first shipped in prerelease 2.9.3; comparing tags shows it is in 3.0.1 but not in 2.7.14, so stable users are seeing it for the first time.
Boot journal comparison on the same machine:
sh: 1: cannot create /proc/sys/fs/binfmt_misc/WSLInterop: Permission deniedsystemd-binfmt: Failed to flush binfmt_misc rules, ignoring: Read-only file systemSo the old flow appears to have been: systemd flushed the registry, then WSLInterop was registered again last and won. With
/statusnow read-only, the flush fails, WSLInterop is registered early, andbinfmt-support.service(ExecStart=update-binfmts --enable) registerscliafter it. The most recently registered matching entry wins, socliintercepts every PE file.Workaround notes
sudo update-binfmts --disable cliworks but does not survive a restart;binfmt-support.serviceenablescliagain on the next boot.sudo update-binfmts --package mono-runtime --remove cli /usr/bin/cli(what the mono-runtime prerm runs on uninstall). A mono-runtime upgrade can register it again.Any distro with
binfmt-supportplus a package that registers anMZhandler (mono, wine) is likely affected. WSLInterop should probably keep precedence over distro-registeredMZhandlers now that the flush no longer happens.DavidZidar commentedon Sep 30, 2026
Nice analysis, thanks! I can confirm that my workaround did not survive a restart and have updated the issue description.
OneBlue commentedon Sep 30, 2026
/logs
microsoft-github-policy-service commentedon Sep 30, 2026
Hello! Could you please provide more logs to help us better diagnose your issue?
To collect WSL logs, download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:
The script will output the path of the log file once done.
Once completed please upload the output files to this GitHub issue.
See Collect WSL logs (recommended method).
If you choose to email these logs instead of attaching them to the bug, please send them to [email protected] with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body.
Thank you!
joseaporo commentedon Sep 30, 2026
/emailed-logs
julianxhokaxhiu commentedon Sep 30, 2026
Same issue here on Arch
WSL info
[-]WSL 3.0.1: Debian binfmt cli handler takes precedence over WSLInterop, breaking Windows executable interop[/-][+]WSL 3.0.1: binfmt cli handler takes precedence over WSLInterop, breaking Windows executable interop[/+]github-actions commentedon Oct 1, 2026
Logs are required for review from WSL team
If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise, please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.
How to collect WSL logs
Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:
The script will output the path of the log file once done.
If this is a networking issue, please use
.\collect-wsl-logs.ps1 -LogProfile networkinginstead, following the instructions in Collect WSL logs for networking issuesOnce completed please upload the output files to this GitHub issue.
See Collect WSL logs (recommended method).
If you choose to email these logs instead of attaching them to the bug, please send them to [email protected] with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body, and reply with '/emailed-logs'.
DavidZidar commentedon Oct 1, 2026
Logs have been provided by joseaporo. I just updated the issue to make it clear that is is not Debian specific.
julianxhokaxhiu commentedon Oct 5, 2026
Just wanted to let you know that I tested the 3.0.2 prebuilt binary (available here https://dev.azure.com/shine-oss/wsl/_build/results?buildId=390175&view=artifacts&pathAsName=false&type=publishedArtifacts ) and I've found something curious.
While the fix for binfmt works and I can run now binaries like
codeto open VSCode from WSL, the systemd status still is flagged as degraded.Reporting the technical info for you to eventually figure out a solution:
Arch (WSL)
❯ ls /proc/sys/fs/binfmt_misc CLR register status WSLInterop ❯ cat /proc/sys/fs/binfmt_misc/status enabled ❯ cat /proc/sys/fs/binfmt_misc/CLR enabled interpreter /usr/bin/mono flags: offset 0 magic 4d5a ❯ cat /proc/sys/fs/binfmt_misc/WSLInterop enabled interpreter /init flags: PF offset 0 magic 4d5a ❯ systemctl --failed UNIT LOAD ACTIVE SUB DESCRIPTION ● systemd-binfmt.service loaded failed failed Set Up Additional Binary Formats Legend: LOAD → Reflects whether the unit definition was properly loaded. ACTIVE → The high-level unit activation state, i.e. generalization of SUB. SUB → The low-level unit activation state, values depend on unit type. 1 loaded units listed. ~ on master ❯ systemctl status systemd-binfmt.service × systemd-binfmt.service - Set Up Additional Binary Formats Loaded: loaded (/usr/lib/systemd/system/systemd-binfmt.service; static) Drop-In: /run/systemd/generator/systemd-binfmt.service.d └─override.conf Active: failed (Result: exit-code) since Mon 2026-10-05 23:13:23 CEST; 1min 10s ago Invocation: 3e86a3c721a74abf8adce2704613004a Docs: man:systemd-binfmt.service(8) man:binfmt.d(5) https://docs.kernel.org/admin-guide/binfmt-misc.html https://systemd.io/API_FILE_SYSTEMS Main PID: 151 (code=exited, status=1/FAILURE) Mem peak: 2.3M CPU: 12ms Oct 05 23:13:23 PC-FISSO systemd[1]: Starting Set Up Additional Binary Formats... Oct 05 23:13:23 PC-FISSO systemd-binfmt[151]: Failed to flush binfmt_misc rules, ignoring: Read-only file system Oct 05 23:13:23 PC-FISSO systemd[1]: systemd-binfmt.service: Main process exited, code=exited, status=1/FAILURE Oct 05 23:13:23 PC-FISSO systemd[1]: systemd-binfmt.service: Failed with result 'exit-code'. Oct 05 23:13:23 PC-FISSO systemd[1]: Failed to start Set Up Additional Binary Formats.WSL
I wonder if the issue is because once you define the
binfmt_miscfile-system entry point you mark it also as read-only so anything else inside the container can't override it. Wouldn't be much simpler if you define your own custom unit and you make it dependant onsystemd-binfmt.serviceand you register it forcefully on some well-known paths in/var/lib/systemdfor eg. so you can generate it as read-only yet systemd picks it up and runs it as a normal unit? Just suggesting ideas as the solution "works" but is not yet in its optimal shape.Hope this helps, thanks a lot nevertheless for working on it!
OneBlue commentedon Oct 5, 2026
Fixed by 3.0.2
There is a remaining issue causing the binfmt unit to get into a failed state, but let's track that as a separate issue
doctor: KVM001, BIN001 and NET005 from the WSL 3.0.x issues (#121)