Many GNU/Linux distros come with autostarts configured that are not needed for most users and are a privacy and security risk (even if small). In principle, it makes sense to only autostart things one actually needs to reduce the likelihood of crashes, the number of irrelevant log entries, the hardware resource consumption, and the attack surface (for example due to potential vulnerabilities in any of the software or ports they listen on).
A problem is that when upgrading packages or the distro like Debian, the autostart could be enabled again. What is the best way to permanently disable autostarting without removing the package (which often isn't even possible anyway as the autostarting package comes shipped with some other needed package).
At various questions each about one particular undesired by-default-autostarting software different methods to disable the autostart have been recommended:
- Removing (or moving) the file in the autostart folder like so for the Orca screenreader
sudo rm /etc/xdg/autostart/orca-autostart.desktop - Something like
systemctl --user disable at-spi-dbus-bus.serviceas recommended here for the screenreader KDE Accessible or for the geolocation tracker geoclue-demo-agent.desktop - Removing the executable flag so it needs to first be manually set (with
+x) whenever one wants to run the app likesudo chmod -x /usr/bin/kdeconnectd && pkill kdeconnectdor for Debian12sudo chmod -x /usr/lib/x86_64-linux-gnu/libexec/kdeconnectd && pkill kdeconnectdas recommended here for the wireless communication listener KDE Connect - Copying the .desktop file to the .config folder and changing things so that it doesn't autostart (ironically that makes it show up in KDE's System Settings->Autostart while it wasn't shown there before) for example like so
cp /etc/xdg/autostart/org.kde.kalendarac.desktop ~/.config/autostartand then changingcrc:General:Autostart:trueto false:falsein the file in ~/.config as recommended here for Calendar Reminders or addingHidden=trueto that file as recommended here - Renaming the file in
/etc/xdg/autostart/tofilename.desktop.disabled - Removing it from the D-Bus autostart services
/usr/share/dbus-1/services/or putting a modified version into~/.local/share/dbus-1/services/ - A combination of the above such as removing the file from the autostart folder but leaving a .config file that should disable the autostart if it gets restored by some upgrade (especially a distro upgrade).
Now I don't know which way to use and all the ones I tried seem to get reset after an upgrade. The .desktop file can get overwritten if the package gets upgraded.
systemctl --user mask [email protected]seems to work for me to disable the service generated from/etc/xdg/autostart/pulseaudio.desktop. (Haven't tried this one, but I'd guesssudo systemctl --global mask [email protected]could work to make it apply across all users.)