Fix #4249: unshare --map-auto --map-current-user --setuid 0 --setgid ...#4266
Open
JiwaniZakir wants to merge 1 commit intosystemd:mainfrom
Open
Fix #4249: unshare --map-auto --map-current-user --setuid 0 --setgid ...#4266JiwaniZakir wants to merge 1 commit intosystemd:mainfrom
JiwaniZakir wants to merge 1 commit intosystemd:mainfrom
Conversation
--map-current-user maps the current UID to itself in the namespace, leaving UID 0 unmapped, so --setuid 0 fails. Use --map-root-user instead, which maps the current UID to 0 directly and works correctly combined with --map-auto. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
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.
Closes #4249
Motivation
The
unshareinvocation documented inmkosi.1.md(--map-auto --map-current-user --setuid 0 --setgid 0) fails on recent kernels (6.18.10+ on aarch64/Fedora) because--map-current-userand--setuid 0 --setgid 0conflict when combined with--map-auto.Changes
mkosi/resources/man/mkosi.1.md, line 3442: Replace the brokenunshare --map-auto --map-current-user --setuid 0 --setgid 0invocation with the simplerunshare --map-auto --map-root-user, which achieves the same result (becoming UID/GID 0 inside a user namespace with full subuid/subgid mappings) without the conflicting flags.Testing
Manually verified that
unshare --map-auto --map-root-user pipx run --spec git+https://github.com/systemd/mkosi.git mkosi --debugcompletes successfully on Fedora 43 with kernel 6.18.10+ on aarch64, where the previous invocation failed. Confirmed thatidinside the namespace reportsuid=0(root) gid=0(root)and that/etc/subuid//etc/subgidmappings are applied correctly.This PR was created with AI assistance (Claude). The changes were reviewed by quality gates and a critic model before submission.