Skip to content

systemd: DetectUID: use $ROOTLESSKIT_PARENT_EUID if set - #88

Open
kolyshkin wants to merge 1 commit into
opencontainers:mainfrom
kolyshkin:detect-uid-rootlesskit
Open

kolyshkin wants to merge 1 commit into
opencontainers:mainfrom
kolyshkin:detect-uid-rootlesskit

Conversation

@kolyshkin

Copy link
Copy Markdown
Contributor

When running in a user namespace, DetectUID uses busctl --user status to get the OwnerUID. This fails when /proc is mounted with hidepid=2, as busctl can't read /proc/<pid> of the bus peer. In such case runc (which uses DetectUID to decide whether to use rootless cgroup manager) assumes the UID is 0, and so it fails to start a container under RootlessKit with systemd cgroup driver:

unable to start unit "runc-xxx.scope" (properties [... {Name:Slice Value:"system.slice"} ...]): ... read unix @->/run/systemd/private: read: connection reset by peer

RootlessKit sets $ROOTLESSKIT_PARENT_EUID (documented since RootlessKit v0.8.0) for its child process, so use it if set.

Tested manually on CentOS Stream 10 VM (rootlesskit runc --systemd-cgroup run as a regular user, with /proc remounted with hidepid=2): fails without this change, works with it.

Fixes opencontainers/runc#3124.

When running in a user namespace, DetectUID uses
`busctl --user status` to get the OwnerUID. This fails when /proc
is mounted with hidepid=2, as busctl can't read /proc/<pid> of the
bus peer. In such case runc (which uses DetectUID to decide whether
to use rootless cgroup manager) assumes the UID is 0, and so it fails
to start a container under RootlessKit with systemd cgroup driver:

	unable to start unit "runc-xxx.scope" (properties [... {Name:Slice Value:"system.slice"} ...]): ... read unix @->/run/systemd/private: read: connection reset by peer

RootlessKit sets $ROOTLESSKIT_PARENT_EUID (documented since
RootlessKit v0.8.0) for its child process, so use it if set.

Fixes opencontainers/runc#3124.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@kolyshkin
kolyshkin requested a review from a team as a code owner October 9, 2026 06:22
@kolyshkin kolyshkin added this to the 0.1.1 milestone Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't run containers "error while starting unit" with hidepid=2 + Systemd CGroupV2 + rootlesskit

1 participant