Audio playing out of line-out when headphones are connected and selected

When I plug in headphones, the Sound Preferences panel in Gnome and PulseAudio Volume Control both show Headphones as the selected output. However, I still get audio from my external speakers (Line Out) even when Headphones are selected as the output. (If I select Line Out as the output, I get audio only from the external speakers, not the headphones.) How can I get the system to disable the Line Out output when the Headphones are connected and selected?

I’m happy to provide more information, but I’m not sure what’s useful here; googling gets me a lot of different answers about where to look depending on how the system’s sound infrastructure is set up and I’m not sure what’s applicable to current versions of Fedora.

Fedora 35 uses Pipewire and Wireplumber & and a pipewire-pulsaudio plugin per default.

With inxi -Fzx in terminal, you can see which parts are used/active. See the Audio: section.

Here’s the audio section of the output from inxi -Fzx:

  Device-1: Intel 82801JI HD Audio vendor: Hewlett-Packard
  driver: snd_hda_intel v: kernel bus-ID: 00:1b.0
  Device-2: NVIDIA TU116 High Definition Audio vendor: ASUSTeK
  driver: snd_hda_intel v: kernel bus-ID: 0f:00.1
  Device-3: Logitech Webcam Pro 9000 type: USB
  driver: snd-usb-audio,uvcvideo bus-ID: 2-4:6
  Sound Server-1: ALSA v: k5.15.12-200.fc35.x86_64 running: yes
  Sound Server-2: PulseAudio v: 15.0 running: no
  Sound Server-3: PipeWire v: 0.3.40 running: yes

So it looks like I have ALSA and Pipewire sound servers running. Could they conflict somehow?

I found a couple of pipewire bugs that seem potentially related, but I’m not certain whether my problem is the same as the ones reported:

I don’t have any customizations I want to keep, so ideally I’d like to reset the sound setup to defaults and see if that helps. But I’m not sure how to do that.

It looks like there are instructions to do that here:

whereis wireplumber
wireplumber: /usr/bin/wireplumber /etc/wireplumber /usr/share/wireplumber

This shows you the config files. If you rename them you should have the default settings from /usr/share/wireplumber

I tried logging out and then deleting $HOME/.config/pulse, $HOME/.local/state/pipewire/media-session.d, and $HOME/.local/state/wireplumber from an ssh session. Still getting audio from the speakers when headphones are plugged in.

if you give us the whole inxi we do not have to ask everithing, we do can just check.

Yes deleting the config file is not a bad idea as long you not made some custome config. Otherwise it would be god to make a backup before delete.

Files you find in ~/.config /etc and the default is in /usr/share do not change them there just copy them if you need to change the default config. /etc is for the whole machine and /.config is for your user.

This should not be used anymore by default it is Wireplumber active. Just if you changed it back to media-session they will be needed.

You should also read the:
to see the change was made to pipewire since f34

1 Like

I renamed /etc/wireplumber and deleting the wireplumber/pipewire files in ~/.config~/.config). I logged out of Gnome and back in again. Are there any pipewire related daemons that persist between login sessions that would have to be restarted separately?

The services continue running even when logged out. Rebooting is the only way to be sure it is all started new/clean.

1 Like

Problem persists after rebooting.

First of all, my approach here purely reading the comments on each file configuration I’ll mentions here. I don’t have any particular experience with what you have.

Please go to directory cd /usr/share/alsa-card-profile/mixer/paths/ and browse it with ls.

From your above statement, if you check analog-output-lineout.conf there you’ll find config as below:

[testcase@fedora paths]$ cat /usr/share/alsa-card-profile/mixer/paths/analog-output-lineout.conf
; This profile path is intended to control line out, let's mute headphones
; else there will be a spike when plugging in headphones
[Element Headphone]
switch = off
volume = off

[Element Headphone,1]
switch = off
volume = off

[Element Headphone2]
switch = off
volume = off

# and so on.

From above are setting for analog-output-lineout.conf profile(?), and if it selected it will turn the headphone volume off.

Then from analog-output-headphones.conf, there a comment like bellow:

[testcase@fedora paths]$ cat /usr/share/alsa-card-profile/mixer/paths/analog-output-headphones.conf
; On some machines, the Front Volume Control is shared by Headphone and Lineout,
; or Headphone and Speaker, but they have independent Volume Switch. Here only
; use switch to mute Lineout or Speaker.
[Element Front]
switch = off
volume = zero

[Element Rear]
switch = off
volume = off

It said Here only use switch to mute Lineout or Speaker, and I think it failed to change the volume to zero (mute?). That’s why form your link Speakers not muted when switching to headphones on X570 Aorus Pro above an user give work around by forcing it to turn off completely the volume instead of mute(?) it (as long as the volume control between headphone and line out are different and not shared).

Edward P @edward-p · 8 months ago

Same issue here on ALC898.

By editing /usr/share/alsa-card-profile/mixer/paths/analog-output-headphones.conf . Change this

… and so on.

May be you could consider to follow the work around there. After that reboot.

Of course, first you need to backup (copy) your analog-output-headphones.conf to other directory before make any customization.

I tried editing /usr/share/alsa-card-profile/mixer/paths/analog-output-headphones.conf as described in the post. After reboot, audio still plays out of speakers when headphones are connected and selected.

Hi, would you like to post the screenshot of alsamixer (press F6 to select the appropriate sound card) with bellow state?

Click to see the example

Sure, here’s ascreenshot of alsamixer (headphones plugged in):

And another with the headphones unplugged:

So it looks like as far as ALSA is concerned the headphone channel is getting muted when the headphones are unplugged, but the line out channel stays the same regardless of headphone state.

Hi, as always, backup your original file.

Please find inside analog-output-headphones.conf part:

[Element Headphone+LO]
required-any = any
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right

Change it to

[Element Headphone+LO]
switch = off
volume = off

Please take note if there any changes after reboot (actually it we could also just run systemctl --user restart wireplumber, but just incase).

That edit to analog-output-headphones.conf didn’t help, but after rebooting I ran alsamixer again and noticed the “Auto-Mute” setting. I “Auto-Mute” from “Disabled” to “Line Out+Speaker.” The line out channel is now muted when I plug in the headphones. Now to see if this setting survives a reboot…

Update: It did.

Glad you find the solution. Btw, please revert back any customization I suggested above to make sure there no confusion in the future if something happen after updating to Fedora Linux next release for more easy debug if any.

Will do, and thank you for your help @oprizal!