I have a feeling that it means that pulseaudio is not actually running at the time you are running pactl. I’m seen this error when pulseaudio is started manually, and then after some idle time it exited. Thus it’s most likely configuration issue?
This particular issue I got fixed by adding
exit-idle-time = -1 to
/etc/pulse/daemon.conf, so it does not stop after the default 20s idle time. Tested it with something like this:
ENV INITSYSTEM on
RUN apt-get update && \
apt-get install pulseaudio alsa-utils mplayer wget
RUN echo "exit-idle-time = -1" >> /etc/pulse/daemon.conf
RUN wget https://mp3d.jamendo.com/download/track/15655/mp32/ -O test.mp3
CMD pulseaudio --start && while : ; do mplayer -ao pulse test.mp3; done
Two main comments. First, this is horrendous playback, it’s popping and skipping around in the track, it plays, but RPi needs some more adjustments to the
daemon.conf to play back properly.
Second, I’m sure the startup would be better with systemd done properly. I’ve seen that ArchLinux uses socket activation by default, that should start things up on demand?
Just some thoughts, this is definitely not the full solution yet, would love to hear your feedback!