1

I know that one can override dbus session services in ~/.local/share/dbus-1/services

But it necessarily won't work for system services.

Under openrc, I don't get systemd's systemctl command therefore :

Is the quick and dirty (because service will be restored on next update) way consisting in renaming the associated service file in /usr/share/dbus-1/system-services, the only way to proceed ?

2 Answers 2

1
+50

I just encountered this same problem, and after digging into the dbus code, I think I have a solution:

Files in /usr/local/share/dbus-1/system-services override the files in /usr/share/dbus-1/system-services. So, to prevent a service from autostarting, you can create an empty file. For example, to make sure dbus never starts login1 automatically:

mkdir -p /usr/local/share/dbus-1/system-services
touch /usr/local/share/dbus-1/system-services/org.freedesktop.login1.service

This also allows you to disable user services globally using /usr/local/share/dbus-1/services.

Another effective method to prevent it from launching services by itself is building dbus with -Dtraditional_activation=false. However, this disables all services.

1
  • Whoa ! This just makes sense. So immediately +1 for that info. I was still waiting for an answer to this problem. I make no doubt it should work since I just verified that updates don't touch /usr/local but I'll test your suggestion asap and if OK will accept your answer, say : splendid! and add a +50 bounty for having shared your work. Thanks.
    – MC68020
    Commented Mar 6 at 20:50
0

Does the D-Bus service have a SystemdService= line pointing to a Systemd unit file, like SystemdService=systemd_unit_name.service?

If yes, you can add a symlink from /etc/systemd/system/systemd_unit_name.service to /dev/null. This is how systemctl mask systemd_unit_name.service works.

Then any attempt to activate the D-Bus service will fail since the linked Systemd service is masked. But you may see some annoying logs in the journal about a failed activation since the service is masked.

If there is no SystemdService= line, you can try adding a symlink from /etc/systemd/system/dbus_unit_name.service to /dev/null (not tested). I assume if there is no alias mapping from a D-Bus unit file named dbus_unit_name.service to a Systemd unit file name systemd_unit_name.service, the D-Bus activation will just look for a Systemd unit file with the same name as the D-Bus unit file, like dbus_unit_name.service.

You can also override D-Bus system services in /etc/dbus-1/system-services/, I believe (again, not tested).

1
  • Thank you for taking car of this problem however you solution presuppose systemd thingies I just do not get since, as stated in OP, I am on an systemd-less (openrc) system.
    – MC68020
    Commented Jan 17, 2023 at 14:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .