Comment 4 for bug 290647

Revision history for this message
Philip Peitsch (philip-peitsch) wrote :

Yes, I agree this isn't a bug so much as a "feature change"...

A workaround as recommended upstream is to export the DBUS_SESSION_BUS_ADDRESS with the sudo command, i.e., sudo -u $USER DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS <command>

In the case that one is running a script that doesn't *have* the right DBUS_SESSION_BUS_ADDRESS variable, it can be retrieved for an arbitrary user with the following snippet:
DBUS_SESSION_BUS_ADDRESS=$(sudo -u $USER dbus-launch --autolaunch=`cat /var/lib/dbus/machine-id` | grep BUS_ADDRESS | cut -d '=' -f 2-)