How to debug failed service activation?
Jon Watte
jwatte at gmail.com
Sun Aug 3 15:23:38 PDT 2014
I'm using a Raspberry Pi, running Raspian.
I am trying to build a simple service in Python using dbus, this service
talks to a battery monitor using SPI and can return the voltage as well as
turn off power to the system.
I have a Python program that correctly registers on the system bus, and
another Python program that can connect over the bus and do RPC to read the
values of the battery and send the off command. This all works when I start
the programs from the terminal window.
However, I have created a .service file for it, and made it accessible by
adding a services directory in /etc/dbus-1/system-local.conf. The service
file has a proper name, path, and user (the user is the system default user
"pi")
When I start the client application, and it tries to activate the service
over the bus, I get an execption that the environment could not be set up.
dbus.exceptions.DBusException:
org.freedesktop.DBus.Error.Spawn.FailedToSetup: Failed to setup environment
correctly
When reading the source of the activation helper, there seems to be four
cases that generate this error, having to do with getting the user pwent,
and setting up the user group. There are four separate error details, but
as you can see, those details are not plumbed through to the client so I
can't read them. Nothing helpful is found in syslog:
Aug 3 15:11:01 raspberrypi dbus[3143]: [system] Activating service
name='net.watte.robots.voltmon' (using servicehelper)
Aug 3 15:11:01 raspberrypi dbus[3143]: [system] Activated service
'net.watte.robots.voltmon' failed: Failed to setup environment correctly
The .service file is available here:
https://gist.github.com/jwatte/32d7ef77f9738dd11c54
The server program is here:
https://gist.github.com/jwatte/2e412dac849a3404186d
The client module is here:
https://gist.github.com/jwatte/57ed2069d2287d4abc3b
I have also created /etc/dbus-1/system.d/net.watte.robots.voltmin.conf,
although I don't know whether this is required or not:
https://gist.github.com/jwatte/950296c8a3fdbe01c13a
And, finally, here is my system-local.conf:
https://gist.github.com/jwatte/c218ee21683faa371e8c
Using dbus-monitor, I cannot actually see the call tho activate this
service; I can just see some name changed signals. I have edited
system.conf to allow root to eavesdrop on anything, not just signals.
I have two questions:
1) How can I read the additional error information about this activation
failure? I want to know which of the four error cases it's actually
hitting, for further debugging.
2) Is there something obvious I'm doing wrong here? Can I use the "pi" user
for this service on the system bus, for example, or is that a problem? In
desperation, I tried adding the "pi" user to the "messagebus" group, but
that didn't help.
Sincerely,
Jon Watte
--
"I find that the harder I work, the more luck I seem to have." -- Thomas
Jefferson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20140803/bb212ca9/attachment.html>
More information about the dbus
mailing list