Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/windows/service/exe/LxssUserSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2873,7 +2873,26 @@ void LxssUserSessionImpl::_CreateVm()
m_vmId.store(vmId);

// Create the utility VM and register for callbacks.
m_utilityVm = WslCoreVm::Create(m_userToken, std::move(config), vmId);
try
{
m_utilityVm = WslCoreVm::Create(m_userToken, std::move(config), vmId);
}
catch (...)
{
// CreateComputeSystem() throws HCS_E_HYPERV_NOT_INSTALLED when the Virtual Machine Platform optional
// component is not installed. That HRESULT otherwise maps to a misleading "virtualization is not
// enabled" message that points users at their BIOS instead of the missing component. Remap it to an
// actionable error covering every path that needs the VM (launch, WSL1->WSL2 conversion, import,
// disk mount, ...). Other failures (e.g. the VM starts but networking init fails because VMP is only
// partially installed) are left untouched so their existing degraded-mode handling still applies.
if (wil::ResultFromCaughtException() == HCS_E_HYPERV_NOT_INSTALLED)
{
THROW_HR_WITH_USER_ERROR(
WSL_E_VIRTUAL_MACHINE_PLATFORM_REQUIRED, wsl::shared::Localization::MessageVirtualMachinePlatformNotInstalled());
}
Comment thread
benhillis marked this conversation as resolved.

throw;
}

if (m_httpProxyStateTracker)
{
Expand Down