Skip to content

Commit 4be0057

Browse files
RBridCopilot
andauthored
Use Arm64-aware wording when WSL reports virtualization off (#594)
* Use Arm64-aware wording when WSL reports virtualization off The SetupEngine preflight-wsl step previously surfaced x86-only firmware terminology (VT-x/AMD-V, BIOS/UEFI) when wsl.exe reported 'virtualization is not enabled'. On ARM64 devices (e.g. Surface) those terms don't apply, leaving the remediation message confusing. Split TryGetEnvironmentIssue into a public 1-arg method that delegates to a new internal overload taking System.Runtime.InteropServices. Architecture. The Arm64 branch emits UEFI-/Intune-aware wording; other architectures keep the existing x64 wording. RuntimeInformation. OSArchitecture reflects OS arch (not process arch), so this works even when the app runs as win-x64 under Prism on ARM64 Windows. Fixes #593 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Retrigger CI Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 077d44c commit 4be0057

2 files changed

Lines changed: 45 additions & 8 deletions

File tree

src/OpenClaw.SetupEngine/SetupSteps.cs

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Net;
33
using System.Net.Http;
44
using System.Net.Sockets;
5+
using System.Runtime.InteropServices;
56
using System.Text.Json;
67
using OpenClaw.Connection;
78
using OpenClaw.Shared;
@@ -107,18 +108,32 @@ public static bool SupportsDirectNamedInstall(Version version)
107108
// sentences are not, and over-broad fallbacks just create false
108109
// positives.
109110
public static bool TryGetEnvironmentIssue(string output, out string message)
111+
=> TryGetEnvironmentIssue(output, RuntimeInformation.OSArchitecture, out message);
112+
113+
// Architecture-aware overload. Internal so tests can exercise both x64
114+
// and Arm64 wordings without depending on the host process arch.
115+
internal static bool TryGetEnvironmentIssue(string output, Architecture architecture, out string message)
110116
{
111117
var text = Normalize(output);
112118

113-
// Firmware virtualization off (VT-x/AMD-V disabled in BIOS/UEFI).
114-
// wsl.exe emits this when the Windows feature is installed but the
115-
// CPU virtualization extension is turned off; remediation requires
116-
// a trip into firmware settings, not `wsl --install`.
119+
// Firmware virtualization off. wsl.exe emits this when the Windows
120+
// feature is installed but the CPU virtualization extension is
121+
// turned off; remediation requires a trip into firmware settings,
122+
// not `wsl --install`. The remediation wording differs by CPU
123+
// architecture: VT-x/AMD-V/SVM are x86-specific terms that don't
124+
// exist on Arm64 (Surface Pro X / Pro 9 SQ3 / Pro 11), where the
125+
// extensions are ARMv8 EL2 and the UEFI label is generic.
117126
if (Contains(text, "virtualization is not enabled"))
118127
{
119-
message = "WSL2 requires hardware virtualization, but it is disabled in firmware. "
120-
+ "Enable VT-x/AMD-V (Intel VT or AMD SVM) in your computer's BIOS/UEFI settings, "
121-
+ "reboot, then retry setup.";
128+
message = architecture == Architecture.Arm64
129+
? "WSL2 requires hardware virtualization, but it is disabled. "
130+
+ "On ARM64 devices (e.g. Surface), enable virtualization in your device's UEFI "
131+
+ "settings (look for 'Virtualization Support' or similar). On managed devices this "
132+
+ "may be controlled by your organization's Intune / device-management policy. "
133+
+ "Reboot, then retry setup."
134+
: "WSL2 requires hardware virtualization, but it is disabled in firmware. "
135+
+ "Enable VT-x/AMD-V (Intel VT or AMD SVM) in your computer's BIOS/UEFI settings, "
136+
+ "reboot, then retry setup.";
122137
return true;
123138
}
124139

tests/OpenClaw.SetupEngine.Tests/SetupStepsTests.cs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using OpenClaw.Connection;
22
using System.Net;
33
using System.Net.Sockets;
4+
using System.Runtime.InteropServices;
45

56
namespace OpenClaw.SetupEngine.Tests;
67

@@ -600,11 +601,31 @@ public void WslInstallSupport_TryGetEnvironmentIssue_DetectsFirmwareVirtualizati
600601
"WSL2 is unable to start since virtualization is not enabled on this machine. "
601602
+ "Please ensure the 'Virtual Machine Platform' optional component is enabled "
602603
+ "and virtualization is turned on in your computer's firmware settings.",
604+
Architecture.X64,
603605
out var message));
604606
Assert.Contains("BIOS", message, StringComparison.OrdinalIgnoreCase);
607+
Assert.Contains("VT-x", message, StringComparison.OrdinalIgnoreCase);
605608
Assert.Contains("virtualization", message, StringComparison.OrdinalIgnoreCase);
606609
}
607610

611+
[Fact]
612+
public void WslInstallSupport_TryGetEnvironmentIssue_UsesArm64WordingOnArm64()
613+
{
614+
Assert.True(WslInstallSupport.TryGetEnvironmentIssue(
615+
"WSL2 is unable to start since virtualization is not enabled on this machine. "
616+
+ "Please ensure the 'Virtual Machine Platform' optional component is enabled "
617+
+ "and virtualization is turned on in your computer's firmware settings.",
618+
Architecture.Arm64,
619+
out var message));
620+
Assert.Contains("ARM64", message, StringComparison.OrdinalIgnoreCase);
621+
Assert.Contains("UEFI", message, StringComparison.OrdinalIgnoreCase);
622+
Assert.Contains("virtualization", message, StringComparison.OrdinalIgnoreCase);
623+
// Must not name x86-specific extensions on ARM64.
624+
Assert.DoesNotContain("VT-x", message, StringComparison.OrdinalIgnoreCase);
625+
Assert.DoesNotContain("AMD-V", message, StringComparison.OrdinalIgnoreCase);
626+
Assert.DoesNotContain("SVM", message, StringComparison.OrdinalIgnoreCase);
627+
}
628+
608629
[Fact]
609630
public void WslInstallSupport_TryGetEnvironmentIssue_DetectsCanonical0x80370102Error()
610631
{
@@ -649,7 +670,8 @@ public async Task PreflightWsl_FailsTerminalWhenVirtualizationDisabledInFirmware
649670

650671
Assert.Equal(StepOutcome.FailedTerminal, result.Outcome);
651672
Assert.Contains("virtualization", result.Message, StringComparison.OrdinalIgnoreCase);
652-
Assert.Contains("BIOS", result.Message, StringComparison.OrdinalIgnoreCase);
673+
// Don't assert on "BIOS" / "UEFI" here -- the wording flexes by host
674+
// CPU architecture (this test runs on either x64 or Arm64 dev boxes).
653675
}
654676

655677
[Fact]

0 commit comments

Comments
 (0)