Linux – systemd user mode error on CentOS 7.0 (1406) server


I'm trying to run systemd user mode on CentOS 7.0 server (no X11 installed).

systemctl --user start hw.service

it reacts:

Failed to get D-Bus connection: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11

If I add

export DISPLAY=:0

and run again, it reports:

Failed to get D-Bus connection: /bin/dbus-launch terminated abnormally without any error message

Can anyone shed light on this? btw, systemctl –version reports:

systemd 208


Best Answer

CentOS doesn't support "systemd --user". Their packages outright remove that part of systemd. (Notice how there's no user@.service, among other things.)

That said, the libdbus' autolaunch error message is misleading, and your $DISPLAY is wrong.

The error message really says "[systemctl couldn't reach systemd at the private address, so it asked libdbus to use the session bus, but] there was no session bus address explicitly set, so libdbus tried to autolaunch one, but couldn't do that either".

Now, if you were trying to use D-Bus session autolaunch, then just setting $DISPLAY wouldn't be enough – it would expect an X11 server like Xorg to already be running at :1 or such (in which case, $DISPLAY would already be set).

But systemctl --user doesn't really want autolaunch – it expects to find systemd at a specific location, /run/user/$UID/bus and /run/user/$UID/systemd/private – so launching a new bus would be useless as it wouldn't have systemd there. So recent versions no longer use autolaunch (or libdbus for that matter).