-
Notifications
You must be signed in to change notification settings - Fork 822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WSL2 (Preview) cannot run .exe files: exec format error: wsl.exe #8952
Comments
I collected logs while trying to run There's repeating exception trace: |
Disabling ~ $ cat /etc/wsl.conf
[boot]
#systemd = true
[automount]
enabled = true
mountFsTab = true
root = /mnt/
options = "metadata,umask=2,fmask=1,case=off"
[network]
generateHosts = true
generateResolvConf = true
[interop]
enabled = true After ~ $ powershell.exe
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows
PS Microsoft.PowerShell.Core\FileSystem::\\wsl.localhost\Ubuntu\home\blami>
~ $ ls /proc/sys/fs/binfmt_misc
register status WSLInterop Is this some sort of |
That's exactly what it is. Specifically, it's #8843 , and I posted a workaround over in that issue. |
@cerebrate Thanks! Not sure why I did not find that one. Will mark mine as duplicate of it. And thanks for workaround. Did some reading and TIL how |
Environments
DetailsI upgrade to Ubuntu 23.04 today by executing
|
Same problem after upgrade to Ubuntu 23.04.
Shutting down systemd didn't solve the problem Win11 22h2 22621.1413 upd |
Same issue here. /etc/release PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/" Only works when disabling systemd [user]
default=vinicius
[boot]
systemd=false |
The issue is that enabling systemd somehow alters I've re-written the answer here rather than just linking as the original reference thread is getting rather long and has dead links. The solution (from here) is to replace that file. Windows executable files start with the two letters
I;m using the 23.04 image from links in this post |
@the-moog's solution worked! The only extra step I had to add was unmasking the systemd-binfmt service in order to get it working. So to add to his steps. I unmask the service, restart it, then re-mask it to return it back to its previous protected state besides the new modification.
|
just in case if anyone is still facing the issue, try disabling systemd in /etc/wsl.conf in the distro. |
Thanks man! This worked for me! |
Thanks @tardis89
|
Thanks for the solution! |
Thank you so much. It solved my problem. |
For me this helps but it doesn't solve it, because the problem reappears later and I need to run these commands again! |
[like] Brian Kroth (GSL) reacted to your message:
…________________________________
|
Not sure why, but there is no such problem on my side. The mentioned solution fixed it for once and all. |
Works perfectly! Thank you... |
Muchísimas gracias, esos 2 comandos me solucionaron el problema. |
I am getting this error because of minikube. The commands above would fix the problem until I ran minikube again. Are there any other options? |
me too getting the same problem |
My only fix was to stop using Docker Desktop and to manually install docker onto WSL. After that, minikube stopped breaking my command line. |
thanks that worked for me, just had to also restart wsl |
Solutions here didnt work for me. For vscode 😭
The only thing that temporarily fixes the issue for me:
VS code will work for a short period before randomly the error comes back and I have to repeat my steps. Anybody else having this issue or know of a permanent fix? |
In my case, I found out my Docker Desktop wasn't running (: |
For me restarting the distribution was sufficient. @surgiie have you tried it without uninstall vscode server? It should not be related to the problem, as it is Windows interop in general |
Version
Microsoft Windows [Version 10.0.22621.521]
WSL Version
Kernel Version
5.15.62.1-microsoft-standard-WSL2
Distro Version
Ubuntu 22.04
Other Software
systemd 249.11-0ubuntu3.3
WSL version: 0.68.2.0
Kernel version: 5.15.62.1
WSLg version: 1.0.44
MSRDC version: 1.2.3401
Direct3D version: 1.606.4
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.521
Repro Steps
systemd
supportinterop
is not disabledwsl.exe --version
from any shell inside WSL2ls /proc/sys/fs/binfmt_misc/
for presence ofWSLInterop
Expected Behavior
wsl.exe
will exe will execute and output version on terminal/proc/sys/fs/binfmt_misc/
will contain custom binary format for WSL interopActual Behavior
After upgrade to preview version of WSL2 (ver. 0.68.2.0 from Github on non-Insider build) it was possible to run Windows binaries from within WSL2 by simply having them in
PATH
and typingbinary.exe
withsystemd
enabled and disabled.After Windows build 22H2 upgrade this is not longer possible. Shell sees binaries in PATH but its not possible to run them, error message being
exec format error: wsl.exe
. After further inspection I found WSL interop is not registered withbinfmt_misc
:~ $ ls /proc/sys/fs/binfmt_misc/ llvm-15-runtime.binfmt qemu-arm qemu-mips64el qemu-riscv64 register qemu-aarch64 qemu-mips64 qemu-ppc64le qemu-s390x status
After upgrade I noticed Hypervisor Platform was disabled although I am sure I had it enabled before. I reenabled it but it didn't solve the issue.
Diagnostic Logs
The text was updated successfully, but these errors were encountered: