Configuring and Troubleshooting Sound in Debian Linux

How to get sound working in Debian

The sound system has low level drivers (ALSA) and daemonds above them that figure out which program should get access first. Today things are in transition to using alsa and jack for really quality sound without the problems of the past.

What to install

alsa-base ALSA driver configuration files
alsa-modules ALSA driver modulesalsa-oss
ALSA OSS-compatibility libraryalsa-source
ALSA driver sourcesalsa-utils
ALSA utilities
alsamixergui graphical soundcard mixer for ALSA soundcard driver
alsaplayer PCM player designed for ALSA
alsaplayer-com PCM player designed for ALSA (common files)
alsaplayer-gtk PCM player designed for ALSA (GTK version)
alsaplayer-jack PCM player designed for ALSA (jack output module)
alsaplayer-oss PCM player designed for ALSA (OSS output module)
snd-gtk-alsa Sound file editor (GTK+ user interface)
vlc-plugin-alsa ALSA audio output plugin for VLC
alsaplayer-jack PCM player designed for ALSA (jack output module)
jack Rip and encode CDs with one command
jackd JACK Audio Connection Kit (server and example clients)

What to configure


#lspci | grep audio

This should tell you what audio card you have

Get module-assistant and run it and select the audio card from the list (you can fix an error here by running dpkg-reconfigure alsa-source)

Stick the followign in .bash_profile

richard -d alsa &

>> this fails to work all the time right now - let me know if you get Jack working well under KDE (3.2 right now)




Then run

#alsactl store

then run


In KDE (3.2 for now) set sound system to use ALSA (Advanced Linux Sound architecture)

ALSA Configuration in Debian

ALSA, the Advanced Linux Sound Architecture, is both a project and a body of software. The project was started because the OSS architecture is technically weak in some respects, and the free variant of OSS (see OSSFree) lacks some drivers available only in the commercial variant. For several years the ALSA software was developed separately from Linux. The drivers were added to the Linux codebase during the 2.5 development series and became the standard sound driver system in Linux 2.6.

ALSA is not just a set of sound drivers; it is also a library with an extensible API that gives applications access to the latest features of sound cards (e.g., multiple sound channels, Dolby [AC3], etc.). ALSA provides efficient support for many applications (e.g., XMMS), is fully modularized, is wiki:Self:SMP and thread-safe.

Applications written for OSS can be made to work with ALSA by means of either userspace emulation (using the aoss program loader) or kernelspace emulation (the snd-*-oss drivers). However, you cannot use both ALSA and OSS drivers at the same time.

N.B. ALSA driver names always start with snd- .

Required Packages







Loading modules

Recent alsa-base packages are designed to "just" work with hotplug and discover. The alsa-base package does not load modules; instead, hotplug or discover detects the sound hardware and loads the right ALSA modules and then alsa-base takes care of setting usable mixer levels.

You can also run alsaconf. This program uses a different method of detecting hardware and if it thinks it has figured out what module is needed, it generates a /etc/modutils/sound or /etc/modprobe.d/sound file (depending on whether you are running Linux 2.4 or 2.6, respectively). With the latter file in place, the module in question will be loaded when the "snd" module is loaded. It suffices then to load the snd module in order to load the driver module for your specific hardware. To make use of this module loading mechanism you probably need to add "snd" to /etc/modules.

You can also try to detect and configure your sound card manually.

If you have a PCI soundcard, do an 'lspci -v' to list all available pci devices. The list will most probably include a reference to a multimedia audio device: that is your SoundCard.

If you use a ISA PNP card, utilize the command pnpdump

For a USB card, use hotplug.

You could now have a look at the ALSA soundcard matrix to find out which driver name can be used for the chipset you found.


If your system is already configured to load OSS drivers for your sound card then look at your current module loader configuration files. There will be entries for the OSS modules which will give you clues about which chipsets your sound cards have. Don't forget to disable these entries before reconfiguring things to load ALSA modules.

If you don't unload all OSS modules then ALSA modules will not be able to initialise (or work properly) because the OSS driver will be futzing with the sound hardware that the ALSA driver needs to control. If you see a message about "sound card not detected" and you are sure you have the right ALSA driver, the presence of an OSS module could be the reason.


Test the driver, using aplay, mplay or xmms for example

To test midi, you can use aplaymidi.

Sharing a card among multiple processes

