Launching a systemd service through dbus

Karim Moukoko Edimo Moudeke karim.moudeke at vosker.com
Tue Aug 20 19:36:56 UTC 2024


Hi all!

I would like your help on some issue I am facing regarding dbus and systemd. The environment is an embedded linux system generated by yocto.

I have a dbus client application and a dbus server application. Let's call them DbusClient and DbusServer.
DbusClient calls upon D-Bus methods provided by DbusServer.
DbusServer is down by default and is launched through D-Bus by the first method call by DbusClient.
The associated configuration files for DbusServer are set as follows:

com.foo.DbusServer.service
[D-BUS Service]
Name=com.foo.DbusServer
Exec=/bin/DbusServer
User=root

com.foo.DbusServer.conf
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy user="root">
<allow own="com.foo.DbusServer"/>
<allow send_destination="com.foo.DbusServer"/>
</policy>
</busconfig>

In this first scenario, I am not implementing any systemd services:

  *
I launch DbusClient
  *
I trigger an event that makes DbusClient call a method provided by DbusServer
  *
DbusServer is launched
  *
The method is successfully executed

This scenario works well.

In the second scenario, I am setting DbusServer as a systemd service:
com.foo.DbusServer.service
[D-BUS Service]
Name=com.foo.DbusServer
Exec=/bin/false
User=root
SystemdService=DbusServer.service

DbusServer.service
[Unit]
Description=DbusServer daemon
After=network.target dbus.service

[Service]
Type=dbus
BusName=com.foo.DbusServer
ExecStart=/bin/DbusServer
com.foo.DbusServer.conf stays the same.

In this case, it unfolds as follows:

  *
I launch DbusClient
  *
I trigger an event that makes DbusClient call a method provided by DbusServer
  *
DbusServer is launched as a systemd service
  *
The method is not successfully executed

I do not know the reason why the method is not executed as expected when using systemd. Am I missing something ?


Thank you,
Karim

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dbus/attachments/20240820/5923e7f8/attachment.htm>


More information about the dbus mailing list