Why am I getting this "Connection to PulseAudio failed" error?

I have a computer that runs Mythbuntu 12.04. It has an external USB Kenwood Digital Audio device.

When I open up pavucontrol, I get this message:

pulse error

If I do as the message suggests and run start-pulseaudio-x11, I get this output:

$ start-pulseaudio-x11
Connection failure: Connection refused
pa_context_connect() failed: Connection refused

Error log file, created with these intructions, on Pastebin.

How do I correct this error?


The solution to this problem was discovered in the course of solving my other problem, with Pulseaudio and Flash.

First I needed to completely purge and reinstall Pulseaudio. One way to do this is to run the command:

sudo apt-get --purge --reinstall install pulseaudio

Then, after I had a clean start, I discovered there was this odd entry in /etc/pulse/client.conf. It had a line that said:

autospawn = now

It seems that now is not a valid option. I have no idea where that option was coming from, as I thought I was starting fresh after reinstalling.

I changed it to yes, and then commented it out as well anyway.

; autospawn = yes

Rebooted, and then I was able open pavucontrol without errors.

The lesson I took from this is that purging an application might not be as complete as one would assume it to be.


I'm assuming you've tried deleting ~/.pulse/* and restarting the sound server?

Your second option is to check /etc/pulse/client.conf in /etc/pulse, as suggested in the warning. Make sure everything is set to its default value by commenting out every line with a leading semicolon.

Finally, it could be related to this bug. The work-around here was to start pulseaudio in system mode, by changing the value of PULSEAUDIO_SYSTEM_START in /etc/default/pulseaudio to 1. This will prevent pulseaudio from loading 'default.pa' in your /etc/pulse folder. If this fixes your problem and you are on a multi-user system so don't want to continue running pulse in system mode, then edit your post with the contents of default.pa. Otherwise, just leave it fixed. I don't really see the problem with running it in system mode on a single-user system.


Try this:

rm -r ~/.pulse
rm -r ~/.pulse-cookie
rm -r ~/.config/pulse

There might be errors reported that files could not be found. That's ok. Then we kick pulse and start it again:

sudo pulseaudio -k
pulseaudio --start

There, too, errors might be reported like:

E: [pulseaudio] core-util.c: Home directory not accessible: Keine Berechtigung
W: [autospawn] lock-autospawn.c: Fehler beim Zugriff auf Autostart-Sperre.
E: [pulseaudio] main.c: Failed to acquire autospawn lock

But after a reboot, it worked for me. Pavucontrol is again running fine since then.


Open etc/pulse/default.pa and try commenting out all these lines:

.ifexists module-jackdbus-detect.so
load-module module-jackdbus-detect
.endif

Run the steps again and check the log for changes, if possible give use another output.

If that does not work remove pulseaudio and reboot.