WSL2: every process launch fails with Wsl/Service/RPC_S_SYSTEM_HANDLE_TYPE_MISMATCH (0x8007072c) on 26300.9711/.9818, AMD; WSL1 works

Aperta
#42,224 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
22/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
cpp, linux

Direzione di ricerca

Start with the WSL service events and collect-wsl-logs.ps1 trace attached to the report, then follow the WSL2 CreateLxProcess result unmarshalling for the five sh_socket handles. Compare that path with WSL1’s sh_file handles and the related report in #42077. The failure is reproduced by importing the Alpine 3.24 minirootfs and running wsl -d wsltest -- echo hi; done means WSL2 prints hi successfully.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

emailed-logs wsl2
Windows Version

Microsoft Windows [Version 10.0.26300.9818] (Windows 11 Enterprise 26H2, after KB5127936). Also reproduced on 10.0.26300.9711 (KB5127648).

WSL Version

3.0.5.0 (kernel 6.18.58.1-1). Also reproduced on 3.0.3.0 (kernel 6.18.54.1-1).

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

6.18.58.1-microsoft-standard-WSL2

Distro Version

Any: Ubuntu 22.04, Ubuntu 24.04, Ubuntu 26.04, and a plain Alpine 3.24 minirootfs imported with wsl --import. wsl --system fails the same way.

Other Software

AMD Ryzen 7 7800X3D, NVIDIA RTX 4080 SUPER (driver 621.01). VirtualMachinePlatform + Microsoft-Windows-Subsystem-Linux enabled; full Hyper-V not installed. VBS running with Credential Guard only (HVCI off).

Third-party software has been ruled out: the error persists after uninstalling Huorong, VMware Workstation and AlibabaProtect, and also in a clean boot with all 37 non-Microsoft services, 8 non-hardware third-party kernel drivers (NetFilter SDK xfilter, Xunlei XLWFP, etc.) and all startup apps disabled. The 64-bit Winsock catalog contains only Microsoft providers (no LSP). sfc /scannow and DISM /RestoreHealth report no problems.

Repro Steps
  1. wsl --import wsltest C:\wsltest alpine-minirootfs-3.24.4-x86_64.tar.gz --version 2
  2. wsl -d wsltest -- echo hi
Expected Behavior

hi is printed.

Actual Behavior
The RPC call contains a handle that differs from the declared handle type.
Error code: Wsl/Service/RPC_S_SYSTEM_HANDLE_TYPE_MISMATCH

wsl.exe exits with -1. Every command that starts a Linux process fails this way: default shell, wsl -u root, first-run OOBE (which then reports "failed to read passwd database"), wsl --system and wsl --debug-shell. It makes no difference whether wsl.exe runs in Windows Terminal, conhost, with pipes or file redirection, with a clean environment, or elevated.

Things that still work: wsl --status, wsl -l -v, wsl --version, wsl --shutdown, wsl --import, wsl --unregister and wsl --manage ... --set-sparse.

The same distro works under WSL1. After wsl --set-version wsltest 1, wsl -d wsltest -- sh -c 'echo hi; uname -r' prints hi and 4.4.0-26100-Microsoft. Converting it back to WSL2 brings the error back.

Turning off optional features in .wslconfig changes nothing. I tried guiApplications=false, networkingMode=none, dnsTunneling=false, autoProxy=false, firewall=false, nestedVirtualization=false and safeMode=true.

What the trace shows (from collect-wsl-logs.ps1, Microsoft.Windows.Lxss.Manager events):

  • The utility VM boots and mini_init runs.
  • LxMiniInitMessageCreateInstanceResult returns Result = 0.
  • LxInitMessageInitializeResponse reports the distro (alpine 3.24.4).
  • LxInitMessageCreateSession and then LxInitMessageCreateProcessUtilityVm both succeed (the latter returns a port).
  • wslservice logs no error after that. wsl.exe then fails with 0x8007072c.

So the guest side and wslservice both appear to succeed. The failure seems to happen when the result of ILxssUserSession::CreateLxProcess is unmarshalled back into wsl.exe. On the WSL2 path that result carries five [out, system_handle(sh_socket)] hvsocket handles: StandardIn, StandardOut, StandardErr, CommunicationChannel and InteropSocket. On WSL1 the out handles are sh_file instead, which would explain why WSL1 works. Downgrading WSL won't help, because every 2.5.8+ / 2.6 / 2.7 / 3.0 release uses the same sh_socket marshalling.

An AF_HYPERV socket created in a normal user process on this machine looks correct: File object on \Device\Afd, XP1_IFS_HANDLES set, SIO_BASE_HANDLE returns the same handle, and the provider is the Microsoft "Hyper-V RAW" entry.

Possibly related: this machine was also affected by the AMD HcsGetServiceProperties("ProcessorCapabilities") -> ERROR_INVALID_DATA regression (#41917). That warning is gone after KB5127936 (26300.9818), but the RPC_S_SYSTEM_HANDLE_TYPE_MISMATCH error is not. The only other report of this error I could find is #42077, which was closed without logs.

Diagnostic Logs

Logs collected with collect-wsl-logs.ps1 while reproducing wsl -d wsltest -- echo hi. I will email them to [email protected] with this issue number in the subject.

Lingua principale
C++
Stelle
34.4k
Fork
1.9k
Merge medio
1g 23h
PR unite (30g)
166

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/WSL

Tutte le issue di microsoft/WSL

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.