52

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?

Questioner
  • 6,839

6 Answers6

40

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.

Questioner
  • 6,839
  • 1
    Someone discovered HOW that autospawn = now ended up there? Could it be another instance of sabotage in Linux? 20 upvotes to a mysterious "not valid option installed as default" is, at least, very strange, isn't it? – Rodrigo May 07 '18 at 20:43
  • 11
    Guess: autospawn = no is valid, and perhaps someone used nano, then missed the Ctrl on Ctrl+w to write, just after they changed yes to no and the cursor was still sitting there. – Hendy Nov 17 '18 at 16:34
  • 1
    Uncommenting ; autospawn = yes did the trick for me. – McQuack Sep 07 '20 at 00:58
8

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.

Alexis Wilke
  • 2,707
Peterling
  • 1,159
  • The above steps helped me for an issue in Fedora where a bluetooth headset was immediately disconnecting every time after connection, with error about ad2p protocol being unavailable. Thanks so much @Peterling! – user44 Aug 21 '19 at 20:33
  • Try also pulseaudio -v for verbose output! – Melroy van den Berg May 13 '20 at 23:33
  • The two commands.......'sudo pulseaudio -k' and 'pulseaudio --start' worked for me. After pulseaudio --start I can do 'pactl info' to confirm if pulseaudio is working or not – Bhanu Chander Apr 26 '23 at 04:43
7

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.

ovangle
  • 460
  • Thanks for responding. I've deleted ~/.pulse/* and restarted the sound server. I set PULSEAUDIO_SYSTEM_START to 1. I've set everything in etc/pulse/client.conf to be the default value. I've rebooted after every change to ensure they took hold. Unfortunately, none of them have fixed the problem. – Questioner Nov 17 '11 at 09:11
  • It's my pleasure.

    What model is your audio device? Do you get sound at all out of it, or is it just pavucontrol which are giving this error?

    – ovangle Nov 17 '11 at 09:37
  • ps. could you also post the result of
    'cat /var/log/syslog | grep pulseaudio'
    
    – ovangle Nov 17 '11 at 09:51
  • 1
    Deleting ~/.pulse and starting pulseaudio fixed my problem - when I was inserting my USB headset (Logitech G35) it caused the built in speakers to be removed from the devices list in the sound manager as well as not working itself. – oscode Apr 20 '13 at 12:32
  • Solved mine, too! The problem arose when the bluetooth headset ran out of battery! – Borivoje Petrovic Nov 26 '17 at 00:57
  • ovangle, deleting ~/.config/pulse (and restarting pulseaudio) solved the same problem I had on Fedora!! many thanks! you saved my day. – Maxim Aug 07 '20 at 10:29
5

I received this "Connection to PulseAudio failed" error when there were different values of the XDG_RUNTIME_DIR environment variable.

The pulseaudio server was running with one value, and pavucontrol was running with a different value. Consequently, pavucontrol was looking in the wrong directory for the communication socket created by pulseaudio.

In this case, the solution is to make sure both processes have the same value for the XDG_RUNTIME_DIR environment variable.

mpb
  • 1,355
  • You are my hero, I was using a crontab script to start OBS and couldn't get OBS to connect to audio server, OBS would only has audio if I start it in the desktop environment but not from my server, this solved my issue! – Colin Su Feb 21 '24 at 03:28
4

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.

Bruno Pereira
  • 73,643
0

I recently had this on an old gentoo computer I was upgrading. It turns out I had failed to start the dbus service

# /etc/init.d/dbus start
# rc-update add dbus default

This will probably be an unusual cause of that error dialog.

Mutant Bob
  • 141
  • 1
  • 6