Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 77504

Summary: Start DBUS session bus on KDE session start
Product: Gentoo Linux Reporter: Ikke <eikke>
Component: [OLD] GNOMEAssignee: Gentoo KDE team <kde>
Status: RESOLVED FIXED    
Severity: enhancement CC: andreas.w.simon, andrsd, bdonlan, charliecompany, dju, ed, eva, gentopia, kzimmerm, ladanyi, mafteah, marat.buharov, mmacleod, nzgreen, rockoo, Sander.Sweers, ssuominen, x11, xavier
Priority: Lowest    
Version: unspecified   
Hardware: All   
OS: All   
URL: http://code.eikke.com/index.php?dir=misc/&file=gdm-xsession-dbus.patch
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 88043    
Attachments: /etc/X11/xinit/xinitrc.d/30dbus-launch.sh

Description Ikke 2005-01-11 04:16:54 UTC
This patch changes GDM's Xsession in a way a DBUS session daemon is started when a session is started, and stopped when the session is closed.

At this moment not so many programs use the DBUS session daemon, but they're coming.
Comment 1 Joe McCann (RETIRED) gentoo-dev 2005-01-11 15:20:34 UTC
At this point it probably isn't a good idea to start the session daemon just because the user has dbus installed. It is something that we will need to look into for the future though, as you said more apps will be getting dbus support. Now that portage has the newuse feature, we could maybe add a dbus flag which would add this option.
Comment 2 Ikke 2005-01-12 02:52:21 UTC
Actually that's what I was thinking off: create the "dbus" USE flag (I'm working on DBUS-izing some applictions these days), and just apply the patch if GDM is emerged with this flag set.
Of course it should dep on sys-apps/dbus too then ;-)
Comment 3 foser (RETIRED) gentoo-dev 2005-01-12 04:56:43 UTC
I'm not in favor of adding/using a dbus flag for trivialities like this, users will want it if it's used unconditionally. If you don't have dbus it won't get started & if you do have it, then gnome will likely use it at some point, but right now there is nothing in the tree that uses a session daemon so thats why I didn't add it.
Comment 4 Kai Zimmermann (RETIRED) gentoo-dev 2005-01-20 10:19:14 UTC
When starting dbus-launch it crashes because of missing the directories /usr/lib/dbus-1.0/service and /usr/lib/dbus-1.0/services.

Maybe the dbus ebuild should take care of this?

kai
Comment 5 Ikke 2005-01-20 10:25:36 UTC
I guess that's something wrong at your side. I got a session bus running here all time, with some apps running on it, using latest ~x86 dbus ebuilds. System bus (with hal on it) works great too.
I did notice the Tomboy (I guess it was that one, cant check now caus I copied them over) service description files are installed in some faulty location (ie not the same one as written inside session.conf).
Comment 6 gad.kadosh 2005-02-04 04:52:25 UTC
I can confirm that Ikke's patch works great. Is it not better to have a /etc/X11/Xsession.d directory with sessions scripts that are sourced by /etc/X11/gdm/Xsession (or whatever). That way the dbus ebuild can put its script in that folder so dbus starts for every new session?
Comment 7 Genady Okrain 2005-02-16 03:42:56 UTC
What about kde users?
Comment 8 Ed Catmur 2005-02-16 08:35:16 UTC
Re comment 6: there already exists a directory for this purpose, /etc/X11/xinit/xinitrc.d/

I am currently using:

$ cat /etc/X11/xinit/xinitrc.d/30dbus-launch.sh
#!/bin/sh

eval `dbus-launch --sh-syntax --exit-with-session`
export DBUS_SESSION_BUS_ADDRESS
export DBUS_SESSION_BUS_PID

This seems to be the accepted convention; if merged with USE=xprint xorg-x11 puts /etc/X11/xinit/xinitrc.d/92xprint-xpserverlist.sh in that directory.
Comment 9 Ed Catmur 2005-02-16 08:36:17 UTC
Created attachment 51349 [details]
/etc/X11/xinit/xinitrc.d/30dbus-launch.sh

Much simpler than patching GDM.

