From 4bf9fb2ae3c8ff9bcc388baf65335abe73bd6123 Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Thu, 5 Nov 2026 20:49:23 +0100 Subject: [PATCH 1/2] ci: stop WSL before exporting the prepared WSL distribution The first run of the wsl-distro job of pr-workspace-images.yml failed to export the distribution: `wsl --export --format vhd` reports a sharing violation while the utility VM still holds the VHD of the distribution, which `wsl --terminate` doesn't release (https://github.com/microsoft/WSL/issues/10737). Prepare runs in a job of its own, so it now stops the VM with `wsl --shutdown` before the export. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- test/smoke/wslDevContainer.ps1 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/smoke/wslDevContainer.ps1 b/test/smoke/wslDevContainer.ps1 index 98c5c0f437a71f..a7b58d280c500b 100644 --- a/test/smoke/wslDevContainer.ps1 +++ b/test/smoke/wslDevContainer.ps1 @@ -426,9 +426,12 @@ rm -rf /var/lib/apt/lists/* sync fstrim --verbose / || echo 'fstrim failed, so the export keeps the blocks of deleted files.' '@ - $terminate = Invoke-WslExe -ArgumentList '--terminate', $Distribution -TimeoutSeconds 60 - if ($terminate.ExitCode -ne 0) { - throw "Failed to stop $Distribution before exporting it ($(Format-WslResult $terminate))." + # A VHD export fails with a sharing violation while the utility VM still holds the distribution's VHD, which + # --terminate doesn't release (https://github.com/microsoft/WSL/issues/10737). Prepare runs in a job of its own, so + # it stops the VM. + $shutdown = Invoke-WslExe -ArgumentList '--shutdown' -TimeoutSeconds 60 + if ($shutdown.ExitCode -ne 0) { + throw "Failed to stop WSL before exporting $Distribution ($(Format-WslResult $shutdown))." } New-Item -ItemType Directory -Force -Path (Split-Path $Path -Parent) | Out-Null Remove-Item -LiteralPath $Path -ErrorAction SilentlyContinue From 7cb7fb2155a152d79523fd72ff40b7d25ea067ee Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Thu, 5 Nov 2026 20:51:22 +0100 Subject: [PATCH 2/2] ci: rename the wsl-distro job to Windows (WSL distro) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/pr-workspace-images.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-workspace-images.yml b/.github/workflows/pr-workspace-images.yml index 4874a5626be69c..e4a917ca625d7a 100644 --- a/.github/workflows/pr-workspace-images.yml +++ b/.github/workflows/pr-workspace-images.yml @@ -394,7 +394,7 @@ jobs: # job. The cache key hashes the files that define the distribution, so that the shard of a commit that changes them # builds the distribution instead; the shard restores the newest entry of its key. wsl-distro: - name: Windows (WSL distribution) + name: Windows (WSL distro) if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} runs-on: [ self-hosted, 1ES.Pool=1es-vscode-oss-windows-2022-x64, "JobId=wsl-distro-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}" ] timeout-minutes: 30