8

Since I've upgraded to Ubuntu 16.04 LTS I have the following problem: When I plug in the headphones they are muted and to resolve this I have to un-mute the "speaker" in alsamixer, as seen in the image.

enter image description here

Is there any way of reverting it to the regular behavior?

Thank you in advance!

5
  • Does that image not have a column "auto mute" when you go to the right? Should be "mic boost" then "beep" then "auto mute". Example in this answer: askubuntu.com/a/542147/15811
    – Rinzwind
    Jun 23, 2016 at 9:46
  • You could try to install PulseAudio: sudo apt-get install pavucontrol. I find it more user friendly than Alsamixer.
    – ipse lute
    Jun 23, 2016 at 10:06
  • 1
    @Rinzwind I tried to play around with the "auto mute" options, but non of them change the sitution.
    – Fibo
    Jun 23, 2016 at 10:56
  • Huh, I'm having the exact same issue on manjaro right now. For now I'm working around the issue with a bash alias for amixer -c 0 set Speaker 100 (if it doesn't work you need to change the value of -c (card) from 0 to something else, 1, 2, 3, etc, until you find a match). Running this whenever headphones are plugged in would technically be a hotfix but it wouldn't fully solve the issue. If I find a way though I'll toss it in as an answer. I also found that whether or not 'speaker' is unmuted doesn't matter, only that it's volume setting is set to 100. It's real bizarre.
    – Cestarian
    Mar 21, 2019 at 11:15

2 Answers 2

2

Edit this file:

/usr/share/pulseaudio/alsa-mixer/paths/analog-output-headphones.conf

Comment this 2 lines just putting a ; in front of the lines

[Element Speaker]
; switch = off
; volume = off

Restart pulseaudio:

killall pulseaudio
pulseaudio --start
0

I have a hotfix, doesn't solve the core issue, but treats the symptoms so to speak (Automatically sets the 'Speaker' channel volume to 100% again everytime headphones are plugged in). On my end, the 'Speaker' channel does not actually need to be unmuted, but it's volume needs to be set to 100 for me to get normal sound. The command I use to do this is

amixer -c 0 set Speaker 100

For those that really do need to unmute the channel it would be:

amixer -c 0 set speaker 100 unmute

First off you need to test this command, if it doesn't do anything, the '-c 0' value is most likely wrong (-c is for card) you can run aplay -l to get a list of all sound devices, you need to find the corresponding 'card number' for your soundcard. (It will normally be 0, sometimes 1, rarely anything else)

Once you confirm that the command is doing what it's supposed to, create the script in: /home/user/scripts/headphonefix.sh

#!/bin/bash
sleep 0.5 && amixer -c 0 set Speaker 100

Where '/home/user' is the path to your home folder. (You can use any path you want though, it's just a suggestion).

Next make the script executable with

chmod +x /home/user/scripts/headphonefix.sh

Now we're halfway done.

I'm not on ubuntu myself (I'm using manjaro) but this 'fix' requires the acpid service to be running (I think it's enabled by default on ubuntu, on arch it's systemctl enable acpid to start it on every boot.)

To check if the acpid service is running, run acpi_listen. If you get a socket error the service is not running, if you just get a blank output, you're golden.

With acpi_listen running plug in your headphones to get the event for it, for me it was: jack/headphone HEADPHONE plug

Now with that information, we can create this file (use sudo): /etc/acpi/events/headphones

Make it's contents look something like this:

event=jack/headphone HEADPHONE plug
action=/home/user/scripts/headphonefix.sh

Where /home/user/scripts/headphonefix.sh is the path to the script we created earlier.

Now to confirm it's all working, we need to restart acpid either by rebooting or running this command:

Ubuntu: sudo service acpid restart

Arch/Manjaro: systemctl restart acpid

Then unplug your headphones then plug them back in, and voila, everything should be 'working' now.

It's not a perfect solution, since it just makes alsa set the speaker channel's volume to 100% again everytime a headset is plugged in, rather than addressing the underlying issue of why this is happening under the hood. But if you just want shit to work like normal, this'll do the trick.

(Note: You will also want to run this script automatically on startup in case your headphones are plugged in on bootup)

1
  • This solution may not work for every device I've found, acpi_listen gets nothing when I plug in my headphones, only when I plug in my earphones, which is extremely bizarre but yeah. The only clue I've got for a proper solution is using hdajackretask, thing is I don't know what configuration is needed so I'm not going to spend time guessing my way through it.
    – Cestarian
    Mar 22, 2019 at 16:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .