1 Reply Latest reply on Aug 17, 2019 11:11 AM by Dude!

    OL8: Failed to connect to bus: No such file or directory

    Dude!

      I just noticed the following under OL 8.0.

       

      [vnc-cd4@localhost ~]$ systemctl --user daemon-reload

      Failed to connect to bus: No such file or directory

       

      It seems the problem is that I used "su - vnc-cd4" from the root account.

       

      But using using runuser also doesn't work:

       

      [root@localhost ~]# runuser -l vnc-cd4 -c "systemctl --user daemon-reload"

      Failed to connect to bus: No such file or directory

       

      When I login directly, it works:

       

      $ ssh vnc-cd4@10.0.80.1

      vnc-cd4@10.0.80.1's password:

      [vnc-cd4@localhost ~]$ systemctl --user daemon-reload

      [vnc-cd4@localhost ~]$

       

      If I try su without the dash, the error is slightly different:

       

      [root@localhost ~]# su vnc-cd4

      [vnc-cd4@localhost root]$ systemctl --user daemon-reload

      Failed to connect to bus: Permission denied

       

      I'm currently looking at TigerVNC 1.9 released for EL 8 and the instructions outlined at:

      /usr/lib/systemd/user/vncserver@.service

       

      Any idea how to use systemctl --user coming from root?

       

      I can run "loginctl enable-linger" specifying the user:

      [root@localhost ~]# loginctl enable-linger vnc-cd4

       

      But systemctl --user does not seem to accept a username.

       

      Thanks.

        • 1. Re: OL8: Failed to connect to bus: No such file or directory
          Dude!

          I noticed the following:

           

          ssh vnc-cd4@host

          $ systemctl --user daemon-reload

          $

          $ echo XDG_RUNTIME_DIR

          /run/user/1001

           

          Now the following works:

           

          # su - vnc-cd4

          $ systemctl --user daemon-reload

          Failed to connect to bus: Permission denied

           

          $ uid=$(getent passwd vnc-cd4| cut -d: -f3)

          $ export XDG_RUNTIME_DIR=/run/user/${uid}

           

          $ systemctl --user daemon-reload

          $

           

          It appears the missing XDG_RUNTIME_DIR is the reason for the error when using su.

           

          XDG_RUNTIME_DIR is an environment variable set automatically when you log in and points to store small temporary files. it is set by pam_systemd(8). See man pam_systemd for more info.