"Failed to open audio output" error when trying to send audio from mpd to pulseaudio

Finally, better than pulseaudio daemon mode, the best solution is there: it is about running mpd as yourself (and not mpd user) so you have no problem to use your own session pulseaudio.

A different answer , but tested and also working:
configure pulseaudio to run as "daemon mode" instead of the standard "user mode"

  • in a terminal, run
    sudo gedit /etc/init/pulseaudio.conf
    then uncomment line 20 removing # to get:
    start on runlevel [2345]
    save and quit gedit.
  • Run this 2 commands in a terminal:
    sudo usermod -aG pulse,pulse-access mpd
    sudo usermod -aG pulse,pulse-access your-login
    In the 2nd command, replace "your-login"

Now reboot: hopefully , it will work.

Note: For info, this page lists reasons why you must avoid pulseaudio daemon mode, but i find it ok on a single user pc (especially I see no more cpu/memory usage than user mode).


The XDG_RUNTIME_DIR solution worked for me, but there is no need to create a file in /etc/systemd/system. Just add this line in /etc/init.d/mpd:

export XDG_RUNTIME_DIR=/run/user/1000

I already have specified mpd to run as my own user and "audio" group in /etc/mpd.conf.