Pidgin, purple-remote, and solving the “No existing libpurple instance detected” error

I was Googling around tonight to find an answer to a question I was asked about purple-remote and duplicate status messages in the Pidgin Instant Messaging Client and I ran across many, many people posting messages that they couldn’t get purple-remote to work. They had no problem running purple-remote from a command line, but as soon as they tried to call it from a web page or a cron job or from some other process they started seeing the “No existing libpurple instance detected” error.

The solution to this problem is the same as the solution to my original Update Pidgin IM status on Ubuntu using cron article. purple-remote communicates with Pidgin using DBUS. If you’re running purple-remote from a cron job or from some a process that is not owned by you (for instance, an Apache CGI script being run by the “apache” user) then you need to set the DBUS_SESSION_BUS_ADDRESS environment variable for that process so that it matches the DBUS_SESSION_BUS_ADDRESS environment variable for your login. Once that’s done, any processes run by that user that communicate using DBUS will use the same DBUS session that you’re using, so when the “apache” user runs purple-remote it’ll talk to the copy of Pidgin that you are running.

There are many ways you can disclose the value of your login’s DBUS_SESSION_BUS_ADDRESS value to other programs. The easiest way I’ve found is just to save the value to a file and then have your cron job or Apache CGI script execute that file as a script. Check out the Update Pidgin IM status on Ubuntu using cron article for examples of exactly how to do this.

2 thoughts on “Pidgin, purple-remote, and solving the “No existing libpurple instance detected” error

  1. I thought I might add the following for completeness. I have searched high and low for a solution to the problem mentioned in your headline. In my case, something else was needed.

    I have not been long in my new job. I inherited a CentOS release 5.3 for my desktop.

    It turned out that there was no dbus-launch on my system. This page proved very helpful: http://developer.pidgin.im/wiki/DbusHowto

    It led me to try

    pidgin -d

    which generates heaps of output. It confirmed that

    dbus: Failed to get connection: Failed to execute dbus-launch to autolaunch D-Bus session

    After a little more research, I ran:

    yum install dbus-x11.x86_64

    and now I get:

    purple-remote getstatus
    available

    instead of

    purple-remote getstatus
    No existing libpurple instance detected.

    YMMV.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.