This can be installed by the dbus ebuild directly.
Comment 10 gad.kadosh 2005-02-16 09:06:23 UTC
I don't seem to have a /etc/X11/xinit/xinitrc.d/ directory on my system, though I'm using xorg-6.8.0-r4 and GDM. are you sure about what you are talking about?
Comment 11 Ikke 2005-02-16 09:08:10 UTC
@Ed: nice catch.
@Gad: I got a dir like that, with some xprint file in it. Maybe you haven't got the xprint USE flag, and isn't the directory created by the ebuild?
Comment 12 gad.kadosh 2005-02-16 09:25:03 UTC
indeed the xprint USE flag is not on my system, I will try to create the dir manually to see if it works...

Ikke: it works for you?
I knew of this method in other distros but thought gentoo does not work with it because I didn't have that dir...
Comment 13 gad.kadosh 2005-02-16 09:32:45 UTC
I just tried that... I created the dir and put the script in it - but dbus is not started.
Comment 14 Ed Catmur 2005-02-16 09:38:20 UTC
You may need to make it executable. I'll look to see where they're sourced from.
Comment 15 Ed Catmur 2005-02-16 09:41:00 UTC
Yes; gdm sources them thus:

/etc/X11/gdm/Xsession:
# run all system xinitrc shell scripts.
if [ -d /etc/X11/xinit/xinitrc.d ]; then
    for i in /etc/X11/xinit/xinitrc.d/* ; do
        if [ -x "$i" ]; then
      . "$i"
        fi
    done
fi
Comment 16 gad.kadosh 2005-02-16 09:51:25 UTC
Yes I was hasty. execute made it work - that's the best fix for it IMO. now it should be added to the dbus ebuild...
Comment 17 foser (RETIRED) gentoo-dev 2005-03-06 14:02:28 UTC
added a session script to 0.23.2-r1 , please cheack & test.
Comment 18 foser (RETIRED) gentoo-dev 2005-03-07 04:47:48 UTC
according to spyderous xinitrc.d is a RH-ism we don't really support, so we really shouldn't be using it.
Comment 19 Ed Catmur 2005-03-07 04:59:27 UTC
Is there an alternative? I note that xorg-x11+xprint installs 92... to both /etc/X11/xinit/xinitrc.d and /etc/X11/Xsession.d - should dbus do the same?

wrt comment 17, shouldn't the session script export the variables?
Comment 20 foser (RETIRED) gentoo-dev 2005-03-07 05:34:45 UTC
There is no alternative to our knowledge.

the --sh-syntax should already do the exporting, it seemed redundant to me.
Comment 21 Ikke 2005-03-07 06:08:41 UTC
--sh-syntax doesnt do the exporting itself, it only printf()'s the variables you should export in a SH-compliant way (theres also the --csh-syntax flag). So depending on the place where you call it, eval()'ing it can be necessary.
Comment 22 gad.kadosh 2005-03-07 10:23:05 UTC
does this solution work with GDM only or all others login managers? does it affect startx too?
Comment 23 Scott McKenzie 2005-03-28 23:01:32 UTC
This script does not kill my session daemon when I log out of GNOME.  Does it do that for anyone else?
Comment 24 Scott McKenzie 2005-04-02 13:48:15 UTC
Adding myself to CC list.
Comment 25 Andreas Simon 2005-05-12 02:37:47 UTC
Answer to comment #22:
No this script doesn't work with kdm or xdm because their various Xsession scripts doesn't source the scripts in /etc/X11/xinit/xinitrc.d/ , i.e. they miss the code snipplet from comment #15.
Comment 26 collin wang 2006-03-21 19:11:26 UTC
(In reply to comment #8)
> Re comment 6: there already exists a directory for this purpose,
> /etc/X11/xinit/xinitrc.d/
> 
> I am currently using:
> 
> $ cat /etc/X11/xinit/xinitrc.d/30dbus-launch.sh
> #!/bin/sh
> 
> eval `dbus-launch --sh-syntax --exit-with-session`
> export DBUS_SESSION_BUS_ADDRESS
> export DBUS_SESSION_BUS_PID
> 
> This seems to be the accepted convention; if merged with USE=xprint xorg-x11
> puts /etc/X11/xinit/xinitrc.d/92xprint-xpserverlist.sh in that directory.
> 

I don't have the same file, but i do have the 30-dbus file. So integrating the two, i get: 

[code]

BeTaBoXjFS xinitrc.d # cat 30-dbus
#!/bin/bash

# launches a session dbus instance

dbuslaunch="`which dbus-launch 2>/dev/null`"

if [ -n "$dbuslaunch" ] && [ -x "$dbuslaunch" ] && [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then

  eval `$dbuslaunch --sh-syntax --exit-with-session`

# added from http://bugs.gentoo.org/show_bug.cgi?id=77504

        export DBUS_SESSION_BUS_ADDRESS
        export DBUS_SESSION_BUS_PID
#

fi

[/code]

Hope it helps!
Comment 27 Gilles Dartiguelongue (RETIRED) gentoo-dev 2006-06-12 23:51:22 UTC
what is the status of this bug ?
I have the script installed (running ~x86) and the session bus is launched and stopped the right way.
Comment 28 Doug Goldstein (RETIRED) gentoo-dev 2006-06-17 08:04:28 UTC
We include this script now. Gnome works fine for a while... other WMs work fine if they process the xinitrc.d dir... I think only KDE is busted..

<genstef> ln -s /etc/X11/xinit/xinitrc.d/30-dbus /usr/kde/3.5/env/dbus.sh
<genstef> basically that is needed
<Flameeyes> genstef, i'm not sure if that is correct
<genstef> use hal && dosym /etc/X11/xinit/xinitrc.d/30-dbus ${KDEDIR}/env/dbus.sh
<genstef> why not?
* zzam has quit ("KVIrc 3.2.3 Anomalies http://www.kvirc.net/")
<Cardoe> Flameeyes: the correct thing is for KDE to process xinit stuff
<Flameeyes> Cardoe, exactly my point
<sekretarz> Cardoe: if you can check it i'd be apriciate
<Cardoe> however for now... Gentoo needs to do the hack
<Flameeyes> Cardoe, i suppose it's quite simpler to change the other thing
<Flameeyes> startkde script is the one to fix
* mabi (n=mabi@p54B878FA.dip.t-dialin.net) has joined #gentoo-dev
<Flameeyes> i think i can do that easily, but i'm not sure if carlo has put the patches for the tarballs in CVS, so he might be the only one able to prepare them correctly

That's the revelant part of the discussion.

Re-assigning to KDE herd since it's waiting on them now.
Comment 29 Diego Elio Pettenò (RETIRED) gentoo-dev 2006-06-17 08:10:36 UTC
I have a patch that should work, waiting for genstef to test (I can't right now), and then I'll commit it.
Comment 30 Donnie Berkholz (RETIRED) gentoo-dev 2006-06-20 22:39:01 UTC
*** Bug 132782 has been marked as a duplicate of this bug. ***
Comment 31 Saleem Abdulrasool (RETIRED) gentoo-dev 2006-06-28 00:34:14 UTC
*** Bug 138101 has been marked as a duplicate of this bug. ***
Comment 32 Doug Goldstein (RETIRED) gentoo-dev 2006-06-30 07:14:29 UTC
Flameyes and genstef have fixed this issue.
Comment 33 MaratIK 2006-09-13 03:33:31 UTC
it is not work for launching gnome from startx (not using gdm)

solution:
add this code to /etc/X11/xinit/xinitrc

# run all system xinitrc shell scripts.
if [ -d /etc/X11/xinit/xinitrc.d ]; then
    for i in /etc/X11/xinit/xinitrc.d/* ; do
        if [ -x "$i" ]; then
      . "$i"
        fi
    done
fi
Comment 34 Doug Goldstein (RETIRED) gentoo-dev 2006-09-13 16:10:49 UTC
It should be started by the Gnome Session script.
Comment 35 Donnie Berkholz (RETIRED) gentoo-dev 2006-09-13 19:32:54 UTC
Someone's working with me on a more generalized solution now (see -dev list xinit thread), it'll probably be a while before we can get where it needs to be.