No Sound on Ubuntu (Basic Troubleshooting)
If you can hear anything
If you can hear the login sound but all other sound is not working you should first try Try This First and This may or may not work for you. If you have sound in some applications but not others then you can skip all the way down to the Sound Server Setup section. Either way it means your sound driver is working, lucky you.
If your sound stops
If your sound is generally working Ok but after a while just fades out or stops and you are not doing anything in particular to make this happen, like installing updates or fooling around with the sound settings or the applications and sound returns like normal when you reboot, this seems to be a particular bug in the hda-intel driver or kernel problems with Intrepid so we must wait for it to be fixed and an update made available. You can avoid having to reboot by restarting ALSA and PulseAudio following the directions in ALSA Trouble below for now.
If you sound goes missing after an update
If you just got a bunch of updates and rebooted and your sound no longer works it is most likely because some or all of your sound setting have been reset from where you put them. If you remember how you had everything set up, reset what was changed. If you do not remember… first check your volume controls. Next, go to Try This First below. If you edited some file to get your sound working, check that and reedit as necessary. If you got an application update check its preferences or settings. If you are really lost just go through the guide again. You should also check that your users and root are members of the following groups which you can check in System/Administration/Users and Groups since these sometimes are removed with updates.
Scratchy, glitchy sound
If you have an HDA-Intel device try turning up the PCM slider in the volume control. If PCM is set to 0 it makes the sound scratchy for some of those devices.
Otherwise if your sound is scratchy or stuttering you can edit these lines in the file /etc/pulse/daemon.conf to look like this
default-fragments = 5 default-fragment-size =25
There are also some sound cards/chips that can only be fixed with an ALSA upgrade so you may want to consider that if this does not work for you.
If your sound works randomly
If your sound works sometimes when you boot but not all the time this problem is very common when multiple hadware sound devices are present. Nvidia and ATI include HDMI devices in their gpus now so that means if you have one of them you have multiple sound devices. If you have a USB headset or speakers you have multiple sound devices. If you have a tv card you have multiple sound devices and of course, if you have a plug in sound card and a sound chip on the motherboard you have multiple sound hardware. What happens is that the devices are on the PCI bus and are detected and assigned somewhat randomly. This means that sometimes your motherboard sound chip is detected first and becomes the default and sometimes the HDMI or your plugin sound card or some other device is detected first and becomes the default sound device. In any case, this is an issue withMultiple Sound Devices which is a section of this guide below so you should look in there for help.
No sound at all
There are many links here for specific sound cards/chips and the answer you need may not be in the OP so you should look through the entire thread if it seems to be relevant to your problem. You should also post in that thread instead of starting a new one if possible. (Starting a new thread just fragments information and makes it more difficult for people to find answers so please try to avoid that.) Posting in a running thread will push it the the top and more people will notice it and reply. Someone will be along to help you if they can so please be patient. If you get no answer after one day, it is OK to bump the thread.
If you still have no sound after going through this guide and all the relevant links, you should do a search either in these forums or with google for your specific sound card/problem because there is about a %100 chance that someone has figured out your problem already. You can also try looking in the Mandriva and Fedora and SUSE and Debian forums, there are many smart people there. If you still cannot find any help, it is OK to start a new thread. If you find any information somewhere else that you think others might need, please bring it back.
Missing Volume Controls
If you seem to be missing some items from the volume control in your panel ( the little speaker icon) you most likely just need to make them visible. Right click on the little speaker and choose Open Volume Control. Make sure the Device: xxxxxxxxxx is your hardware device. It should be something like
Device: HDA ATI SB (Alsa mixer) or Device: HDA Intel(Alsa mixer) or Device:C-Media 8768 (Alsa mixer) etc, in other words, a hardware device with an Alsa mixer.
Once you have the proper device selected click on Preferences down at the lower right. This will show you a list of check boxes. Check all the items you want to appear in the volume control and close the box.
Try This First
Go to System/Preferences/Sound and switch everything except Default Mixer Tracks to ALSA or Pulse Audio. if you see …HDMI… in Default Mixer Tracks, change it to your sound card/chip, Realtecxxxx or Emuxxx or ATI SB or HDA INTEL or something like that, anything but HDMI that is not Capture or Playback or OSS.
Right click on the speaker icon on the top panel and choose Open Volume Control. Click File/Change Device and make sure you have the correct device chosen. Go to Edit/Preferences and check the following boxes: Main, PCM, CD, PC Speaker, Mic, mic boost, mic capture, mic boost capture, etc. You may or may not have these and more. In the Playback tab make sure the sliders are up and there are no red x over the little speakers. In the Recording tab, do the same. In the Switches tab check any boxes marked mix, 3D control, mic boost, capture, etc. In the Options tab, make sure the Line in mode and Mic-on mode and any other option is like how you have your speakers plugged in. (Some surround sound outputs are also line in and mic inputs and can be switched here.) Make sure any SPDIF or IEC958 or External Amplifier boxes are unchecked. (With some sound cards/chips these will turn off your sound so for now leave them off.) Close that window, right click on the icon again and choose Preferences. Make sure the device listed in the box is your sound card and select Master. Close the window. Now left click on the speaker icon and move the slider all the way up.
Try to play something, Rythmbox is a good choice, so is totem or mplayer. (Firefox/flash is not such a good choice at this time since it may not be working for other reasons). If you still get no sound, read on.
This may or may not work for you
One easy way that some people have fixed their sound problems is by creating a new user in System/Administration/Users and Groups and then logging in with that. It seems the generic system defaults for new users are different from the initial user defaults that Ubuntu installs. You should try that first before resorting to some of the more drastic steps below, It is a simple thing to do and will make no changes to your system. And if it works, you will know it is just a user configuration problem and you can compare the hidden user default files in the respective home directories to find and fix the problems or just transfer your personal files to the new user directory.
If you still get no sound, get up and walk around for a minute, get something to drink. This could take a while.
OK, sit back down and start reading.