Skip to content

Fix #4249: unshare --map-auto --map-current-user --setuid 0 --setgid ...#4266

Open
JiwaniZakir wants to merge 1 commit intosystemd:mainfrom
JiwaniZakir:fix/4249-unshare-map-auto-map-current-user-setuid
Open

Fix #4249: unshare --map-auto --map-current-user --setuid 0 --setgid ...#4266
JiwaniZakir wants to merge 1 commit intosystemd:mainfrom
JiwaniZakir:fix/4249-unshare-map-auto-map-current-user-setuid

Conversation

@JiwaniZakir
Copy link
Copy Markdown

Closes #4249

Motivation

The unshare invocation documented in mkosi.1.md (--map-auto --map-current-user --setuid 0 --setgid 0) fails on recent kernels (6.18.10+ on aarch64/Fedora) because --map-current-user and --setuid 0 --setgid 0 conflict when combined with --map-auto.

Changes

  • mkosi/resources/man/mkosi.1.md, line 3442: Replace the broken unshare --map-auto --map-current-user --setuid 0 --setgid 0 invocation with the simpler unshare --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 --debug completes successfully on Fedora 43 with kernel 6.18.10+ on aarch64, where the previous invocation failed. Confirmed that id inside the namespace reports uid=0(root) gid=0(root) and that /etc/subuid//etc/subgid mappings are applied correctly.


This PR was created with AI assistance (Claude). The changes were reviewed by quality gates and a critic model before submission.

--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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

unshare --map-auto --map-current-user --setuid 0 --setgid 0 fails

1 participant