[pulseaudio-discuss] Service fails on systemctl start. Status always "activating"

Karl Stahl karl at soundhound.com
Mon May 22 22:12:37 UTC 2017


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?

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.  I also don't know how to disable the overwriting of ~/.config/pulse/client.conf.

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?


> On May 22, 2017, at 1:30 PM, Tanu Kaskinen <tanuk at iki.fi> wrote:
> 
> On Mon, 2017-05-22 at 13:01 -0700, Karl Stahl wrote:
>> Apparently the "xcb_connection_has_error()" message is caused by my
>> having SSHed to the device.  If I run the same command on the device
>> directly, I don't get that message.  My environment already had that
>> variable set as you suggested:
>> 
>> $ echo $XDG_RUNTIME_DIR
>> /run/user/1000
>> 
>> In any case, I still get the "pa_context_connect() failed" message.
>> 
>> Is pulseaudio running?  Yes:
>> $ ps -ef | grep pulse
>> pi        1050   809  0 11:14 ?        00:00:54 /usr/bin/pulseaudio --daemonize=no
>> 
>> $ PULSE_LOG=99 pactl info
>> xcb_connection_has_error() returned true
>> Using shared memory pool with 1024 slots of size 64.0 KiB each, total size is 64.0 MiB, maximum usable slot size is 65496
>> Trying to connect to /run/user/1000/pulse/native...
>> connect(): Resource temporarily unavailable (11)
> 
> This is the problem. The socket exists, but connecting to it fails. Are
> you perhaps trying to use socket activation? In that case systemd
> creates the socket, but pulseaudio doesn't use it, because 5.0 doesn't
> support socket activation. Removing the .socket file should do the
> trick.
> 
> Why are you trying to use systemd to manage the user instance, by the
> way? The old autospawning mechanism should work fine for automatically
> starting pulseaudio on demand. Raspbian disables autospawning at every
> boot by overwriting ~/.config/pulse/client.conf, though, so maybe
> that's why you're trying this alternative method... In that case, I
> would try to find what overwrites client.conf and disable that thing.
> 
> -- 
> Tanu
> 
> https://www.patreon.com/tanuk
> _______________________________________________
> pulseaudio-discuss mailing list
> pulseaudio-discuss at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss



More information about the pulseaudio-discuss mailing list