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

オープン
#42,224 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
22/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
cpp, linux

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
C++
スター
34.4k
フォーク
1.9k
平均マージ
1日 23時間
マージ済み PR(30日)
166

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/WSL のほかの issue

microsoft/WSL の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。