How do I fix this PulseAudio server crash without rebooting?

On my Ubuntu 12.04, the audio server encounters occasional crashes, so that I'm forced to reboot the system in order to have it play audio.

Alsamixer looks ok, nothing is muted. Moreover, I tried

sudo pkill -9 pulseaudio

and then:

pulseaudio -D

which gave me

E: [pulseaudio] main.c: Daemon startup failed.

Can you help me understand what's wrong?


Solution 1:

Pulseaudio will run on a per-user basis in a default setup. Therefore we do not need root permissions to kill it.

The command to restart/reset a running pulseaudio sound server from a terminal is simply issueing

pulseaudio -k

By doing to the sound server will autospawn and restart immediately in a default setting. You will always get an error if you try to run pulseaudio twice.

To run pulseaudio from command line to read possible errors you will have do temporarily disable the autospawning (see this article for details on how to do this).

Sometimes bad user setting are responsible for a malfunctioning pulseaudio sound server. We may then try to rename the settings directory ~/.pulse (or ./config/pulse in newer releases) before we restart pulseaudio. This directory will then be recreated with default settings.