Running pulseaudio system-wide with pacmd on Arch

While pulseaudio is, by default, run for each user session (socket-activated, or manually started with systemctl –user start pulseaudio), some scenarios can require having an always-running, system-wide pulseaudio instance. The official documentation on freedesktop.org describes how to achieve that and the drawbacks it implies.

At this point, pulseaudio should work already (try gst-launch pulsesrc ! fakesink -v to check).

4. Enable –disallow-module-loading

The official documentation states: “If the system-wide mode is enabled it is advisable to disable module loading during runtime by passing –disallow-module-loading to the daemon, to inhibit the user from loading arbitrary modules with potentially vulnerable code into the daemon. However, this might break some modules like module-hal-detect which will load a sound driver module each time HAL signals that a new sound card became available in the system.”

I first tried to run with –disallow-module-loading, and the alsa configuration was messed up; even aplay -l or arecord -l were failing. The trick seems to be to add –disallow-module-loading only after a first successful use.

5. Disable –disallow-module-loading to use pacmd

This was the hardest to figure out: if you want pacmd to work, you cannot run pulseaudio with –disallow-module-loading (which is recommended by the official documentation), or you will get: