Sound problem is not new in Ubuntu. I have previously written on various ways to fix “no sound” issue in Ubuntu. But the sound issue I am going to discuss here is different than those mentioned in the other article.
So I installed Ubuntu, actually re-installed it. As always, I did all those things to do after a fresh install of Ubuntu and than I realized that the system had no sound. While investigating the issue I found one strange thing. I checked alsamixer and it was in a weird state:
As you can see, HDMI is set by default in alsamixer. Which means by default HDMI output has been selected instead of the built in speakers. This is why I get no sound from the built in speakers in my system.
Use the following command to check the state of alsamixer:
alsamixer
If alsamixer is set by default to HDMI or some other audio output, continue this article to see how can we fix it.
Fixing no sound in Ubuntu when HDMI is set as default
Now to force Ubuntu to use analog output instead of HDMI by default, we need a little information. Open a terminal and use the following command:
aplay -l
This will list the devices, card number etc. Note down the card and device number for analog output. For me the output was like this:
Once you have the required card and device number, make a new configuration file like this:
sudo gedit /etc/asound.conf
The above command will also open the file. Add the following lines to it, replacing with your card and device number of course:
defaults.pcm.card 1
defaults.pcm.device 0
Save the file and restart the computer. You should hear the sound now. Just to mention, this will work for all the Linux distributions such as Linux Mint, Elementary OS, Fedora, Arch Linux etc. As I said previously, this “no sound fix” only works with the case where HDMI is set by default. For other cases, you can read this article about fixing no sound issue in Ubuntu and Linux Mint.
Feel free to use the comment section to let me know if it worked or not or if you have some better trick to handle this such issue. Ciao :)