It is often desirable to be able to share a sound card among several processes running at the same time. This requires the ability to mix the sound outputs of those processes into a single stream.

If your cheap sound card doesn't support hardware mixing try the dmix plugin. This has been set up automatically since libasound2 version 1.0.10-2; in prior versions, look at /usr/share/doc/libasound2/examples/asound.conf_dmix to see how to enable DMIX in /etc/asound.conf (for all users) or ~.asoundrc (for your user).


To see what indexes have been assigned to cards, run:

cat /proc/asound/cards

The first card that ALSA finds is usually given index 0 and thus is usually the 'default' sound card. If you are unlucky then the first sound card found is one that it not suitable for playing system sounds. There are two ways to fix this problem.

1. Force the cards to load in a different order. I chose this route, and added the following to my /etc/modprobe.d/sound:

options snd-trident index=0
options snd-usb-audio index=1

This forces my Trident card to be the default (card 0) and my USB microphone to be card 1.

2. Change the default card by editing /etc/asound.conf or ~/.asoundrc


Look at /proc/asound/version.

Common Sound Problems in Debian with Solutions

Want to enable sound on Debian? Have two sound cards to make things worse?

This is the most trickiest part and irritating job on linux. The Debian packages are completely broken and go by this manual method.

Alsa is one place where you can find drivers for most of the chipsets and you can first see if your audio chip has a driver available here. Then download the alsa-drivers, alsa-libs, alsa-utils and do a ./configure and make install them, the same sequence

You can put the below lines in your /etc/modutils/alsa file. I have an Analog Devices 1885 and a SoundBlaster PCI 16 on my system. I would like to use the SB-PCI 16 by default.

alias char-major-116 snd
alias char-major-14 soundcore
alias snd-card-0 snd-card-ens1371
alias sound-slot-0 snd-card-0
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss
alias snd-card-1
alias sound-slot-1 snd-card-1
alias sound-service-1-0 snd-mixer-oss
alias sound-service-1-1 snd-seq-oss
alias sound-service-1-3 snd-pcm-oss
alias sound-service-1-8 snd-seq-oss
alias sound-service-1-12 snd-pcm-oss
options snd snd_major=116 snd_cards_limit=2 snd_device_mode=0660 snd_device_gid=29 snd_device_uid=0
options snd-card-ens1371 snd_index=0 snd_id=CARD_0

Do /etc/init.d/alsasound start. If needed, do a modprobe of snd-mixer-oss, snd-pcm-oss, snd-seq-oss.

If you do a 'cat /proc/asound/sndstat', you should see something like,

Sound Driver:3.8.1a-980706 (ALSA v0.9.0beta10 emulation code)
Kernel: Linux debian 2.4.16 #24 SMP Fri Mar 1 23:48:20 CST 2002 i686
Config options: 0

Installed drivers:

Type 10: ALSA emulation

Card config:
Ensoniq AudioPCI ES1371 at 0xcf00, irq 11

Audio devices:


Midi devices:
1: ES1371

7: system timer

1: mixer10

Congratulations, you are all done with the sound now. Just do a alsa mixer and set the sound levels by using arrow keys and "M" for mute/unmute.

Sound works wells as 'root', but not as user

I don't know why don't these things be taken care of automatically by alsa, but you need to do this - if having a problem.

# chmod o=+rw /dev/mixer*
# chmod o=+rw /dev/dsp*

Or you can add the specific users (who need to play sound on the system) into the group 'audio' using 'usermod'

Why does my volume become 'muted' on every boot?

Append these lines to your /etc/rc.d/rc.local or /etc/init.d/alsasound

/usr/bin/amixer set Master 50 unmute >/dev/null 2>&1
/usr/bin/amixer set PCM 50 unmute >/dev/null 2>&1
/dev/null /usr/bin/amixer set CD 50 unmute >/dev/null 2>&1

Have a proper working sound configuration, but don't hear any gnome sounds?

Give suid permission to the 'esd' binary and start 'esound' as a daemon process. Check if you are present in the group 'audio' on your system. If you still don't hear any gnome sounds, start the 'esd' binary as 'esd &' and try out! After starting Gnome, if you don't see any output for "ps aux | grep esd", enter these lines in /etc/esound/esd.conf

spawn_options=-terminate -nobeeps -as 5
and the below lines in ~/.gnome/sound/system