I'd like to start a python script that uses pydbus
to listen for incoming commands via D-Bus on boot, and it needs root permissions. It would be nice if it can be stopped and restarted via systemctl
, so I don't want to put it into /etc/rc.local
.
The script is based on this example.
I can run the script just fine in a terminal, both in an X11 session and in tty, and send commands to my dbus server. But when starting it via a systemd .service
file it complains about gi.repository.GLib.Error: g-io-error-quark: Cannot autolaunch D-Bus without X11 $DISPLAY (0)
, because I have been using SessionBus. So I went to using SystemBus instead and now get permission errors: Connection ":1.474" is not allowed to own the service
which is probably associated with the conf in /etc/dbus-1/system.d/
.
So I looked at some other service to see how they work:
/usr/share/dbus-1/system-services/org.manjaro.pamac.daemon.service
/etc/dbus-1/system.d/org.manjaro.pamac.daemon.conf
/usr/lib/systemd/system/pamac-daemon.service
Is this all the stuff that I need to use? It's just so incredibly troublesome, and everything I try results in new errors.
Are there any good resources on how to do this?
How would one start the linked example above on boot using a systemd .service
file?
The name was not provided by any .service files
errorGDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Rejected send message