You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
nixos/userborn: ordering cycle with var.mount at shutdown when /var is a separate filesystem #597069
With services.userborn.enable and /var on its own filesystem, userborn.service, var.mount, local-fs-pre.target and systemd-tmpfiles-setup-dev.service form an ordering cycle. systemd breaks it at shutdown by dropping one of the stop jobs, a different one each time (seen: userborn.service, var.mount, systemd-tmpfiles-setup-dev.service).
The links (start order):
userborn.service has StateDirectory=userborn, which implies RequiresMountsFor=/var/lib/userborn, so it is ordered after var.mount.
userborn.service is Before=systemd-tmpfiles-setup-dev.service.
systemd-tmpfiles-setup-dev.service is Before=local-fs-pre.target.
var.mount is ordered after local-fs-pre.target (default mount dependencies).
At boot there is no cycle, because /var is already mounted in the initrd (pathsNeededForBoot), so var.mount gets no start job. At shutdown all four get stop jobs.
The state directory is only used for previous-userborn.json, i.e. with users.mutableUsers = true.
Steps to reproduce
A system with services.userborn.enable = true, users.mutableUsers = false, system.etc.overlay.enable = true (immutable) and /var as a separate filesystem (ZFS dataset with mountpoint=legacy here).
Boot with systemd.log_target=console, then shut down.
Expected behaviour
No ordering cycle. For example, only set StateDirectory when users.mutableUsers is true (the only case that writes to it), or create the directory without the implicit mount dependency.
Screenshots
No response
Relevant log output
userborn.service: Found ordering cycle: systemd-tmpfiles-setup-dev.service/stop after local-fs-pre.target/stop after var.mount/stop after userborn.service/stop - after systemd-tmpfiles-setup-dev.serviceuserborn.service: Job systemd-tmpfiles-setup-dev.service/stop deleted to break ordering cycle starting with userborn.service/stop[ SKIP ] Ordering cycle found, skipping Create Static Device Nodes in /dev
Additional context
Also seen on 26.05 ([ SKIP ] Ordering cycle found, skipping /var). No stall, the shutdown continues.
Workaround with immutable users, verified: no cycle at shutdown, and a switch still re-runs userborn. The legacy import is disabled too, since its ConditionPathExists=!/var/lib/userborn relies on the state directory:
Activity