Files
WSL/diagnostics
Gordon Lam 2c42f23a75 diagnostics: collect MSI verbose install logs in diagnostic bundle (#40218)
* diagnostics: collect MSI verbose install log in diagnostic bundle

The MSI verbose log (wsl-install-logs.txt) is generated during MSI
upgrades via MsiEnableLog but was not collected by the diagnostic
script. Additionally, the Store/winget upgrade path (WslInstaller)
did not write an MSI log at all when no registry override was set.

Changes:
- WslInstaller.cpp: default to %TEMP%\wsl-install-logs.txt when
  UpgradeLogFile registry key is empty, with delete-on-success /
  preserve-on-failure (same pattern as wsl --update in install.cpp)
- collect-wsl-logs.ps1: collect %TEMP%\wsl-install-logs.txt

Now all MSI upgrade paths write to the same log location:
- wsl --update: already writes here (install.cpp)
- Store/winget: now also writes here (WslInstaller.cpp)
- Both: delete on success, preserve on failure

Tested: installed MSI with file lock contention, collected log
contains Warning 1946 detail for diagnosis.

Refs: microsoft/WSL#13469, microsoft/WSL#11276, microsoft/WSL#12759

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address review: handle reboot-required and service temp path

- Treat ERROR_SUCCESS_REBOOT_REQUIRED (3010) as success when deciding
  whether to preserve MSI logs (delete-on-success, keep-on-failure).
- Collect logs from both user temp and system temp (WslInstaller service
  runs as SYSTEM, so its temp_directory_path resolves to %WINDIR%\Temp).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address review feedback: respect UpgradeLogFile registry, fix collector

- Add UpgradeLogInfo struct with fromRegistry flag to skip log deletion
  when the UpgradeLogFile registry value is explicitly set (per OneBlue)
- Remove duplicate system temp copy in collector (per OneBlue)
- Fix forward-slash inconsistency in collector (per ptrivedi)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-24 15:31:40 +08:00
..
2024-08-30 10:58:30 -07:00