After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 546863 - Where does one need to start dbus now?
Where does one need to start dbus now?
Status: RESOLVED FIXED
Product: gnome-session
Classification: Core
Component: gnome-session
2.23.x
Other FreeBSD
: Normal major
: ---
Assigned To: Session Maintainers
Session Maintainers
: 546393 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-08-07 20:38 UTC by Joe Marcus Clarke
Modified: 2008-09-19 12:03 UTC
See Also:
GNOME target: ---
GNOME version: 2.23/2.24


Attachments
re-exec using dbus-launch if there is no session bus (2.12 KB, patch)
2008-08-11 16:31 UTC, Colin Walters
none Details | Review
Updated patch (2.18 KB, patch)
2008-08-31 16:35 UTC, Vincent Untz
committed Details | Review

Description Joe Marcus Clarke 2008-08-07 20:38:56 UTC
In gnome-session 2.23.6, the dbus launching code was removed.  Okay, I can understand this not being the place for it.  However, I'm confused as to where dbus-daemon should be started.  It seems to me that if I was going to start GNOME from ~/.xinitrc, I would add:

dbus-launch --exit-with-session gnome-session

However, what do I do if I want to start GNOME from GDM?  Shouldn't the gnome.desktop which ships with gnome-session have the following:

Exec=dbus-launch --exit-with-session gnome-session

This is what I'm using in the FreeBSD now, and it works, but I'm wondering what is the right solution.
Comment 1 Colin Walters 2008-08-07 21:01:05 UTC
Hi, I would try to start dbus-daemon as soon as feasibly possible in your system.  

In Fedora, we start it with /etc/X11/xinitrc.d/00-start-message-bus.sh.

This ensures that dbus is available even to things which aren't integrated with GNOME (yet) like ssh-agent.

But it probably makes sense as a fallback for gnome-session to start dbus if it isn't already started.
Comment 2 Ray Strode [halfline] 2008-08-07 21:01:50 UTC
The command on the Exec line is automatically run through the Xsession script

Different distros ship different Xsession scripts, but most have something along the lines of

for i in /etc/X11/xinit/xinitrc.d/*; do 
  . $i
done

In fedora we ship a file 00-start-session-bus.sh

that does

if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
  eval `dbus-launch --sh-syntax --exit-with-session`
fi
Comment 3 Joe Marcus Clarke 2008-08-07 21:26:34 UTC
Thanks for the feedback.  But back to this being a bug.  What can be done to make sure dbus-daemon is properly launched for a GNOME session out of the box?  As it stands now, every OS would have to bundle their own non-default solution.  This was working in 2.22.  I think there should be a fallback in 2.24.
Comment 4 William Jon McCann 2008-08-08 17:53:37 UTC
*** Bug 546393 has been marked as a duplicate of this bug. ***
Comment 5 Colin Walters 2008-08-08 18:00:10 UTC
I think the simplest change would be for gnome-session to look for the DBUS_SESSION_BUS_ADDRESS environment variable; if it's not set, re-exec by prepending the current argv: execvp("dbus-launch", "dbus-launch", "--session", argv)

Also of course to prevent infinite recursion make sure argv[0] isn't dbus-launch.

(it can't be one line since you need to generate a new array, but that's the idea...)
Comment 6 Colin Walters 2008-08-11 16:31:41 UTC
Created attachment 116364 [details] [review]
re-exec using dbus-launch if there is no session bus

Initial patch, lightly tested with:
jhbuild run env -u DBUS_SESSION_BUS_ADDRESS strace gnome-session
Comment 7 Vincent Untz 2008-08-31 16:35:23 UTC
Created attachment 117706 [details] [review]
Updated patch

FWIW, we use this patch in openSUSE (that's Colin's patch, which applies to the latest releases).
Comment 8 Vincent Untz 2008-09-01 15:32:39 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.
Comment 9 Ghee Teo 2008-09-19 11:16:19 UTC
I am still seeing this problem on OpenSolaris if I remove the line
eval `dbus-launch --sh-syntax --exit-with-session`
from my Xsession start up script and aloow gnome-session to start up dbus itself.
Vincent, did you check that openSUSE has not started session dbus else where?
I am getting Could not connect to session bus: Failed to connect to socket /tmp/dbus-cthKTikaMY: No such file or directory.

Trussing this show that the file was unlink by the dbus-launch itself. Am wonder if this a race condition.
Comment 10 Vincent Untz 2008-09-19 12:03:01 UTC
(In reply to comment #9)
> I am still seeing this problem on OpenSolaris if I remove the line
> eval `dbus-launch --sh-syntax --exit-with-session`
> from my Xsession start up script and aloow gnome-session to start up dbus
> itself.
> Vincent, did you check that openSUSE has not started session dbus else where?

Well, I didn't have a session bus without the patch, so... :-)

> I am getting Could not connect to session bus: Failed to connect to socket
> /tmp/dbus-cthKTikaMY: No such file or directory.
> 
> Trussing this show that the file was unlink by the dbus-launch itself. Am
> wonder if this a race condition.

Is dbus running? Can you check if you have DBUS-related environment variable set?