Failed to connect to bus: No such file or directory (systemctl --user / timedatectl)
The command needs the D-Bus/systemd bus, which isn’t available in this session — common over su, sudo -u, cron, containers or WSL.
Seen on:
Linux
Meaning
systemctl --user needs the user’s systemd instance and XDG_RUNTIME_DIR. Switching users with su/sudo doesn’t create a login session, so the user bus isn’t there. Containers and WSL without systemd have no system bus at all.
Common causes
- su/sudo -u to another user (no login session/XDG_RUNTIME_DIR)
- Running inside a container or WSL without systemd
- dbus service not running
- Linger not enabled for user services
⚡ Quick fix
- Log in as the user directly (ssh user@host) or use machinectl shell user@
- Set XDG_RUNTIME_DIR=/run/user/$(id -u)
- Enable lingering: loginctl enable-linger user
Detailed fix by platform
Linux
- bash
sudo loginctl enable-linger deploy sudo machinectl shell deploy@ /bin/bash export XDG_RUNTIME_DIR=/run/user/$(id -u) systemctl --user status
How to diagnose
- Session — loginctl list-sessions
- Runtime dir — echo $XDG_RUNTIME_DIR
- PID 1 — systemd?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in Linux
Other ways to find it
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026