machine: ensure disk image is writable before resize (fix read-only image init failure)#28447
Open
jude-ruben wants to merge 1 commit intocontainers:mainfrom
Open
machine: ensure disk image is writable before resize (fix read-only image init failure)#28447jude-ruben wants to merge 1 commit intocontainers:mainfrom
jude-ruben wants to merge 1 commit intocontainers:mainfrom
Conversation
baude
reviewed
Apr 6, 2026
|
|
||
| // Ensure image is writable | ||
| if err := os.Chmod(d.finalPath.GetPath(), 0600); err != nil { | ||
| return fmt.Errorf("failed to set permissions on machine image: %w", err) |
Member
There was a problem hiding this comment.
would like it if you made this error message slightly different so anyone debugging could tell which path immediately they are on? so maybe failed to set permissions on pulled image %s ?
Member
|
did you confirm that any of the other providers also have this problem? |
baude
reviewed
Apr 6, 2026
| img := filepath.Join(GinkgoT().TempDir(),"test.qcow2") | ||
|
|
||
| // Step 2: copy existing image | ||
| exec.Command("cp", mb.imagePath, img).Run() |
Member
There was a problem hiding this comment.
maybe using install here is more efficient?
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.
Problem
Initializing a Podman machine with a read-only disk image (e.g., chmod 444)
fails during the resize step with a permission denied error.
Root Cause
The disk image created from user input may retain read-only permissions.
The resize operation (qemu-img) requires write access but no step ensures
the image is writable before resizing.
Solution
Ensure the disk image is set to writable (0600) before resize operations
using os.Chmod.
Test
Added an e2e test:
podman machine initResult
Fixes #27576