cmd/hi: warn when /dev/kvm is missing

Updates tailscale/tailscale#15660
This commit is contained in:
Kristoffer Dalby authored and Kristoffer Dalby committed 2026-11-20 11:19:11 +01:00
1 parent 248d2c4054
commit e48c8409f0
1 file changed
+17
+17
View File
@@ -91,6 +91,8 @@ func runPreflightChecks(ctx context.Context, full bool) error {
// Check 5: Required files
results = append(results, checkRequiredFiles(ctx))
results = append(results, checkKVM())
// Display results
displayDoctorResults(results)
@@ -214,6 +216,21 @@ func checkDockerHubCredentials() DoctorResult {
return pass("Docker Hub Credentials", fmt.Sprintf("Credentials available (source: %s)", source))
}
// checkKVM reports whether the Android emulator tests can run. Only those
// tests need KVM, so its absence is a warning.
func checkKVM() DoctorResult {
_, err := os.Stat("/dev/kvm")
if err != nil {
return warn(
"KVM",
"/dev/kvm not available — TestAndroid* cannot boot the emulator",
"Use an x86_64 host with hardware virtualization (bare metal or nested virtualization)",
)
}
return pass("KVM", "/dev/kvm available for Android emulator tests")
}
// checkGolangImage verifies the golang Docker image is available locally or can be pulled.
func checkGolangImage(ctx context.Context) DoctorResult {
cli, err := createDockerClient(ctx)