D-Bus is killing me

Mystilleef mystilleef at gmail.com
Sun Dec 17 16:34:40 PST 2006

On 12/17/06, Matthew Johnson <dbus at matthew.ath.cx> wrote:
> On Sun, 17 Dec 2006, Mystilleef wrote:
> >
> I'm not a python bindings specialist, so these comments are from a
> general point of view.
> > 2). Doesn't like Root and I don't know why.
> >
> > My application won't run as root because of D-Bus. I get this cryptic
> > error message everytime I attempt to run it as root:
> Generally you cannot access a session bus as root. This is because root
> normally doesn't run a session bus and you cannot connect to the session
> bus as any user other than the one which owns it. sudo <dbus process>
> just doesn't work. This is a security measure.
> If you are trying to access a user's bus, this just won't work. If you
> aren't, then it's likely there just isn't a bus running as root with
> DBUS_SESSION_BUS_ADDRESS set appropriately. I agree the error message
> isn't great. This is, as you surmise, mostly down to the python
> bindings.

So do I need to manually start a new bus when running as root? If so,
how do I go about this?

> > 3). D-Bus Isn't re-entrant.
> >
> Lastly, you said you were trying to do dbus calls within the same
> process. Most of the time as has been said, there's not a lot of reason
> for doing this, since you can just call the methods directly (of course
> there are exceptions).

I explained my reason in a prior email. I'll re-post excerpts of it.

My application, a text editor, can spawn multiple instances of itself.
I use D-Bus to ensure all instances use the same process. I also use
D-Bus for inter-instance communication. For example, via D-Bus I can
show users all open documents, and allow them to manipulate the
documents (e.g close a specific document, focus a specific document
window, close all running instances, switch quickly between documents etc).
Perhaps my D-Bus usage is unconventional and uncommon.


More information about the dbus mailing list