ubuntu is apparently switching to pulse audio in 8.10 and future releases. Till they get it correct, some fixes for when sound stalls:
sudo /etc/init.d/alsa-utils restart
But sometimes this won’t work if something is really holding on to the sound so do:
#############################################
The Fix
#############################################
## List open files; search for pcm using sudo to search all directories!!
name@comp:~$ sudo lsof | grep pcm
## shows the process id(s) of any sound processes .
## kill them:
name@comp:~$ kill -9 5079
name@comp:~$ kill -9 5080
## restart alsa sound:
sudo /etc/init.d/alsa-utils restart
clears any locked audio usage and allows to restart ubuntu sound with no reboot!
The output of the “sudo lsof | grep pcm” command above may look something like this:
lsof: WARNING: can’t stat() fuse.gvfs-fuse-daemon file system /home/gare/.gvfs
Output information may be incomplete.
pulseaudi 6961 gare mem CHR 116,5 13126 /dev/snd/pcmC0D0p
pulseaudi 6961 gare 43u CHR 116,5 13126 /dev/snd/pcmC0D0p
This fix is based on the locked Ubuntu forum thread here. The key difference is to use “sudo” to get all sound usages.
If this post was helpful to you, please consider clicking an ad below!
Thanks you very much.
Just for that little annoyance, I was to ready to switch to another linux distro.
I wrote a little shell script based on your solution.
#!/bin/sh
for pid in `sudo lsof 2>/dev/null | grep pcm | grep pulseaudio | cut -d ' ' -f 3-3 | uniq`
do
kill -9 $pid
done
sudo /etc/init.d/alsa-utils restart
Hi Georges -
Glad post was helpful.
Thanks for posting your shell script.
I am having better luck over time with Intrepid as they release updates to pulseaudio – though I still have to use this solution for 1 machine occasionally – on those occasions have noticed that firefox has locked the sound.
Thanks for this solution! The crashing audio in Linux is driving me nuts, at least with this I don’t need to reboot if it messes itself up.
Thank you very much ;-)
big help thank you much!
Hey man, thanks for making this available and without a crazy amount of jargon. Worked like a dream without having to pull my hair out (like I did for the past 1.5hrs). Cheers mate