Calling dbus from Apache and getting the X11 initialization error.

Thiago Macieira thiago at kde.org
Mon Dec 28 04:16:51 PST 2009


Em Segunda-feira 28. Dezembro 2009, às 04.04.48, Mike MacHenry escreveu:
> I am looking for a work around to the "Autolaunch error: X11
> initialization failed." that it seems a lot of forums have discussions
> about. There have been suggests to solve this problem by setting the
> DISPLAY environment variable, but this does not work for me. I think
> because that trick works for cron jobs but not Apache processes.
> Here's the simple description of my problem:
> 
> I have a DBus server process running. It has an interface with one
> method, skip_ahead, which has no arguments. I run the following Python
> code from a normal user's account:

If that's the system bus that you're talking about, then the X11 
initialisation should not happen. The address of the system bus is known.

But I doubt you're talking about the system bus. You're probably talking about 
the session bus.

To access the session bus, you must have the address of the bus and the proper 
UID. The address is given by the DBUS_SESSION_BUS_ADDRESS environment 
variable, that is set by dbus-launch at the start of the session and is shared 
by all processes in that session. If you don't have that variable set, your 
process probably doesn't belong to the session in the first place (Apache 
processes certainly look like they don't belong).

If the environment variable isn't set, the library tries to use something else 
that is also keyed to the session and that's the X11 display. Your process is 
apparently not able to connect to X11 either.

So, please ask yourself: does your process belong to the session or not?

If it doesn't, you probably want to use the system bus.
-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/dbus/attachments/20091228/455628a0/attachment.pgp 


More information about the dbus mailing list