D-Bus
D-Bus (short for "Desktop Bus" is a software bus that allows inter-process communication (IPC), service management and remote procedure calls. Its lack of configurability and automatic launching of services with no obvious way to prevent the loading of those "services" make it akin to malware.
Preventing D-Bus Services From Launching[edit]
Many services provided by desktop environments are launched by D-Bus on modern systems.
Desktop environments used to start services like notification daemons with .desktop
files in /etc/xdg/autostart/
. Those .desktop
launcher files can contain a line with OnlyShowIn=XFCE;
or OnlyShowIn=GNOME;KDE;XFCE;Unity;
that will ensure the .desktop
file is only launched in the desktop environments they are meant for. It is also possible to create a file in $HOME/.config/autostart
with a name corresponding to the name of a file in /etc/xdg/autostart/
and the contents:
[Desktop Entry] Hidden=true
in order to prevent services listed in .desktop
files in /etc/xdg/autostart/
from loading.
D-Bus can not be configured to only start services under a specific desktop environment. What this means is that D-Bus .service
files in /usr/share/dbus-1/services
will be loaded under any desktop environment and there is no desktop-environment specific way to prevent those services from loading when an application requests it. The result of that is that you may get 3 different notification dameons started if you have multiple desktop environments installed.
You can ensure that a service listed in a D-Bus .service
is not loaded by masking it. Doing so it not very strait-forward. Let's say you want to prevent /usr/share/dbus-1/services/org.kde.kglobalaccel.service
from starting. That can be done with:
systemctl --user mask 'dbus\x2d:1.2\x2dorg.kde.kglobalaccel.slice'
Notice how you need to refer to the service you want to mask as dbus\x2d:1.2\x2d
followed by the service name.
Masking kglobalaccel
may be ideal if you are only using a non-KDE desktop environment like Mate or Xfce. Making all the Mate-specific services because you are using Xfce regularly will cause problems the few times you want to test Mate.
The ideal solution would be to be able to have a line in D-Bus service files restricting them to desktop environments. That would give users control so RedHat, who is in charge of developing D-Bus, will never allow that. And they would prefer that you only use GNOME and not have multiple desktop environments installed anyway.
The only good and efficient way to prevent D-Bus from starting services from desktop environments you are not using at the moment in the desktop environment you are using is to not have the competing desktop environments installed. That's not a good solution and it is stupid that this problem exists but it is what it is.
Enable comment auto-refresher