WSL 3.0.3: Docker dev containers no longer open from WSL (spawn EPERM, WindowsApps folder added to PATH)

Open
#42,096 6 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
54/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp, docker, vscode

Research direction

Start by comparing how WSL 3.0.1 and 3.0.3 construct the PATH passed to Windows processes; the report identifies the WSL package folder as the unexpected entry. Reproduce with cmd.exe /c set from Ubuntu and compare it with PowerShell. Done when Windows programs launched from WSL receive the expected PATH and the Dev Containers repro no longer fails with spawn EPERM.

Written by the indexing model from the issue text.

Description

wsl2
Windows Version

Microsoft Windows [Version 10.0.19045.6466]

WSL Version

WSL version: 3.0.3.0

Are you using WSL 1, WSL 2, or WSLC?
  • WSL 2
  • WSL 1
  • WSLC
Kernel Version

No response

Distro Version

Ubuntu 20.04.3 LTS

Other Software
  • WSL: 3.0.3.0 broken, 3.0.1.0 works
  • VS Code 1.108.0, Dev Containers extension 0.469.0, Docker Desktop
Repro Steps

STEPS TO REPRODUCE

  1. Install WSL 3.0.3 (in my case via a Microsoft Store auto-update).
  2. From an Ubuntu shell, run: cmd.exe /c set | grep -i windowsapps
  3. Compare with "cmd /c set" run from PowerShell.
Expected Behavior

The Path seen by Windows processes started from WSL is the same as the user's normal Windows Path, as on 3.0.1, with no WindowsApps WSL package folder added.

Actual Behavior

Since WSL updated itself from 3.0.1 to 3.0.3 through the Microsoft Store, no Docker dev container opens from WSL. VS Code connects to WSL but never attaches to the container, and the Dev Containers extension fails with "Error: spawn EPERM". Every container on the machine fails the same way. Opening the same folder from PowerShell still works, and rolling back to WSL 3.0.1 fixes it.

Cause: on 3.0.3, every Windows program started from WSL gets WSL's own package folder at the front of its PATH:

C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_3.0.3.0_x64__8wekyb3d8bbwe

"code ." passes that PATH to VS Code. The Dev Containers extension then finds wsl.exe in that WindowsApps folder first, and Windows refuses to start a program from WindowsApps directly, so it fails with EPERM. Programs started from PowerShell or Explorer do not get this PATH entry.

To reproduce on 3.0.3:

  1. In Ubuntu, run: cmd.exe /c set | grep -i windowsapps (shows the WSL package folder in Path)
  2. In PowerShell, run: cmd /c set | findstr /i windowsapps (does not show it)
  3. In Ubuntu, run "code ." in any folder with a dev container: it fails with spawn EPERM.
Diagnostic Logs

(I can take more diagnostic logs as needed)

Dominant language
C++
Stars
34.4k
Forks
1.9k
Avg merge
1d 23h
Merged PRs (30d)
166

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/WSL

All issues in microsoft/WSL

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.