Opened 15 years ago

Closed 14 years ago

#20505 closed defect (worksforme)

dbus doesn't work

Reported by: vinc17@… Owned by: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Priority: Normal Milestone:
Component: ports Version: 1.7.1
Keywords: Cc: jonas@…
Port: dbus

Description

It seems that dbus is completely broken. Applications that use it, such as gnucash and liferea, output an error:

Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!

and they don't work.

One problem is that /Library/LaunchDaemons/org.freedesktop.dbus-system.plist refuses to work (without any error message!!!) if a file /opt/local/var/run/dbus/pid already exists. Since

/opt/local/bin/dbus-daemon --system --nofork

wasn't running, I tried it from the command line and got:

$ sudo /opt/local/bin/dbus-daemon --system --nofork
Unknown group "netdev" in message bus configuration file
Failed to start message bus: The pid file "/opt/local/var/run/dbus/pid" exists, if the message bus is not running, remove this file

So, I did

sudo launchctl unload -w /Library/LaunchDaemons/org.freedesktop.dbus-system.plist
sudo launchctl unload -w /Library/LaunchAgents/org.freedesktop.dbus-session.plist
sudo rm /opt/local/var/run/dbus/pid
sudo launchctl load -w /Library/LaunchDaemons/org.freedesktop.dbus-system.plist
sudo launchctl load -w /Library/LaunchAgents/org.freedesktop.dbus-session.plist

Now, everything seems to be OK: a ps auxww shows

messageb  9449   0.0  0.0    27940    716  ??  Ss    1:15AM   0:00.01 /opt/local/bin/dbus-daemon --system --nofork
root      9454   0.0  0.0    27940    708  ??  Ss    1:16AM   0:00.01 /opt/local/bin/dbus-daemon --nofork --session

and /opt/local/var/run/dbus contains

-rw-r--r-- 1 root messagebus 5 2009-08-01 01:15:54 pid
srwxrwxrwx 1 root messagebus 0 2009-08-01 01:15:54 system_bus_socket

but I still get the same error.

If the bug due to the error about the unknown group "netdev"?

Change History (11)

comment:1 Changed 15 years ago by jonas@…

As you're ps auxww shows, the session bus runs for the user root. That means, your user doesn't have a session bus running and so the error message "Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!" is correct.

The parameter -w to launchctl load removes the disabled-key from the plist. After that it's loaded automatically on startup (launch deamons once per system, launch agens once per user). To prevent a reboot you can simply load the plist as you normal user (not using sudo). My original patch (#17950) for the dbus port which introduced launchd support contained an notice saying exactly that. I've no idea why the current maintainer removed this message in r49300 (line 98 in the old file). Now it tells you explicitly to use sudo, which is wrong as it results exactly in the error you've run into...

Well, maybe not completely wrong, things are a bit more complicated. You need sudo in conjunction with the -w parameter, else the disabled-key can't be removed from the plist-file. But to load launchagents afterwards sudo loads it for the wrong user (for root instead of yours)

HTH, Jonas

comment:2 Changed 15 years ago by jonas@…

Cc: jonas@… added

Cc Me!

comment:3 Changed 15 years ago by vinc17@…

Thanks, this works. So, the documentation needs to be fixed.

Also I'm wondering: can't the session bus be started on demand?

comment:4 in reply to:  3 Changed 15 years ago by jonas@…

Replying to vinc17@…:

Also I'm wondering: can't the session bus be started on demand?

It can, but it due to a bug in 10.4 "Tiger" it works only from 10.5 (hopefully ;-)) upwards. Just change the value of the OnDemand-key in the plist.

Maybe Marcus, the current maintainer, could not only update the documentation in the portfile but also activate on-demand starting on 10.5

comment:5 Changed 15 years ago by vinc17@…

I have Tiger. :( But now I start the dbus session from my .zlogin, so that's not much a problem.

comment:6 in reply to:  5 ; Changed 15 years ago by illogic-al@…

Replying to vinc17@…:

I have Tiger. :( But now I start the dbus session from my .zlogin, so that's not much a problem.

Unnecessary. Once you start it once as a user, on subsequent system restarts, it loads automatically.

comment:7 in reply to:  6 Changed 15 years ago by vinc17@…

Replying to illogic-al@…:

Unnecessary. Once you start it once as a user, on subsequent system restarts, it loads automatically.

This doesn't work on my machine. I need to restart it explicitly after reboot.

comment:8 Changed 15 years ago by tobypeterson

Priority: HighNormal

comment:9 in reply to:  3 ; Changed 15 years ago by Juneappal@…

Replying to vinc17@…:

Thanks, this works. So, the documentation needs to be fixed.

What exactly worked? I made the same mistake (issuing the command with sudo, per compile-time instructions) Is the fix as simple as reissuing those commands with the -w flag?

comment:10 in reply to:  9 Changed 15 years ago by vinc17@…

Replying to Juneappal@…:

What exactly worked? I made the same mistake (issuing the command with sudo, per compile-time instructions) Is the fix as simple as reissuing those commands with the -w flag?

For the second command, do not use sudo. The -w flag seems to be necessary (even though one gets an error message). That is,

launchctl load -w /Library/LaunchAgents/org.freedesktop.dbus-session.plist

comment:11 Changed 14 years ago by raimue (Rainer Müller)

Resolution: worksforme
Status: newclosed

Assuming this is fixed as port notes dbus already contains the -w flag.

Note: See TracTickets for help on using tickets.