with apologies

Restarting pulseaudio when it flatlines

· 1 min read · August 15, 2026 · #linux #nixos

Although it now generally seems to work, audio on Linux seems to have been a consistent mess for decades. The current preference appears to be to use pipewire as a replacement for pulseaudio—but of course, many things still assume the old way, i.e., pulseaudio. Happily pipewire has compatibility layers to support this. Less happily, I’ve had consistent problems with things failing (from audio full stop to just the Sway on-screen display (swayosd) setup I use after upgrading NixOS, and less than consistent success in getting them working again.

I finally seemed to nail down a recipe for fixing these problems when they occur. In retrospect the answer seems fairly obvious though, due to my lack of will to engage properly with systemd, it took me rather a long time to get there. But in short: disable and then re-enable the relevant services, and that seems to recreate the relevant symlinks under ~/.config/systemd/user that presumably were broken by the upgrade.

So without further ado, in yet another act of future-self documentation, I find the following works for me:

SS="pulseaudio.service pulseaudio.socket pulseaudio-x11.service pipewire.service pipewire.socket pipewire-pulse.socket"

systemctl disable --user $SS
systemctl enable --user $SS
systemctl restart --user $SS wireplumber swayosd