jwallace.us

tech, tunes, and other stuff

ALSA Sound Fix

Every time I install a new version of Slackware Linux I get hit with the same problem: sound works for root, but not for other users.  Google for “ALSA sound” and you’ll see I’m not alone.  Its not just a Slackware problem, its a KDE problem, and more specifically it has to do with ALSA – the Advanced Linux Sound Architecture – which is used by KDE.

There can actually be a couple of problems at work here.

The first place to look is user permissions.  By default, the root user has all the permissions needed to do anything on the system,  but new users need to have permissions individually granted.

After creating a new user. edit (as root) the /etc/groups file.  Update the user’s permissions to belong to the audio group.  While you’re at it you might as well add other groups such as video, floppy, cdrom, plugdev, etc.. to the users that you want to have access to those resources.

If you still have no sound, then ALSA may be confused as to which device it should use as the default sound device.  You can fix that by setting up a resource file for ALSA to use when it starts up.

So, cat the /proc/asound/cards file.  You’ll get something that looks like this:

/proc/asound/cards
1
2
3
4
[email protected]:/# cat /proc/asound/cards
0 [Intel          ]: HDA-Intel - HDA Intel HDA Intel at 0xf9100000 irq 22
1 [U0x46d0x8c9    ]: USB-Audio - USB Device 0x46d:0x8c9 USB Device 0x46d:0x8c9
                     at usb-0000:00:1a.7-2, high speed

In the user’s home directory, create a .asoundrc file like this:

.asoundrc
1
2
3
4
5
6
7
8
9
# use Intel as default device
   pcm.!default {
   type hw
   card 0
}
   ctl.!default {
   type hw
   card 0
}

Note that you can also do it this way specifying the name of the device instead of the number:

.asoundrc
1
2
3
4
5
6
7
8
9
# use Intel as default device
   pcm.!default {
   type hw
   card Intel
}
   ctl.!default {
   type hw
   card Intel
}

Thats it.  Restart the sound system & you should have sound.