dbus and launchd

Dan Ports dports at ambulatoryclam.net
Wed Jan 20 17:32:39 PST 2010

I've been having a bunch of problems with dbus launching lately. Based
on the number of tickets I found, I haven't been the only one. I
finally found some time to look into it. In my case at least, there
were a couple independent problems.

For reference, dbus starts both a "system bus" which is one-per-host,
and a "session bus" which is per-user (i.e. per-login-session).

1) The dbus system bus creates a pidfile, /opt/local/var/run/dbus/pid,
   meaning that if the system crashes and the pidfile isn't removed, it
   fails to restart. This is exactly ticket #15081, which is resolved
   fixed, but the problem persists.

   I believe the solution here is to not use a pidfile since it's not
   needed under launchd -- I've posted a patch in that ticket.

2) The dbus session bus, which is looked up via launchd, is
   inaccessible from within screen. I think this is because the session
   bus gets started as part of an Aqua session, and screen moves to a
   background session when launching. (I could have something wrong
   here -- I haven't found much documentation on the launchd changes in
   10.6, and Apple has patched screen to undocumented private launchd

   I think starting the dbus launchd job in a Background session
   instead of Aqua would solve my particular problem, but is probably
   the wrong thing to do. IIRC, dbus is supposed to be per-GUI-session.
   I suspect the real problem here is with screen, but I don't see how
   to fix it either way. Does anyone have any insights?
3) Both launchd jobs have launch-on-demand disabled, I think because it
   didn't work correctly on Tiger. Now that Tiger is borderline
   unsupported, should we reconsider this? (We can make it a platform
   variant to keep from breaking TIger unnecessarily)

   Moving to on-demand would also make it pretty reasonable in my view
   to enable the launchd jobs on port install, eliminating the need for
   users to run two launchctl load commands (of which one needs to be
   run as root and the other *not* as root!)


Dan R. K. Ports              MIT CSAIL                http://drkp.net/

More information about the macports-dev mailing list