Repository navigation
Conversation
"podman system hyperv-prep" hardcoded --mounts to 2, matching the two WSL-style default machine volumes on Windows (the home directory and its drive). The container-libs update in 49ab599 added a third default volume, the user config directory mounted at /etc/containers. Since then "podman machine init" asks for 3 Fileserver vsock entries, finds only the 2 that hyperv-prep created, and non-admin users get "the first time Podman initializes a Hyper-V machine, it requires admin rights" even though hyperv-prep succeeded. - Default --mounts to the number of default machine volumes in containers.conf, the same list "machine init" uses for --volume. - Only create the entries that are missing, so hyperv-prep can be re-run (for example with a larger --mounts) without piling up duplicate entries. Machines already reuse existing entries by index. - Say how many entries are needed, and the hyperv-prep command that creates them, when machine init fails this check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Justin Dearing <zippy181@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #30374
What this PR does / why we need it:
podman system hyperv-prephardcoded--mountsto 2. Since #28573 added the user config directory (/etc/containers) as a third default machine volume,podman machine initneeds 3 Fileserver vsock entries, so non-admin users getErrHypervRegistryInitRequiresElevationright after a successfulhyperv-prep.--mountstolen(ContainersConfDefaultsRO.Machine.Volumes.Get()), the same defaultsmachine init --volumeuses, so the two cannot drift again.createShares,CheckIfHVSockRegistryEntriesExist), so re-runninghyperv-prep, for example with a larger--mounts, no longer piles up duplicates.ErrHypervRegistryInitRequiresElevationincheckCanCreatewith the machine's volume count and thehyperv-prep --mounts Ncommand.errors.Isstill matches, so the auto-elevation path andstubber_test.goare unaffected.podman-system-hyperv-prep.1.md.How to verify it
podman system hyperv-prep. With default containers.conf it creates 3 Fileserver entries.podman machine initgets past the registry check.I built it with
GOOS=windowsand theremotetags;go vetand compiling thepkg/machine/hypervtests pass. I have run it on awindows VM.Tested on Windows Server 2025 (Hyper-V): with 2 Fileserver entries a non-admin machine init fails with the new hint; plain hyperv-prep adds only the missing entry and a re-run adds none; then a non-admin machine init, start and podman info succeed.
Which issue(s) this PR fixes:
Fixes #30374
Special notes for your reviewer:
The default comes from the containers.conf of whoever runs
hyperv-prep, usually an administrator. A user with more volumes configured still needs a larger--mounts, and the new error message tells them which number to use.Does this PR introduce a user-facing change?
🤖 Generated with Claude Code but edited by hand