fix(sandbox): switch to root user for package installation in sandbox-common-setup#16581
Merged
steipete merged 1 commit intoopenclaw:mainfrom Feb 14, 2026
Merged
Conversation
…-common-setup The base image (Dockerfile.sandbox) sets USER sandbox at the end, so when sandbox-common-setup.sh builds FROM it, apt-get runs as the unprivileged sandbox user and fails with 'Permission denied'. Add USER root before apt-get/npm/curl install steps, and restore USER sandbox at the end to preserve the non-root runtime default. Fixes openclaw#16420
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes permission errors that occur when building Docker images using sandbox-common-setup.sh by ensuring package installation commands run with appropriate privileges.
Changes:
- Add
USER rootafter theFROMdirective to elevate privileges for package installations - Restore
USER sandboxat the end of the Dockerfile to maintain non-root runtime defaults
Contributor
|
Landed via rebase onto main.
Thanks @arosstale! |
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
Fixes #16420
The base image (
Dockerfile.sandbox) setsUSER sandboxas the final layer. Whenscripts/sandbox-common-setup.shbuildsFROMthis base image, all subsequentRUNcommands (includingapt-get update,npm install -g,curl | bash) execute as the unprivilegedsandboxuser, causingPermission deniederrors.Changes
USER rootimmediately afterFROMin the generated Dockerfile so package installation steps run with the required privilegesUSER sandboxat the end of the build to preserve the non-root runtime default from the base imageRoot Cause
Testing
Verified that the generated Dockerfile correctly elevates to root for installation and drops back to sandbox for runtime.
Greptile Overview
Greptile Summary
Fixes permission errors in the sandbox common image build by adding
USER root/USER sandboxdirectives around the package installation steps in the generated Dockerfile.Dockerfile.sandbox) setsUSER sandboxas the final layer, so the derived build insandbox-common-setup.shinherited the unprivileged user for allRUNcommands (apt-get,npm install -g,curl | bash)USER rootimmediately afterFROMso installation commands run with required privilegesUSER sandboxat the end to preserve the non-root runtime defaultConfidence Score: 5/5
Last reviewed commit: 8a01107