I tweeted yesterday about my centos 5 linux box losing sound (and frankly X, but that’s another story). I tried to use the sound card detector (system-config-soundcard) to find the card again, but it silently failed (typical). The Linux sound howto is over nine years old, so that’s pretty useless. What to do?
Well, I turned to my old friends lsmod, dmesg and strace. I could see tha there were kernel sound modules loaded. I could knew that I had configuration that was working. So I issued the following command:
# strace mpg123 /path/to/mp3file
I got quite a bit of output, but the relevant line was this:
open("/dev/snd/pcmC0D0p", O_RDWR|O_NONBLOCK) = -1 ENOENT (No such file or directory)
And sure enough, this is what was in my /dev/snd directory:
[root@durgan snd]# ls controlC0 hwC1D2 pcmC1D0c pcmC1D1p timer controlC1 pcmC0D0c pcmC1D0p seq
Oh look! There’s no pcmC0D0p file. What to do. I could try to create the missing dev file, but I just symlinked the pcmC1D0p to pcmC0D0p.
And yes, this horrible, horrible hack worked like a charm.
What happened to delete this device file? Why couldn’t I make the system re-detect and re-initialize the sound system? It’s stupid, stupid user issues like this that have plagued linux since 1995 and show no signs of getting better today. This is why you don’t see a lot of linux notebooks or games.