Repository navigation
fix(os): ID-map the Sysbox rootfs overlay instead of cloning it - #1489
Merged
Merged
Conversation
This was referenced Oct 26, 2026
kvinwang
force-pushed
the
feat/sysbox-idmap-rootfs
branch
from
October 27, 2026 03:33
62eb17e to
7a4cdba
Compare
sysbox-mgr ran with --disable-ovfs-on-idmapped-mount, which forced Sysbox's chown fallback. That fallback clones the container rootfs into /var/lib/sysbox/rootfs/<id> and deletes the clone when Sysbox stops, losing every write made inside a Sysbox container. Dropping the flag alone is not enough. Stock Sysbox then ID-maps only the overlay lower layers and chowns the upper layer. If a container fails to start, that chown is never reverted. The retry sees a non-root rootfs owner, skips ID shifting, and image files show up as nobody:nogroup. Patch Sysbox to ID-map the merged overlay mount as a whole when the kernel supports it (the overlayfs backport in this stack). Nothing on disk is chowned, so no ownership state can be left behind, and writes stay in Docker's upper directory on the persistent data disk. sysbox-mgr probes the feature at startup; kernels without it keep the lower-layer mode. The patches are shared with the Yocto recipe, and the mgr protobuf file is regenerated for the new config field. Signed-off-by: Kevin Wang <wy721@qq.com>
kvinwang
force-pushed
the
feat/sysbox-idmap-rootfs
branch
from
October 27, 2026 04:13
7a4cdba to
2ce985b
Compare
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
sysbox-mgrruns with--disable-ovfs-on-idmapped-mount, which forces Sysbox's chown fallback. That fallback clones the container rootfs into/var/lib/sysbox/rootfs/<id>and deletes the clone when Sysbox stops. Every write made inside a Sysbox container is lost on a Sysbox restart or CVM reboot; volumes are unaffected.Dropping the flag alone is not enough. Stock Sysbox then ID-maps the overlay lower layers but chowns the upper layer, and never reverts that chown when a container fails to start. A retry sees a non-root rootfs owner, skips ID shifting, and image files show up as
nobody:nogroup(reproduced with Sysbox 0.7.1 on both kernels: start a container whose command is missing, add the command, start again).Fix
Patch Sysbox to ID-map the merged overlay mount as a whole when the kernel supports it (#1488). Nothing on disk is chowned, so a failed start leaves nothing behind, and writes stay in Docker's upper directory on the persistent data disk. Then drop the flag.
sysbox-libs: newIDMappedOverlayfsshift type and a probe that ID-maps a test overlay mount.sysbox-ipc/sysbox-mgr: probe at startup and pass the result tosysbox-runc; the stop/pause/resume chown bookkeeping does not apply to the new mode.sysbox-runc: prefer the new mode for overlay rootfs; skip both chowns.Kernels without the backport keep the existing lower-layer mode. The four patches live next to the Yocto recipe and are applied with
--fuzz=0by both backends;sysboxMgrProtobuf.pb.gois regenerated with the generator that produced the current file (byte-identical output for the unmodified proto).Verification
Full dev image built from this stack with
repro-build.sh(mkosi,FLAVORS=dev), booted as local KVM guests with simulated TDX and a TPM-sealed data disk, once withstorage_fs=zfsand once withext4. Outer Docker uses overlay2 on both (on ZFS 2.4.0 too);sysbox-mgrreports ID-mapped overlayfs support on both and containers use the new mode (root mountidmapped overlay).Each check passed on both filesystems:
0:0and root can write. Stock 0.7.1 without the flag gives65534:65534here.0:0,1000:1000) while running and stopped; no shifted IDs, no-sysboxworkdir, no chown entries in thesysbox-mgrlog.docker commitrecords the correct owners.idmapped_mountsselftests: 6/6 pass.Repeated on real Intel TDX hardware (same image,
no_tee=false, guest detects TDX,key_provider=tpm) with both ZFS and ext4: all of the above pass. The reboot case is a cold restart of the TD with the same data disk and TPM state, since a TD exits QEMU on reboot.Scope
docker rm, compose or image changes) still discards its writable layer by design."storage-driver": "overlay2"; the containerd image store is not compatible with Sysbox's snapshotter mount handling.Stacked on #1488.