I have been using WSL2 for almost a year now and was always able to run windows tools from it without any problems.
Today I have noticed I am unable to do it anymore:
mark@L-R910LPKW:~$ alias npp
alias npp='/mnt/c/Program\ Files/Notepad++/notepad++.exe'
mark@L-R910LPKW:~$ ls -l /mnt/c/Program\ Files/Notepad++/notepad++.exe
-r-xr-xr-x 1 mark mark 6629712 Apr 4 13:58 '/mnt/c/Program Files/Notepad++/notepad++.exe'
mark@L-R910LPKW:~$ npp
-bash: /mnt/c/Program Files/Notepad++/notepad++.exe: cannot execute binary file: Exec format error
mark@L-R910LPKW:~$
And it does not matter which windows tool I am trying to run - it does not run any.
A quick search of the Internet brought me to /proc/sys/fs/binfmt_misc/WSLInterop
, but I cannot create it:
mark@L-R910LPKW:~$ sudo -i
-bash: /mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe: cannot execute binary file: Exec format error
root@L-R910LPKW:~# id
uid=0(root) gid=0(root) groups=0(root)
root@L-R910LPKW:~# echo 1 > /proc/sys/fs/binfmt_misc/WSLInterop
-bash: /proc/sys/fs/binfmt_misc/WSLInterop: Permission denied
root@L-R910LPKW:~#
I think it is an outdated piece of information anyway, because I can see a status
file there and:
root@L-R910LPKW:~# cat /proc/sys/fs/binfmt_misc/status
enabled
root@L-R910LPKW:~#
I think there was some kind of an update to Windows (our work laptops are updated automatically) that broke it.
Finally, my details are:
root@L-R910LPKW:~# uname -a
Linux L-R910LPKW 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
root@L-R910LPKW:~#
Any help is greatly appreciated.