microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.54k stars 823 forks source link

WSL2 uninstall allows distributions to run without WSL management service and therefore WSL plugins are not active #12202

Closed jxy-s closed 1 month ago

jxy-s commented 1 month ago

Windows Version

10.0.22631.4317

WSL Version

0.0.0.0

Are you using WSL 1 or WSL 2?

Kernel Version

5.10.102.1

Distro Version

Ubuntu 22.04

Other Software

No response

Repro Steps

  1. Install WSL using the provided MSI from https://github.com/microsoft/WSL/releases
  2. Install a distribution wsl --install -d Ubuntu
  3. Use the distribution wsl
  4. Uninstall WSL wsl --uninstall
  5. Use the distribution wsl

Note: I am not sure if this is an expected configuration or state for WSL or not. I am unable to find any documentation on this. But overall it seems like undesired behavior at best or a potential security vulnerability or bypass at worst.

Expected Behavior

When WSL2 is active on the machine and WSL plugins are registered with the Windows Subsystem for Linux. Starting virtual machines or distribution containers should result in the WSL plugin being notified of this activity.

Actual Behavior

When WSL is "uninstalled"( wsl --uninstall) the WSL2 virtual machines and containers are still allowed to start despite the WSL Service not being installed and active on the system. This results in WSL plugins not being notified of WSL2 activity on the system.

> wsl --list -v
  NAME      STATE           VERSION
* Ubuntu    Running         2

> sc query WSLService
[SC] EnumQueryServicesStatus:OpenService FAILED 1060:

The specified service does not exist as an installed service.

Another consequence of this state is that certain commands do not result in expected:

> wsl --version
[outputs help text?]

>  wsl --update
Installing: Windows Subsystem for Linux
The system cannot find the file specified.

Diagnostic Logs

No response

github-actions[bot] commented 1 month ago

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](https://github.com/Microsoft/WSL/blob/master/diagnostics/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 script will output the path of the log file once done. If this is a networking issue, please use [collect-networking-logs.ps1](https://github.com/Microsoft/WSL/blob/master/diagnostics/collect-networking-logs.ps1), following the instructions [here](https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#collect-wsl-logs-for-networking-issues) Once completed please upload the output files to this Github issue. [Click here for more info on logging](https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#8-collect-wsl-logs-recommended-method) If you choose to email these logs instead of attaching to the bug, please send them to wsl-gh-logs@microsoft.com 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'.
jxy-s commented 1 month ago

/emailed-logs

github-actions[bot] commented 1 month ago
Diagnostic information ``` Found '/emailed-logs', adding tag 'emailed-logs' ```
benhillis commented 1 month ago

This is by design. If you don't want users to be able to use the inbox version of WSL (which does not support Intune policies) you must set this policy to false.

Allow the Inbox version of the Windows Subsystem for Linux https://learn.microsoft.com/en-us/windows/wsl/intune#recommended-settings