From e48c8409f0c2eca1b454a171e6f1dfbc3f222548 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Mon, 28 Sep 2026 08:50:56 +0000 Subject: [PATCH] cmd/hi: warn when /dev/kvm is missing Updates tailscale/tailscale#15660 --- cmd/hi/doctor.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/cmd/hi/doctor.go b/cmd/hi/doctor.go index 172b16496..794a037ec 100644 --- a/cmd/hi/doctor.go +++ b/cmd/hi/doctor.go @@ -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)