POC: add Windows guest support via autounattend.xml#4985
Conversation
ea87ea1 to
528fc97
Compare
|
Can you share info about your testing environment? |
|
Host Machine:
QEMU Setup:
Guest:
|
|
Also tried to test in WSL2 before switching to macOS. But it failed probably because of nested virtualization. The ideal way to test would be to test it in x86_64 linux machine to avoid additional performance baggage which comes with emulation. This I haven't tried yet. |
Can we support the ARM version of Windows? |
Schema groundwork for Lima's Windows-guest support. Without this, any attempt to declare a Windows guest in YAML fails validation at the first hurdle and there is no canonical template for reviewers to exercise the rest of the pipeline against. This commit: - Adds `WINDOWS OS = "Windows"` to pkg/limatype/lima_yaml.go alongside the existing LINUX/DARWIN/FREEBSD constants, and includes it in the OSTypes slice that the validator consults. - Teaches NewOS() to normalize the lowercase "windows" alias the same way it normalizes "linux" and "darwin". - Whitelists limatype.WINDOWS in pkg/limayaml/validate.go so the switch on *y.OS accepts it. - Updates TestValidateMultipleErrors to use "plan9" as the rejected OS (it was using "windows" as an example of an invalid value, which is now valid) and refreshes the expected OSTypes list in the error message. - Adds TestValidateWindowsGuestOS, a focused positive-and-negative test for the new value. - Adds templates/experimental/windows.yaml, declaring a QEMU-driven Windows guest. The image URL is intentionally a 404 placeholder so the template is reviewable for its schema shape without misleading anyone into thinking `limactl start` is functional yet — the file header documents the follow-up work in pkg/cidata and pkg/driver/qemu that has to land before boot succeeds. This is complementary to PR lima-vm#4985 (autounattend route): both routes need this enum, and pkg/cidata can subsequently branch on guestOS to emit Cloudbase-Init NoCloud data or autounattend ISOs as the project decides. Part of the LFX 2026 Term 2 project "Improve Windows support (host and guest)" (lima-vm#4907). Signed-off-by: mn-ram <235066282+mn-ram@users.noreply.github.com>
…S OS schema, experimental template Two complementary primary-goal contributions for the LFX 2026 Term 2 project "Improve Windows support (host and guest)" (lima-vm#4907): 1. Windows host UX Replaces the cygpath.exe subprocess at pkg/ioutilx/ioutilx.go:54 with deterministic pure-Go path translation. The implicit Cygwin / MSYS2 dependency is removed from Windows hosts. The public signature of WindowsSubsystemPath is unchanged, so all eight production callers (cmd/limactl/shell.go, pkg/copytool, pkg/hostagent/mount, pkg/sshutil x3, pkg/limayaml/defaults) continue to work without edits. - detectSubsystemStyle() picks one of {native, msys, cygwin} from MSYSTEM, CYGWIN, the SSH env var, and the resolved ssh binary path. Env vars win over heuristics so a user-asserted MSYSTEM is honored. - convertWindowsSubsystemPath() does the namespace remapping with pure string operations (no path/filepath calls), so the package builds and tests on any host. UNC paths pass through with slashes normalized, matching cygpath -u's behavior. - WindowsSubsystemPathForLinux on line 62 is intentionally left alone; it shells out to "wsl --exec wslpath", which is correct and not a Cygwin dependency. - 23 sub-tests cover style detection, drive-letter and UNC conversion, and the public end-to-end entry point. Uses gotest.tools/v3/assert per Lima's .golangci.yml. 2. Windows guest scaffolding Adds the schema groundwork any Windows-guest provisioning route (Cloudbase-Init or autounattend.xml, see lima-vm#4985) needs: - WINDOWS OS = "Windows" added to pkg/limatype/lima_yaml.go and the OSTypes slice. NewOS() normalizes the lowercase "windows" alias the same way it does "linux" and "darwin". - pkg/limayaml/validate.go switch on *y.OS whitelists Windows. - TestValidateMultipleErrors updated to use "plan9" as the rejected OS (was using "windows" as the invalid example, which is now valid) and refreshed the expected OSTypes message. - TestValidateWindowsGuestOS added — positive + negative cases. - templates/experimental/windows.yaml — minimal QEMU-driven Windows guest template. Image URL is intentionally a 404 placeholder so the template is reviewable for its schema shape without misleading anyone into thinking limactl start is functional yet; the file header documents the follow-up work in pkg/cidata and pkg/driver/qemu. A self-contained Go module under poc/ prototypes the conversion logic in isolation and is kept in the tree as a runnable demo (go run ./poc/cmd/winpath-demo 'C:\...'). It is not required by the production code path and maintainers may strip it before merge. Out of scope, deferred to follow-up PRs and documented in the project plan: pkg/cidata branching for Cloudbase-Init data, QEMU TPM/UEFI plumbing for Windows guests, pkg/driver/hcs external driver, WSL2 multi-instance + WSLg, limactl doctor for the first- run Windows wizard. Signed-off-by: mn-ram <235066282+mn-ram@users.noreply.github.com>
Add dual-architecture (amd64/arm64) unattended Windows installation using autounattend.xml templates. Includes Joliet ISO generation, architecture-specific template selection, unit tests, and a standalone QEMU test script (hack/gen-autounattend-iso.go) for both architectures. Key design decisions: - arm64 uses NVMe disk (built-in WinPE driver, no virtio-win dependency) - amd64 uses AHCI/SATA via q35 (built-in WinPE driver) - No product keys in either template - OpenSSH server installed during OOBE for Lima host-agent connectivity Tested end-to-end: - Windows 10 Pro x86_64 on QEMU (emulation) - Windows 11 Pro ARM64 on QEMU+HVF (Apple Silicon, native speed) Signed-off-by: ashwat287 <ashwatpas@gmail.com>
528fc97 to
f3cd7c9
Compare
Absolutely! I have included the testing section for ARM version in the description. It's much faster, takes 5-10 mins for the boot process to complete. (emulation overhead got dropped + hvf acceleration) |
|
AI code review: https://jandubois.github.io/lima/20260519-100641-pr-4985.html |
Updated with dual-arch support. Both amd64 and arm64 work end-to-end now. Ref: #4852
What's in this commit
WINDOWSOS type added tolimatypeand validationautounattend.xmltemplates for amd64 and arm64 (3-pass: windowsPE, specialize, oobeSystem)generateWindowsISO()which produces a Joliet-labeled ISOhack/gen-autounattend-iso.godev tool for standalone testing (pass-arch amd64or-arch arm64)Design choices
stornvme.sysbuilt-in, so there's no need forvirtio-win.iso.Testing
Tested both architectures on macOS.
amd64 (x86_64)
Windows 10 consumer ISO from microsoft.com, version 22H2 multi-edition. Pro is image index 6.
This runs under emulation on Apple Silicon so it's slow, but completes successfully.
arm64 (aarch64)
Windows 11 ARM64 25H2 ISO. Pro is image index 3. Runs natively via HVF.
The arm64 command is longer because the
virtmachine has no built-in controllers (no SATA, no IDE, no VGA), so each device needs to be added explicitly. On amd64, q35 provides all of that.Result
Both architectures install fully unattended: partitioning, image extraction, OOBE, and OpenSSH server all complete without manual interaction.
After install completes:
ssh -p 2222 User@localhostNotes
-cpu host, not-cpu max. Usingmaxwith HVF causes page faults.usb-kbd/usb-tabletare needed on arm64 for UEFI console initialization.Changes since last review
-boot dfrom amd64 (OVMF ignores it)