`systemctl` commands hang or fail with `Failed to connect to bus: No such file or directory` inside a container or via `su`.
IntermediateTroubleshootingsystemd services and journald
Answer
Likely causes → No systemd running as PID 1 (most containers), or for --user, no XDG_RUNTIME_DIR/user bus because the session was started with su instead of a full login.
Diagnose →
ps -p 1 -o comm=
echo $XDG_RUNTIME_DIR $DBUS_SESSION_BUS_ADDRESS
Fix → In containers, run the process directly (no systemd). For user units, log in properly (machinectl shell user@ or SSH) or set XDG_RUNTIME_DIR=/run/user/$(id -u).
Prevent → Use machinectl shell or sudo -iu user with linger for user-unit management.
More on systemd services and journald
`systemctl status myapp` shows `Main process exited, code=exited, status=203/EXEC`.BeginnerA service fails with `status=217/USER`.BeginnerA service fails with `status=200/CHDIR`.BeginnerA unit fails with `status=226/NAMESPACE`.AdvancedYou edited a unit file, restarted the service, but the old behaviour persists. `systemctl status` shows `Warning: The unit file, source configuration file or drop-ins of myapp.service changed on disk`.BeginnerYou edited `/usr/lib/systemd/system/nginx.service` directly and after a package update your change vanished.Beginner