How to manually trigger a bus-activated service?

Ross Boylan rossboylan at stanfordalumni.org
Tue Feb 11 03:38:24 UTC 2025


In brief, if I have a dbus .service file with Name=a.b.c, what
arguments to the dbus-send command do I need to activate it?

In more detail...

I am trying to activate a systemd service by sending a dbus message,
but I'm not sure how to send the message.  I've tried various formats
with dbus-send and qdbus, but the closest I've gotten is
root at barley:~# dbus-send --system --print-reply
--dest=boylan.ross.offsite-backup /boylan/ross/offsite-backup
org.freedesktop.DBus.Introspectable.Introspect
dbus[107334]: arguments to dbus_message_new_method_call() were
incorrect, assertion "_dbus_check_is_valid_path (path)" failed in file
../../../dbus/dbus-message.c line 1366.

I suspect there are 2 issues:

1) I do not know how the arguments in the dbus service file map to the
concepts used in dbus-send or qdbus.  On reflection, I'm not even sure
if they are expecting a message or a signal.
More directly, what arguments to dbus-send will trigger activation of
the service?

2) It seems likely there are some permission issues.  Enumeration
(even as root) doesn't show any boylan.ross... on the system bus.
Ideally activation will be by a regular user.

Can anyone help with either?

--------------------------------------------------------
# File /etc/dbus-1/system-services/boylan.ross.offsite-backup.service
# system.conf modified to have
<servicedir>/etc/dbus-1/system-services</servicedir>
[D-BUS Service]
Name=boylan.ross.offsite-backup
Exec=/bin/false
User=root
SystemdService=boylan.ross.offsite-backup.service

# /etc/systemd/system/boylan.ross.offsite-backup.service
[Unit]
Description=Copy Backup and Important Files to Remote System

[Service]
Type=dbus
BusName=boylan.ross.offsite-backup-service
ExecStart=/usr/bin/python3 /usr/local/sbin/bacula.py --wait --test
--log file,syslog,email
--------------------------------------------------------

Comments:

Sources on the net recommend Exec=/bin/false for the d-bus service,
though the systemd.service man page example has the name of the
service executable there and in the systemd service file.  Since I
don't want to be trying to start it twice, I went with /bin/false.

If ExecStart ever works, my intention is that the program (bacula.py)
will run and exit.  A new activation will cause a new launch.  But
what I've read suggests the program exec'd is supposed to stick around
and catch later signals.  How to approach that?  I suppose in the
worst case systemd would continuously restart the application.

I'm unsure if there is a safe way to force a reload of the
configuration of the system bus for d-bus.  I have restarted the
computer since setting the files described above.

Thanks.
Ross Boylan


More information about the dbus mailing list