[systemd-devel] systemctl --user fails because no D-BUS.

Flavio Leitner fbl at sysclose.org
Thu Mar 24 18:31:53 UTC 2016


On Thu, 24 Mar 2016 20:01:23 +0200
Mantas Mikulėnas <grawity at gmail.com> wrote:

> On Thu, Mar 24, 2016 at 6:21 PM, Flavio Leitner <fbl at sysclose.org> wrote:
> 
> >
> > Hi,
> >
> > I am trying to create services and timers per user but on a recent
> > CentOS minimal installation it doesn't work out of the box:
> >
> > $ ssh <server>
> > server$ systemctl --user daemon-reload
> > Failed to get D-Bus connection: No such file or directory
> >  
> 
> First check `systemctl status user@$UID.service` to make sure you actually
> *have* a `systemd --user` instance, as some distros have ripped it out
> entirely.

$ id
uid=1000(centos)

$ systemctl status user at 1000.serviceuser at 1000.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)

No service, checking the RPM:
# rpm -ql systemd | grep 'user at .service' 
<nothing>
# rpm -q systemd
systemd-219-19.el7_2.4.x86_64

Fedora has that apparently:
$ rpm -ql systemd | grep 'user at .service' 
/usr/lib/systemd/system/user at .service


> Some other systems don't configure pam_systemd for ssh, so check `loginctl`
> to see if systemd-logind was told about your login (that's what triggers
> the automatic start of user at .service).

That seems fine: 
# loginctl list-users | grep 1000
      1000 centos          

> Also check if $XDG_RUNTIME_DIR exists (normally it should point at
> /run/user/$UID), and if $XDG_RUNTIME_DIR/systemd/private exists (should be
> a Unix socket).

Also seems to be fine:
$ export | grep XDG_RUNTIME_DIR
declare -x XDG_RUNTIME_DIR="/run/user/1000"

> > I found some websites talking about creating a session with dbus-launch
> > command, but that is packaged by dbus-x11, so it didn't make too much
> > sense for me as I am not using anything related to x11.
> >  
> 
> `systemd --user` does not use a session bus anyway, as it runs outside any
> sessions. It will try to start a "user bus" if the system's dbus is
> configured to support it (as in Debian's "dbus-user-session"). It will also
> listen on a private socket in $XDG_RUNTIME_DIR/systemd/, whether a user bus
> is available or not.

That is very helpful and makes sense with my debugging so far.
 
> (Neither the user bus nor XDG have anything to do with "x11 vs non-x11".)

Yup, but I got confused by the error message and the package's name :-)

I've looked at the systemd rpm's changelog and found this:
- everything: remove traces of --user (#1071363)

It seems one can't delete an user because a process (systemd-$user) is
left behind.

Thanks a lot!
-- 
fbl



More information about the systemd-devel mailing list