Just to close this issue out: adding a few seconds of delay to my script worked perfectly. Thank you, Tanu! > On May 23, 2017, at 1:48 AM, Tanu Kaskinen <tanuk at iki.fi> wrote: > > On Mon, 2017-05-22 at 15:12 -0700, Karl Stahl wrote: >> Ah! Sure enough, I had this line in my pulseaudio.service file: >> >> Requires=pulseaudio.socket >> >> I copied this file directly from the Debian source: >> https://sources.debian.net/src/pulseaudio/8.0-2/src/daemon/systemd/user/pulseaudio.service.in/ >> >> Debian trunk must be using a newer version of Pulseaudio than >> Raspbian. It looks like the latest version of Pulseaudio is 10.0. >> Do you know why Raspbian is still using 5.0? > > The Raspbian images provided by the Raspberry Pi Foundation are based > on the latest Debian stable release, and those stable releases don't > happen often. The current Debian stable release still uses pulseaudio > 5.0. > >> This is very interesting! I didn't know that: >> "Raspbian disables autospawning at every boot by overwriting >> ~/.config/pulse/client.conf" >> I actually had tried setting "autospawn=yes" in >> /etc/pulse/client.conf (isn't this the master version of >> client.conf?), but that seems to have no effect. > > If ~/.config/pulse/client.conf exists, /etc/pulse/client.conf won't be > used at all. > >> I also don't know how to disable the overwriting of >> ~/.config/pulse/client.conf. > > I don't know that either. I'd like to disable it on my rpi too. > >> So, now pulseaudio starts at boot, which is fantastic, thank you! >> >> Alas, I am still having a problem. >> Here's my .service file to start my script. >> >> # ---------------- >> # foo.service >> >> [Unit] >> Description=Foo >> Requires=pulseaudio.service >> After=network.target pulseaudio.service >> >> [Service] >> Type=simple >> ExecStart=/home/pi/foo >> Restart=on-failure >> >> [Install] >> WantedBy=default.target >> # ---------------- >> >> If I start it from the command line, it works just fine, but if I >> enable it to run at boot, it doesn't work, and in the logs I see >> this: >> >> ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused >> >> Any ideas? Maybe a timing issue with the ALSA plugin to interface with Pulseaudio? > > No, the alsa plugin is a library that the application loads, not a > thing that needs to be started. > > It could be that pulseaudio is not yet fully ready when your script is > started. This is why Type=notify is useful. > > Try sleeping in the beginning of your script. > > -- > Tanu > > https://www.patreon.com/tanuk > _______________________________________________ > pulseaudio-discuss mailing list > pulseaudio-discuss at lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss