fix(vm): correct /sandbox ownership when rootfs is built by non-root host#1176
Open
benoitf wants to merge 1 commit intoNVIDIA:mainfrom
Open
fix(vm): correct /sandbox ownership when rootfs is built by non-root host#1176benoitf wants to merge 1 commit intoNVIDIA:mainfrom
benoitf wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
…host When the VM driver extracts OCI image layers on a non-root host (e.g. macOS UID 501), fs::copy and tar::unpack create files owned by the host user. The sandbox user inside the VM then cannot write to its own home directory. Add a conditional chown in the VM init script that detects the mismatch and fixes ownership before the supervisor starts. The check is skipped when ownership is already correct (e.g. Linux-as-root extraction). Signed-off-by: Florent Benoit <fbenoit@redhat.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.
Summary
Fix
/sandboxhome directory ownership in VM sandboxes when the host CLI runs as a non-root user (e.g. macOS UID 501). The sandbox user could not create files or directories in its own home because OCI layer extraction preserves the host user's UID instead of the in-guest sandbox user's UID.Related Issue
related to #957
Changes
chown -Rblock to the VM init script (openshell-vm-sandbox-init.sh) that runs before the supervisor starts/sandboxagainst the sandbox user's UID (resolved viaid -u sandbox) and only runschownwhen there is a mismatchTesting
mise run pre-commitpassesManual verification
without the patch I got
Checklist