Unable to determine the address of the message bus

Havoc Pennington hp at redhat.com
Tue Jan 31 15:27:15 PST 2006


On Wed, 2006-02-01 at 00:26 +1100, Rod Butcher wrote:
> If I've understood you correctly, this needs to be set up when the user 
> logs on to the linux box, so that the per-session messagebus is 
> available for both X and non-X apps, is this correct ?

Well, in principle but I don't know a reliable way to do it for
console-only sessions. In Fedora for example I think we start it only
for X sessions, in the X-specific scripts.

> Working on this premise I added a one-line file to /etc/profile.d/ 
> containing :-
> 
> eval `dbus-launch --sh-syntax --exit-with-session`
> 
> This gets executed whenever I log on to linux, and sets value for 
> DBUS_SESSION_BUS_ADDRESS , and allows gnome-screensaver to run when I 
> eventually start X via gdm.
> Is this a correct technique, i.e. is the messagebus thus started valid 
> right across my user session as you mention above ?

It's correct more or less, but probably not very reliable. You might
make it more robust by adding:
 if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then 
   eval ...
 fi

Since nested login shells are not very hard to end up with.

But anyhow, should more or less work.

Havoc




More information about the dbus mailing list