Difference between revisions of "Sound troubleshooting"

From Linuxintro
imported>ThorstenStaerk
imported>ThorstenStaerk
Line 1: Line 1:
So you want your Linux system to play sound, but it does not? Follow these steps to analyze and maybe solve the problem:
+
So you want your Linux system to play sound, but it does not? Follow these steps to analyze and solve the problem:
  
 
= If your cables and volume are okay =
 
= If your cables and volume are okay =
 
* make sure your system "sees" a sound device:
 
* make sure your system "sees" a sound device:
  ls /dev/dsp
+
  ls /dev/dsp*
must list /dev/dsp, the sound card device file.
+
must list a sound card device file, e.g. /dev/dsp or /dev/dsp1.
  
 
* Test if your sound card driver and cables are okay
 
* Test if your sound card driver and cables are okay
Line 17: Line 17:
  
 
== If you do not hear a sound ==
 
== If you do not hear a sound ==
 
 
If you do not hear a sound, see if you get an error message.  
 
If you do not hear a sound, see if you get an error message.  
  
 
=== If you do not get an error message ===
 
=== If you do not get an error message ===
 
 
If you do not get an error message, it can be a driver issue. To find out, delete all sound devices and re-create them:
 
If you do not get an error message, it can be a driver issue. To find out, delete all sound devices and re-create them:
 
  tweedleburg:~ # rm /dev/dsp*
 
  tweedleburg:~ # rm /dev/dsp*
Line 28: Line 26:
  
 
=== If you get an error message ===
 
=== If you get an error message ===
 
 
If you get an error message like this:
 
If you get an error message like this:
 
  tweedleburg:~ # dd if=/dev/urandom of=/dev/dsp
 
  tweedleburg:~ # dd if=/dev/urandom of=/dev/dsp

Revision as of 22:20, 31 October 2010

So you want your Linux system to play sound, but it does not? Follow these steps to analyze and solve the problem:

If your cables and volume are okay

  • make sure your system "sees" a sound device:
ls /dev/dsp*

must list a sound card device file, e.g. /dev/dsp or /dev/dsp1.

  • Test if your sound card driver and cables are okay
dd if=/dev/urandom of=/dev/dsp

or

while true; do yes; done | dd of=/dev/dsp

The first command throws random bytes into the sound device, the second one uses the "y" byte. The "y" sound is more pleasant to the ears, but with other soundcards than mine, it might not even be audible.

If you hear a sound

If you hear a sound, your cables and drivers are okay.

If you do not hear a sound

If you do not hear a sound, see if you get an error message.

If you do not get an error message

If you do not get an error message, it can be a driver issue. To find out, delete all sound devices and re-create them:

tweedleburg:~ # rm /dev/dsp*
tweedleburg:~ # udevtrigger

Check again with dd if=/dev/urandom of=/dev/dsp. If you still do neither get an error message nor sound, it is most probably a driver issue. Get yourself a USB soundcard and proceed.

If you get an error message

If you get an error message like this:

tweedleburg:~ # dd if=/dev/urandom of=/dev/dsp
dd: opening `/dev/dsp': Device or resource busy

You should find out what process blocks your sound card. Do this with the command lsof (list open files):

tweedleburg:~ # lsof | grep dsp              
mplayer   18251       root    4w      CHR              14,35               14320 /dev/dsp2

You see, mplayer is blocking /dev/dsp2, you third soundcard. Now find out what soundcard you are using:

tweedleburg:~ # ll /dev/dsp*
lrwxrwxrwx 1 root root       9 Jun 21 10:38 /dev/dsp -> /dev/dsp2
crw-rw---- 1 root audio 14, 19 Jun 21 10:36 /dev/dsp1
crw-rw---- 1 root audio 14, 35 Jun 21 10:36 /dev/dsp2

/dev/dsp points to /dev/dsp2, so the soundcard you are using is blocked by mplayer. So, kill mplayer if you are sure that is what you want:

killall mplayer