Ubuntu – headphones not working?
My old laptop has Ubuntu 20.04 installed. It is upgraded from the previous version, and I think it requires reinstallation since I constantly change something. New tools, new programs installed and removed, programming languages tested, virtual machines, containers, and so on. I can feel that it is not working as well as before, but I don’t want to waste time on reinstallation right now.
During the last weeks, I noticed that my headphones are not always working. Sometimes the issue occurs after waking the computer up from sleep mode, sometimes after a simple screen lock. Sometimes a reboot is enough to make them work, sometimes not.
I thought that maybe this is the connection issue – the hardware is rather old, so are my headphones. I spent some time testing. I even run Windows for some time and found that this is a software issue, not a hardware problem.
Alsamixer to the rescue
Finally, I found that there is a problem with the default mixer, which is available in GUI. Sometimes it simply doesn’t work – the sound is still sent to built-in speakers, even though headphones are properly connected. In order to send my sound to the proper destination, I used Alsamixer. This is a command-line tool, so you have to open your terminal and write:
sudo alsamixer
It can also work without “sudo,” but on some accounts, I had permission issues. The program displays such an interface once executed:
Pay attention to the few elements we see there: there is “Card” information displayed in the top left corner and the list of “channels” in the middle of the screen. The “Card” in the above example is “HDA Intel HDMI,” which is related to the HDMI output of my computer. It is not in use, so there is nothing to set here.
In order to change the selected card, press F6:
In my case, the proper one is “HDA Intel PCH”. Once selected, there is such a set of channels displayed:
The Master channel is the main volume setting. The next two channels are related to Headphones and Headphones Mic. Followed with Headhopnes Mic Boost and Speaker. This is enough for now.
I can see that the speaker volume is set to 100%. The Master volume limits it. The Headphones’ volume is low, but they should work. They should, but they don’t – they are muted. You can tell this by the MM indicated at the bottom of the Headphones channel. So, what can I do?
To move between channels, I can use left and right arrows. The red text indicates the channel that is currently selected. I can change the volume by using up and down arrows. Lastly, I can turn channel Mute status on and off by using the “m” key. So, I changed the headphones volume to 100% (still limited by the Master volume) and turned Mute off. I also set Speaker volume to 0% since I don’t need it to work once I’m using my headphones. Here is how my mixer looked like after the change:
Surprisingly, when I tried to mute the Speaker instead of turning the volume down, the headphones were also not working. I double-checked that Master was not muted (only Speaker was), but it was still not working. So I left it as above. Once the settings are made, you can exit Alsamixer by pressing Esc. The settings will stay unchanged. The issue is that the GUI mixer is still not working properly, so I prefer to leave Alsamixer turned on in the background – to make sure that I will be able to adjust my volume settings should I need it.