The problem

While trying to fix a minor issue on my Arch system, I seem to have created a bigger one. I don't really know what I did to cause this (more on that later) but pulseaudio seems to crash whenever I try using it.

If I try to play an mp3 file with Clementine, I get:

pa_stream_writable_size() failed: Connection terminated

Vlc seems to be playing but there is no sound output and I get a stream of the following error messages on the terminal window I launched it from:

[0000000001e24418] pulse audio output error: unknown latency: Bad state
[0000000001e24418] pulse audio output error: cannot write: Bad state
[0000000001e24418] pulse audio output error: unknown latency: Bad state
[0000000001e24418] pulse audio output error: cannot write: Bad state

The similar problems I've found online seem to have solutions involving the removal of gstreamer. I would rather not do this since there are quite a few packages depending on it, including Cinnamon, my DE. I also don't see how this could be the problem since the sounds was fine until I started fiddling with it.

The only command I ran that might have affected this was my attempt to add my onboard sound card to the list of cards detected by pulseaudio. Sadly, my machine crashed in the meantime and I had to do a hard reboot so I lost the exact command I ran but it was something along the lines of:

pactl load-module module-alsa-card device_id="0" name="pci-0000_00_05.0" card_name="alsa_card.pci-0000_00_05.0" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes

I am guessing that I used the wrong parameters there and added the same card twice or one of them with a wrong name or similar.

Possibly relevant information

$ pactl list short cards
0   alsa_card.pci-0000_00_1b.0  module-alsa-card.c
1   alsa_card.pci-0000_03_00.0  module-alsa-card.c

When I try to run pavucontrol, I get a brief glipse of my sound cards which is immediately replaced by:

Establishing connection to pulseaudio server, please wait` 

then the cards, then the message etc. This repeats itself a few dozen times until it settles down to:

connection to pulseaudio failed

Attempting to run start-pulseaudio-x11 manually also fails:

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

My /etc/pulse/client.conf file is (header removed):

; default-sink =
; default-source =
; default-server =
; default-dbus-server =

autospawn = no
; autospawn = yes
; daemon-binary = /usr/bin/pulseaudio
; extra-arguments = --log-target=syslog

; cookie-file =

; enable-shm = yes
; shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 MiB

; auto-connect-localhost = no
; auto-connect-display = no

I tried removing relevant packages:

sudo pacman -Rdd pavucontrol pulseaudio pulseaudio-alsa lib32-libpulse libcanberra-pulse 

And, then reinstalling them:

sudo pacman -S pavucontrol pulseaudio pulseaudio-alsa lib32-libpulse libcanberra-pulse

But that made no difference. What else can I try? Ideally, how can I reset pulseaudio to the state it was in yesterday, before I broke it? If the issue is indeed that my pactl command broke it, how can I undo that command?

  • On the bright side, now that pulseaudio isn't working, my onboard card seems to working.
    – terdon
    Jan 3 '16 at 18:16

I managed to solve this with the help of @Takkat through the simple expedient of renaming my pulseaudio config directory:

mv ~/.config/pulse ~/.config/pulse.old

After that, pavucontrol launched normally. I have no idea which file in that directory was screwing things up. In case this is informative to anyone, this is what it contained:

$ ls .config/pulse.old/
cookie                                              e9ec65fd88a04300a02d204ca1e6ff58-default-source
e9ec65fd88a04300a02d204ca1e6ff58-card-database.tdb  e9ec65fd88a04300a02d204ca1e6ff58-device-volumes.tdb
e9ec65fd88a04300a02d204ca1e6ff58-default-sink       e9ec65fd88a04300a02d204ca1e6ff58-stream-volumes.tdb

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.