You are not logged in.

#1 2012-09-18 18:45:27

visakh
Member
From: Kerala, India
Registered: 2012-09-18
Posts: 4

DBus: Cannot access system bus as unprivileged user

Hi everyone,

I am setting up an Arch installation on a laptop in pure systemd configuration. I have installed an XFCE desktop, but some functionality is missing. For example, shutdown/restart options are not available from the DE, and policykit is inoperational. After a lot of tinkering, I am able to nail down the problem to dbus. I am unable to access the dbus 'system bus' as an unprevileged user. For example, when using the systemctl command as a non-root user, I get

$ systemctl status polkitd.service
Failed to get D-Bus connection: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

This happens to all applications/commands that try to access the system bus. The same problem happens in the other direction too. Root user is unable to access the session bus. However, the normal user is able to access its own session bus, and the root user is able to access the system bus normally.

With even more search, the error was found to be of type org.freedesktop.DBus.Error.NoReply. This also seems to happen during dbus_bus_register() operation. The dbus daemon seems to be sending back the error message. I am unable to identify the cause for this error myself and I can't find useful results from searches. Any help is appreciated.

Gokul

Last edited by visakh (2012-09-18 18:45:48)

Offline

#2 2012-09-19 07:38:32

hadrons123
Member
From: chennai
Registered: 2011-10-07
Posts: 1,249

Re: DBus: Cannot access system bus as unprivileged user

How do you start your X?


LENOVO Y 580 IVYBRIDGE 660M NVIDIA
Unix is user-friendly. It just isn't promiscuous about which users it's friendly with. - Steven King

Offline

#3 2012-09-19 13:04:42

visakh
Member
From: Kerala, India
Registered: 2012-09-18
Posts: 4

Re: DBus: Cannot access system bus as unprivileged user

hadrons123 wrote:

How do you start your X?

I have Xfce4 and lxdm installed. I enabled lxdm.service with systemd to get X started right after boot (systemctl enable lxdm.service).

Thanks for the reply,
Gokul

Offline

#4 2012-09-19 13:30:05

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 13,843
Website

Re: DBus: Cannot access system bus as unprivileged user

I've never used lxdm, but I suspect you need to add dbus-launch to the exec line of your window manager.

To test this, first check a process monitor like hop or pstree.  You should have three processes with dbus in the name: 2 dbus-daemon processes (one for user "dbus" and one for your user), and 1 dbus-launch.

If you do not have all three, then modify the Exec line of lxdm's session file as follows

Exec=dbus-launch --exit-with-session <wmname>

where "wmname" is whatever was there before that launches xfce.


InterrobangSlider
• How's my coding? See this page.
• How's my moderating? Feel free to email any concerns, complaints, or objections.

Offline

#5 2012-09-19 16:53:55

visakh
Member
From: Kerala, India
Registered: 2012-09-18
Posts: 4

Re: DBus: Cannot access system bus as unprivileged user

Thanks for the reply, Trilby!

Trilby wrote:

I've never used lxdm, but I suspect you need to add dbus-launch to the exec line of your window manager.

To test this, first check a process monitor like hop or pstree.  You should have three processes with dbus in the name: 2 dbus-daemon processes (one for user "dbus" and one for your user), and 1 dbus-launch.

I think that you are suggesting the way to launch the session bus. If so, I think that the session bus is already running.

$ ps -el | grep dbus
4 S    81   268     1  0  80   0 -  4356 ep_pol ?        00:00:00 dbus-daemon
1 S  1000   492     1  0  80   0 -  3969 poll_s ?        00:00:00 dbus-launch
1 S  1000   493     1  0  80   0 -  4391 ep_pol ?        00:00:00 dbus-daemon

There are 2 dbus daemons running- presumably the system and session buses.
I will post the outputs of dbus-send commands to both buses as root and as a normal user. Hopefully, that may give more insight. All are executed in terminal emulators under Xfce.

Results as normal user on session bus:

$ dbus-send --print-reply --session --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames
method return sender=org.freedesktop.DBus -> dest=:1.17 reply_serial=2
   array [
      string "org.freedesktop.DBus"
      string "org.xfce.Panel"
      string "org.xfce.Thunar"
      string "org.xfce.Terminal4"
      string ":1.10"
      string "org.xfce.Xfconf"
      string ":1.11"
      string ":1.12"
      string ":1.13"
      string ":1.0"
      string ":1.1"
      string ":1.15"
      string "org.xfce.SessionManager"
      string ":1.2"
      string "org.xfce.SettingsDaemon"
      string ":1.3"
      string ":1.17"
      string "org.xfce.FileManager"
      string ":1.4"
      string ":1.5"
      string ":1.6"
   ]

Results as a normal user on system bus:

$ dbus-send --print-reply --system --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames
Failed to open connection to "system" message bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

Results as root on session bus:

# dbus-send --print-reply --session --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames
Failed to open connection to "session" message bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

Results as root on system bus:

# dbus-send --print-reply --system --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames
method return sender=org.freedesktop.DBus -> dest=:1.7 reply_serial=2
   array [
      string "org.freedesktop.DBus"
      string ":1.7"
      string ":1.3"
      string "org.freedesktop.systemd1"
      string "org.freedesktop.login1"
      string "org.freedesktop.PolicyKit1"
      string ":1.4"
      string ":1.0"
      string ":1.1"
      string ":1.6"
      string "org.freedesktop.ConsoleKit"
      string ":1.2"
   ]

I tried as lot of searching with the error message thrown. Unfortunately, the results were hopelessly varied for me to pin down the cause. Anyway, these errors are causing complete failure of policykit. The policykit-authentication-agent fails to run since it can't contact the policykit-daemon on the system bus. Without it, I can't use network manager or shutdown/reboot/hibernate menu in Xfce.

Regards,
Gokul

Offline

#6 2012-09-19 18:04:33

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 13,843
Website

Re: DBus: Cannot access system bus as unprivileged user

Yup, it seems dbus is running properly, so my suggestion can be disregarded.  Sorry I have nothing else to offer.


InterrobangSlider
• How's my coding? See this page.
• How's my moderating? Feel free to email any concerns, complaints, or objections.

Offline

Board footer

Powered by FluxBB