Project

General

Profile

disable pulseaudio with systemd

nona - about 2 months ago -

Many know that pulseaudio --kill does not always work. Sometimes, the solution is to add autospawn=no to the client.conf in the system's or user's configuration. Recently, I found that SystemD adds another layer of WTF, and would like to share how I solved it.

Search for this file in pacman's list of packages

pacman -F pulseaudio.service

The files belong to pulseaudio

extra/pulseaudio 15.0-4 [installed: 16.1-1]
usr/lib/systemd/user/pulseaudio.service

See if there are more files related to pulseaudio

ls -l /usr/lib/systemd/user/pulse*
There are 3 annoying files
rw-r--r- 1 root root 1123 Aug 7 23:08 /usr/lib/systemd/user/pulseaudio.service
rw-r--r- 1 root root 149 Aug 7 23:10 /usr/lib/systemd/user/pulseaudio.socket
rw-r--r- 1 root root 426 Aug 7 23:14 /usr/lib/systemd/user/pulseaudio-x11.service

One would expect that disabling the services would remedy the situation... comes in SystemD WTF (it won't).

This /should/ disable pulseaudio for the user

systemctl --user disable pulseaudio.socket pulseaudio.service pulseaudio-x11.service

After reboot, pulseaudio keeps starting (mostly because of SystemD's sound.target; I care not). Therefore, a workaround is to rename the freaking services (each upgrade to pulseaudio will need to be ammended):

Rename SystemD's files

for i in ls /usr/lib/systemd/user/pulse*; do mv "$i" "$i".bak; done

Better alternatives are appreciated.