Skip to content

fix(runners): pin Windows WSL to 2.4.13 and make WSL provisioning non-hanging - #1124

Merged
shashank-boyapally merged 4 commits into
runfinch:mainfrom
shashank-boyapally:fix/windows-runner-pin-wsl-2.4.13
Sep 10, 2026
Merged

shashank-boyapally merged 4 commits into
runfinch:mainfrom
shashank-boyapally:fix/windows-runner-pin-wsl-2.4.13

Conversation

@shashank-boyapally

Copy link
Copy Markdown
Contributor

Problem

Windows finch e2e (finch vm init) fails at disk attach with:

could not attach persistent disk: ... This operation is only supported by WSL2.
Error code: Wsl/Service/AttachDisk/WSL_E_WSL2_NEEDED

Two root causes, both traced on live runners:

  1. WSL version drift. WSL ships as a Microsoft Store app; the Store auto-updated it from the pinned 2.4.13 / kernel 5.15.167.4 (last CI-green) to 2.7.13 / kernel 6.18.33.2 — the kernel that regresses the finch disk-attach e2e. The prior MSI-only pin didn't survive Store updates.
  2. startup.ps1 hang + missing distro. Installing the pinned 2.4.13 MSI right after removing the newer Store Appx blocks on the Windows Installer lock indefinitely (Start-Process -Wait never returns), stranding the instance in Standby. Because that step hung, the subsequent wsl --install Ubuntu never ran — so no WSL2 distro was ever registered, and wsl --mount --bare --vhd (how finch attaches its disk, pkg/disk/disk_windows.go) fails with WSL_E_WSL2_NEEDED since the WSL2 utility VM only exists when a distro is present. VirtualMachinePlatform was enabled and the hypervisor present — the platform was fine; only the version + distro were wrong.

Fix (scripts/windows-runner-user-data.yaml)

  • First-boot: disable Microsoft Store auto-updates (WindowsStore\AutoDownload = 2) so the WSL pin holds.
  • Boot-time startup.ps1:
    • Remove any non-2.4.13 WSL Store Appx (+ deprovision), then install the pinned 2.4.13 MSI with a 600s timeout + kill + retry (3×) instead of an unbounded -Wait, so it can never hang and strand the runner. (Download left unbounded — a slow-but-completing download shouldn't be interrupted.)
    • wsl --set-default-version 2.
    • Install the Ubuntu WSL2 distro (--no-launch, headless) before Exit-ASStandby and verify via the per-user Lxss registry key. startup.ps1 runs as Administrator — the same account finch e2e runs under — so the distro registers for the right user.
    • Log wsl --version and Write-Error on any mismatch/failure so drift is visible in StartupScript.log / CloudWatch instead of silently failing e2e.

Rollout

Existing runners are drifted and must be recycled to pick up this user-data; new instances then self-provision (pinned WSL 2.4.13 + Ubuntu distro + working WSL2).

Testing

npm run build + unit tests pass; YAML validated. On-box behavior (kill+retry recovery, WSL 2.4.13 pin) was reproduced manually on the affected runners. Note: the headless wsl --install -d Ubuntu --no-launch being sufficient for wsl --mount is verified by the added registry check + wsl --version logging on first re-provisioned runner.

…date drift

Windows finch e2e fails at 'finch vm init' with
"could not attach persistent disk: ... WSL_E_WSL2_NEEDED" because the runners
drifted from the pinned WSL 2.4.13 / kernel 5.15.167.4 onto WSL 2.7.13 /
kernel 6.18.33.2 - the kernel that regresses the finch disk-attach e2e.

WSL ships as a Microsoft Store app, and the Store auto-updated it past the
2.4.13 MSI pin (verified on a live runner: Get-AppxPackage reported
2.7.13.0, wsl --version reported kernel 6.18.33.2). VirtualMachinePlatform
was enabled and the hypervisor present, so the platform was fine - only the
version pin failed to hold.

- Disable Microsoft Store automatic app updates in first-boot
  (HKLM\...\WindowsStore\AutoDownload = 2) so the WSL pin holds.
- In the boot-time WSL install: shut down WSL and remove any non-2.4.13 WSL
  Appx (and its provisioned package) before installing the pinned MSI, since
  an older MSI will not install over a newer Store app.
- After install, verify 'wsl --version' is 2.4.13 and log loudly on mismatch
  so a drifted runner is visible in StartupScript.log / CloudWatch instead of
  silently failing finch e2e.

Existing Windows runners must be recycled to re-provision on the pin.

Signed-off-by: ShashankReddy Boyapally <shasboy@amazon.com>
… WSL2 distro

The boot-time WSL pin hung and left runners unable to run finch e2e:

1. msiexec hang: installing the pinned 2.4.13 MSI right after removing the newer
   Store WSL Appx blocks on the Windows Installer lock indefinitely (Start-Process
   -Wait never returns), stranding the instance in Standby before Exit-ASStandby.
   Now installs with a 180s timeout + kill + retry (up to 4x), mirroring the manual
   recovery that worked (kill stuck msiexec, reinstall).

2. Missing WSL2 distro: finch vm init attaches its disk via 'wsl --mount --bare --vhd',
   which fails with WSL_E_WSL2_NEEDED unless a WSL2 distro is registered (the utility
   VM only exists then). The previous 'wsl --install Ubuntu' ran AFTER the hanging
   msiexec so it never executed. Now installs Ubuntu (--no-launch, headless) before
   Exit-ASStandby and verifies via the per-user Lxss registry key. startup.ps1 runs
   as Administrator - the same account finch e2e runs under - so the distro is
   registered for the right user.

Also sets 'wsl --set-default-version 2' explicitly and logs the resulting
'wsl --version' so drift/failures are visible in StartupScript.log / CloudWatch.
Store auto-update remains disabled (first-boot) so the pin holds.

Existing drifted runners must be recycled to pick up this user-data.

Signed-off-by: ShashankReddy Boyapally <shasboy@amazon.com>
…ve download unbounded

Signed-off-by: ShashankReddy Boyapally <shasboy@amazon.com>
@shashank-boyapally
shashank-boyapally requested a review from a team as a code owner September 10, 2026 23:28
…n-wsl-2.4.13

# Conflicts:
#	scripts/windows-runner-user-data.yaml
@shashank-boyapally
shashank-boyapally merged commit 04fe1e2 into runfinch:main Sep 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants