Process started via udev rule not emitting signals on session bus of UID=1000

Pratyush Sahay aspratyush at gmail.com
Mon Jan 18 22:04:45 PST 2016


Hello all,

So.. we have a DBus Service that is supposed to be executed upon receiving
a udev event of USB insert. This service is supposed to emit a signal which
is to be caught by its client. The client daemon is already running in the
background, invoked by the terminal of UID=1000.

Scenario # 1 :
When running the service standalone from the terminal (without the udev
event), the flow works fine.

Scenario #2 :
When running the service via the udev event, the service returns an error
on getConnection to SESSION BUS itself, and hence, no signal is emitted by
the service. (as seen by running dbus-monitor)

Scenario #3:
If we explicitly enforce uid in the service (using [1]), the flow via the
udev event also works fine.

My question is :
1) Is there a better way of achieving the flow, without resorting to
enforced uid?
2) I thought exporting the terminal's DBUS_SESSION_BUS_ADDRESS in the udev
rule would be enough to get the service to emit on UID=1000's session bus.
But that didnt work.
3) doing a : `dbus-launch --sh-syntax` before starting the service in the
udev rule lets the service get connection to Session Bus. However, I think
a new session bus is getting created in this case.. as no signal is seen in
dbus-monitor of UID=1000.


[1] http://linux.die.net/man/2/setuid

-- 
Regards,
Pratyush
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20160119/d51e8d28/attachment.html>


More information about the dbus mailing list