0

I have a small server running a minimal centos8. I need to create services as a user and would like to use systemctl to do so. I found I can use systemctl --user to create services without root permission, but any of those commands result in:

Failed to connect to bus: No such file or directory

After a preliminary Google search I found that the culprit is the absence of XDG_ env variables, after adding them manually as in the exports:

$ export -p | grep XDG
declare -x XDG_RUNTIME_DIR="/run/user/1000"
declare -x XDG_SESSION_ID="328295"

I couldn't run systemctl --user anyway, because /run/user/ is empty I guess.

$ systemctl status dbus
● dbus.service - D-Bus System Message Bus
   Loaded: loaded (/usr/lib/systemd/system/dbus.service; static; vendor preset: disabled)
   Active: active (running) since Wed 2021-01-13 14:26:04 GMT; 5h 43min ago
     Docs: man:dbus-daemon(1)
 Main PID: 332 (dbus-daemon)
    Tasks: 1 (limit: 26213)
   Memory: 3.6M
   CGroup: /system.slice/dbus.service
           └─332 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile -->

dbus seems to be running fine the only anomaly I found was:

$ loginctl session-status
328295 - server (1000)
           Since: Wed 2021-01-13 20:00:44 GMT; 10min ago
          Leader: 29745 (sshd)
          Remote: #############
         Service: sshd; type tty; class user
           State: active
            Unit: session-328295.scope
                  ├─29745 sshd: server [priv]
                  ├─29747 sshd: server@pts/0
                  ├─29748 -bash
                  ├─29790 loginctl session-status
                  └─29791 loginctl session-status

Which apprears as sshd is the init process for this session (probably creating problems with dbus?). Just to check I tred:

$ dbus-monitor
Failed to open connection to session bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11

Which seems unreasonable, I souldn't run a Xsession to have dbus working and access to services (anyway the server is headless and no x-server, moreover I run ssh from Windows).

At this point I think there is a problem with sshd, but I don't know what to search for.

3

1 Answer 1

0

What you probably want is dbus-monitor --system

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.