Skip to content
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

Disabling interop via /proc/sys/fs/binfmt_misc/WSLInterop does not work #11471

Closed
1 of 2 tasks
debuglevel opened this issue Apr 16, 2024 · 5 comments
Closed
1 of 2 tasks
Labels

Comments

@debuglevel
Copy link

debuglevel commented Apr 16, 2024

Windows Version

Microsoft Windows [Version 10.0.19045.4291]

WSL Version

2.1.5.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.146.1-2

Distro Version

Ubuntu 22.04

Other Software

No response

Repro Steps

  1. echo 0 | sudo tee /proc/sys/fs/binfmt_misc/WSLInterop
  2. cat /proc/sys/fs/binfmt_misc/WSLInterop to ensure it is disabled.
  3. python3.exe --version

Expected Behavior

Should not work.

Actual Behavior

Works.

Diagnostic Logs

No response

@debuglevel
Copy link
Author

The way described in #8932 works however.

Copy link

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:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging
If you choose to email these logs instead of attaching to the bug, please send them to [email protected] with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

View similar issues

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@firejox
Copy link

firejox commented Apr 16, 2024

Check the files in /proc/sys/fs/binfmt_misc/ and make sure none of them is similar to /proc/sys/fs/binfmt_misc/WSLInterop.

@zcobol
Copy link

zcobol commented Apr 16, 2024

@debuglevel there are two WSLInterop files in /proc/sys/fs/binfmt_misc. Disable in WSLInterop and WSLInterop-late

root@eleven:~# echo 0 | tee /proc/sys/fs/binfmt_misc/WSLInterop
0
root@eleven:~# cat /proc/sys/fs/binfmt_misc/WSLInterop
disabled
interpreter /init
flags: PF
offset 0
magic 4d5a
root@eleven:~# python3.exe --version
Python 3.12.3
root@eleven:~# echo 0 | tee /proc/sys/fs/binfmt_misc/WSLInterop-late
0
root@eleven:~# cat /proc/sys/fs/binfmt_misc/WSLInterop-late
disabled
interpreter /init
flags: P
offset 0
magic 4d5a
root@eleven:~# python3.exe --version
/mnt/c/Users/valli/AppData/Local/Microsoft/WindowsApps/python3.exe: line 1: MZ: command not found

@OneBlue
Copy link
Collaborator

OneBlue commented Apr 16, 2024

zcobol's answer is correct. When systemd is enabled, WSL creates two binfmt_misc entries. The supported way of disabling interop is via wsl.conf though:

[interop]
enabled=false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants