12

What program starts the per user session dbus-daemon process in GNOME 2 and GNOME 3 (presumably via dbus-launch)? I would like to know because I would like to add a directory to the list of directories that dbus-daemon checks for .service files.

(Obviously if it's a sh program, "sh" isn't the answer I'm looking for ;-)

How could I have answered this question for myself efficiently? What documentation is there on desktop and session startup?

3
  • So, no luck still?
    – mlvljr
    Feb 16, 2013 at 21:06
  • In the future use pstree and pstree -p to see the actual PIDs
    – Pithikos
    Nov 5, 2014 at 12:12
  • Pithikos: per my comment on your answer, those commands don't help if the process has already been reparented to init, as was the case here Jan 17, 2015 at 14:02

3 Answers 3

5

The login manager starts dbus via the Xsession scripts directory. If the use-session-dbus option is set for the Xsession, then the dbus Xsession script is loaded, and it runs dbus-launch --exit-with-session $session_command.

7
  • 1
    So if dbus-launch starts the session manager, then the session manager is not the program that starts dbus-launch, so that doesn't appear to answer the question? Oct 29, 2012 at 19:46
  • 2
    As it happens the reason that I want to add a directory that is checked for .service files is that I'm doing a non-root install. So I can't create session-local.conf. I can always start a second dbus-daemon, but I'd like to avoid that if possible (partly for parsimony, partly because it seems dbus-launch processes get left behind after the program that it ran exited, so it's not easy to write a well-behaving shell alias that runs a program using dbus-launch). Oct 29, 2012 at 19:48
  • 1
    Why do you need to install a .service file at all? Do you actually need to use the activation feature of dbus? Your question doesn't really say what you're trying to do exactly; which would probably be easier to answer, as dbus-daemon/dbus-launch could get started a large number of different ways, depending on what session the user is running.
    – dobey
    Oct 29, 2012 at 21:15
  • 1
    You asked 3 questions. Pick one. :)
    – dobey
    Nov 1, 2012 at 4:06
  • 1
    The first one: What program starts dbus-daemon? Dec 22, 2012 at 18:58
2

Starting of the majority of tasks and services during boot including Dbus daemon is handled by Upstart.

Dbus daemon is not started per user session but on mounting the last local filesystem. Upstart job configuration handling starting/stopping/monitoring of Dbus daemon can be found in /etc/init/dbus.conf.

You can use user job to start Hamster on graphical login.

4
  • 1
    I checked this as accepted answer, then realised that that script starts the "system" dbus-daemon (with argument --system). I hear what you say about not being started per user session, but then why do I have two dbus-daemon processes (in fact, three, but the third one looks less interesting)? One looks like the one started by that init file, the other has argument --session (amongst other arguments) instead of argument --system Mar 9, 2013 at 18:41
  • 1
    That will be specific to your setup. Your question was as per comment 5: What program starts dbus-daemon? More information on starting per session message buss you can find here. Mar 9, 2013 at 19:18
  • 1
    Hi schkovich. That comment was to help out dobey, who seemed unsure whether my "how could I have answered this for myself" was a further two questions rather than, as it was, an invitation/reminder to "teach a man to fish". If you take a look at the original question, you'll see what it's about in more detail: explicitly session, not system. By the way, thanks for your answer: I was happy to upvote it as useful info, even if not directly answering my question. Mar 9, 2013 at 19:28
  • 1
    The most important is that you got the answer to your question and that each of us has learned a bit more about Ubuntu. :) Mar 9, 2013 at 19:35
-1

I will disagree with dobey. The best thing to do is to learn how to find it for yourself.

List all processes and their PID tree structure:

pstree
init─┬─ModemManager───2*[{ModemManager}]
     ├─NetworkManager─┬─2*[dhclient]
     │                ├─dnsmasq
     │                └─3*[{NetworkManager}]
     ├─accounts-daemon───2*[{accounts-daemon}]
     ├─acpid
     ├─avahi-daemon───avahi-daemon
     ├─bluetoothd
     ├─colord───2*[{colord}]
     ├─cron
     ├─cups-browsed
     ├─cupsd
     ├─dbus-daemon
....

So dbus-daemon is started by init. However notice that there is more than one dbus-daemon running.

manos@box:~$ ps aux | grep dbus-daemon
message+   845  0.0  0.0  40668  2620 ?        Ss   10:48   0:03 dbus-daemon --system --fork
manos     2480  0.0  0.0  40248  2428 ?        Ss   10:48   0:01 dbus-daemon --fork --session --address=unix:abstract=/tmp/dbus-o3GMKn9JC1
manos     2569  0.0  0.0  39248  2004 ?        S    10:48   0:00 /bin/dbus-daemon --config-file=/etc/at-spi2/accessibility.conf --nofork --print-address 3

There are namely (at least) two instances of dbus-daemon running. One is started by init and it's system wide and the other is started for the user when he logged in. Watching the full PID tree structure (with pstree) you can visually locate exactly which process started the second instance.

2
  • 1
    Processes whose parent has exited are reparented to init by the kernel. So children of init are in fact not normally directly started by that process. In this case, dbus-daemon is not -- see dobey's answer Dec 29, 2014 at 21:22
  • @CroadLangshan hmm didn't think about that. Thanks for the input
    – Pithikos
    Jan 10, 2015 at 16:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.