← All posts

A build that only works under sudo is already broken

A dark wall of circuit-board plating with one small keyhole glowing cyan; on the floor below, an oversized magenta master key lies discarded and smoking beside the scorch mark where it was forced, while a small cyan key sits nearby, almost unnoticed.

This is my homelab: single-node Kubernetes clusters on Talos, one operator, and container images built rootless with podman and pushed to the lab's own registry. Nothing here describes an employer's systems. The failure comes from public reports and podman's source. I reproduced its cause on 27 October 2026 in a throwaway shell with a throwaway session bus and read-only calls, not a failed build; beyond that, the lab contributes configuration.

A rootless podman build dies at its first RUN step with sd-bus call: Process org.freedesktop.systemd1 exited with status 1: Input/output error. Put sudo in front of the same command and it goes through, so the error must have been about permission. That reading is the bug: the image just built is already somewhere the next command cannot see.

Sudo is the oversized master key forced at a small keyhole: it scorches the wall beside the lock instead of turning it, and whatever gives way opens onto a different room. A build under sudo is rootful, so its image lands in root's store, and the rootless push that comes next looks in yours and finds nothing, or, if an earlier rootless build used the same tag, finds that older image and pushes it without a word. The error has not gone. It has moved one step downstream, where it reads as a missing image, or does not read at all.

What the build lacked was a systemd on the bus it was handed. Give it one, or stop it needing to ask; neither involves root.

Above, sudo clears the sd-bus error and strands the image in root's store, unseen by the rootless push. Below, a containers.conf setting gives up the container cgroup and keeps the image in the user's store

Find the bus the build is asking

Under its default cgroup manager, rootless podman asks systemd for each container's cgroup over whatever session bus DBUS_SESSION_BUS_ADDRESS names, and RUN is the first build instruction that starts a container. The error text is the bus daemon's. On the user's own bus, systemd is already there to answer. A bus started by dbus-launch or dbus-run-session has none, so the daemon tries to start one from a stub whose command, in the systemd package I read, is /bin/false, and reports that it exited with status 1.

With a scratch config asking for systemd, podman info picked its cgroup manager by the bus it inherited. Its own bus: systemd. No bus at all: four warnings, the last Falling back to --cgroup-manager=cgroupfs, then cgroupfs. A throwaway bus from dbus-run-session: systemd again, on a bus where a call to systemd fails with the same exited with status 1. Podman notices a missing bus; an empty one gets past it, because the socket is real. A job inherits whatever bus its parent carried, and a build that takes its behaviour from whoever starts it depends on a session the way automation that opens one does.

systemctl --user is-active is the wrong test: it uses a private socket, and printed active inside a dbus-run-session shell. Ask the bus podman uses:

busctl --user call org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager GetUnit s default.target
# a unit path back means this shell's bus leads to your systemd; "Call failed: Process org.freedesktop.systemd1 exited with status 1" is the stray bus podman will hit
printf 'runtime=%s bus=%s yours=/run/user/%s\n' "${XDG_RUNTIME_DIR:-unset}" "${DBUS_SESSION_BUS_ADDRESS:-unset}" "$(id -u)"
# healthy: bus is unix:path= under yours, or unset with runtime under yours; a /tmp/dbus- address is the kind that throws this error

On a systemd host, rootful podman asks the system's own systemd, which is always running. Root did not bring a permission your user lacked. It brought a different systemd, and a different store came with it: by default podman keeps root's images under /var/lib/containers/storage and every other user's under ~/.local/share/containers/storage. Paper over the push with a second sudo and the pipeline now runs as root from the build onward, a design nobody chose. Some work needs root and says so, like a root init container fixing ownership a volume plugin ignored. This build was designed rootless and only started working when root ran it.

Pick up the small key, or pay to take the lock off

Giving the build its systemd costs nothing: unset DBUS_SESSION_BUS_ADDRESS in the failing shell and podman finds $XDG_RUNTIME_DIR/bus itself, which, under the scratch config, brought systemd straight back. It needs the user's manager running, which a login or linger provides. A systemd user unit starts on the user's own bus by construction, which suits unattended work.

My own user config takes the lock off instead. Podman's cgroup_manager accepts systemd, the default, or cgroupfs, and these two lines are the whole per-user file, comment mine:

# ~/.config/containers/containers.conf, written 17 August 2026: podman stops asking systemd for the container's cgroup
[engine]
cgroup_manager = "cgroupfs"

Unsetting the variable fixes one shell; the file covers every shell the user opens, stray buses included. From a shell on its own bus, podman confirms the setting is in force:

podman info --format '{{.Host.CgroupManager}} {{.Host.CgroupsVersion}}'
# answered "cgroupfs v2" on 27 October 2026: the setting is live, on a cgroup v2 kernel

The current podman manual is blunt: cgroupfs "doesn't work in Rootless mode and containers cgroups aren't used." The container still runs; it just has no cgroup of its own, so a per-container memory or CPU limit has nothing to attach to. For a build that is a fair trade. For a long-running rootless service it is not; give that its own bus instead.

Ask what the unprivileged path is missing

Elevation is a cheap experiment, and that is the danger in it: it changes several things at once, so its success says nothing about which one mattered. A rootless tool that fails is often naming a missing facility in words that never mention it. Give that facility to the unprivileged path and keep root for work that needs authority, which is the direction least privilege runs anyway. Here the small key was beside the lock the whole time: the user's own bus, which clearing one variable hands straight back.

When sudo makes an error vanish, ask which room it moved you into.

In the lab: my account has cgroupfs in its user config, so its builds get no cgroup of their own; every build on record is pushed by the user that built it.

Read next