Fix GConf Exception Failed to contact configuration server with dbus-launch


gconf-error
If you try to run an application as root or another user and see this error, you’ll quickly find that your saved state fails to load and your application spits out the error at least once if you run it on the command line. You can usually work around the “problem” by using the other user’s session variables by using sudo or calling su with a minus sign to inherit their environment.

Conf Exception caught: Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See http://projects.gnome.org/gconf/ for information. (Details - 1: Failed to get connection to session: Failed to connect to socket /tmp/dbus-5FcF7XIfAN: Connection refused)

I've seen this problem in Ubuntu and Fedora. But I'm sure it's been a problem at some time or another for anyone running Gnome.

Permissions on ~/.dbus

The easiest fix, one which works 90% of the time is to fix the permissions on, or delete, the .dbus directory from your home directory. If you ran something as root and it took control of the session file in your .dbus directory, this will immediately fix the problem. If that didn't work, check the DBUS_SESSION_BUS environment variable and make sure you're not still seeing your old path which will point to the user you're logged into the desktop as. This is normal behavior when you don't use the minus sign on su, because you're _supposed_ to keep your environment when you do it this way. Normal behavior - will not fix!

dbus-launch

But of course... Sometimes nothing seems to work, and you still need a fix. dbus-launch fixed this problem for me.

Run the offending application with dbus-launch which forces a new dbus session bus to spawn for this application. Don't skip the option or you'll end up with multiple dbus sessions left running in no time.

This also happens when you're not running X but you want to spawn a dbus session and it's complaining it can't connect to an X server.

Use dbus-launch to spawn a session for all your pythonista needs.



One thought on “Fix GConf Exception Failed to contact configuration server with dbus-launch

  1. Thanks a lot. The “dbus-launch –exit-with-session ./my-app” trick worked for me.
    Hopefully, I’ll figure out what caused the problem in the first place and how to avoid it in the future.
    I think it happened for me after using “sudo mount someNFS”.

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">