I'm about to link this page from my knowledgebase:
'lsof | grep snd -- how to free a linux sound device'
http://linux.dsplabs.com.au/lsof-grep-snd-how-to-free-a-linux-sound-device-p25/
For some months, I've been having a mysterious problem with my Debian
workstation at work, where sound functions fine after reboot for some
period of time, and then ceases to work from that point until the next
reboot. Obviously, this is not a case 'sound driver support never
configured', nor 'sound driver will work once a non-free firmware BLOB
gets fetched and installed'.
It's not even a matter of 'funky sound daemon from a Desktop Environment
is clobbering ALSA' or 'there are multiple sound devices, and apps are
trying to talk to the wrong one'. It seemed likely that some process
was hogging a sound device file and not making it available for other
apps.
The page gives some background on how sound support on Linux has gotten
a little messed up. The old "Open Sound System" (OSS) driver set had
limited hardware support unless you bought the proprietary version.
ALSA (Advanced Linux Sound System) was supposed to fix that while being
backwards-compatible to the old OSS interface. But then 'help' arrived
in the form of more-baroque would-be replacements like esound, that
unspeakable Pulse Audio thing, and others -- all of which I carefully
avoid, for now. It's supposed to be a simple ALSA setup with OSS
backwards compatibility.
The cited page says do:
lsof | grep snd
Good idea. The 'lsof' tool is an ever-useful utility that does a
(sort of) "ls" of Open Files (thus the name), showing what process
has a file (such as a device node) open. Yields nothing in this case,
but, just on a hunch, I did:
lsof | grep audio
Aha. But of libs opened by _pidgin_, the IM client. Also, I read the
cited page more closely, and see that /dev/snd is OSS, while ALSA uses
/dev/snd/* :
rmoen at borgia:/dev/snd$ ls -al
total 0
drwxr-xr-x 3 root root 240 Oct 13 16:55 .
drwxr-xr-x 16 root root 3440 Oct 17 17:48 ..
drwxr-xr-x 2 root root 60 Oct 13 16:55 by-path
crw-rw---- 1 root audio 116, 10 Oct 13 16:55 controlC0
crw-rw---- 1 root audio 116, 9 Oct 13 16:55 pcmC0D0c
crw-rw---- 1 root audio 116, 8 Oct 18 17:40 pcmC0D0p
crw-rw---- 1 root audio 116, 7 Oct 13 16:55 pcmC0D1c
crw-rw---- 1 root audio 116, 6 Oct 13 16:55 pcmC0D2c
crw-rw---- 1 root audio 116, 5 Oct 13 16:55 pcmC0D3c
crw-rw---- 1 root audio 116, 4 Oct 13 16:55 pcmC0D4p
crw-rw---- 1 root audio 116, 3 Oct 13 16:55 seq
crw-rw---- 1 root audio 116, 2 Oct 13 16:55 timer
rmoen at borgia:/dev/snd$
Kill pidgin. Play the test sound file again: Ah, now sound works.
Damn you, pidgin: I didn't want you to touch my sound hardware. Just
shut up, nei? That'll teach me to defer checking an application's
preferences. Open pidgin's preferences, Sounds tab. Change "Method"
from "ALSA" to "No sounds'. Close.