Pipewire requires restart when unplugging then plugging headset from aux jack

Hi,
When I disconnect my headphones from the motherboard internal sound card, the audio switches to HDMI (this is the expected behaviour) but when I replug my headphones, the internal sound card doesn’t show in Plasma volume widget, but still show in Plasma sound settings and seems to be shutdown (selecting Pro Audio doesn’t work). To temporary fix the issue I must restart Pipewire with systemctl --user restart pipewire.service.

How to permanently fix this problem without restarting Pipewire everytime ? I tried to use pipewire-media-session instead of Wireplumber but no dice. This also happens with Fedora 39.

My inxi audio info :

Audio:
  Device-1: NVIDIA GP106 High Definition Audio vendor: Gigabyte
    driver: snd_hda_intel v: kernel bus-ID: 1f:00.1
  Device-2: AMD Family 17h HD Audio vendor: Micro-Star MSI <-- motherboard sound card
    driver: snd_hda_intel v: kernel bus-ID: 21:00.3
  API: ALSA v: k6.6.2-1-default status: kernel-api
  Server-1: sndiod v: N/A status: off
  Server-2: PipeWire v: 1.0.0 status: active

Thanks

The mb audio chipset is Realtek ALC898 (Codec: Realtek ALC887-VD).

Stay with using wireplumber (pipwire-media-session is deprecated). When you plug in the headset again, examine the available sinks as reported by
wpctl status

Can you at least manually switch successfully to the headset output using something like
wpctl set-default <sink_ID>
*Replace <sink_ID> with relevant value according to the previous output (assuming it was reported).

BTW, do you have ‘pipewire-pulseaudio’ installed? FWIW, I believe there is a PulseAudio module (module-switch-on-connect) that can be loaded to help with ‘automatic’ switching behaviour. Apologies in advance if I’m on the wrong track here.

It could be tested with
pactl load-module module-switch-on-connect
then check the sink headset switching behaviour again. YMMV.

FWIW, I find that when I switch monitors around (which have audio channels on them), I have to restart pipewire-pulse (I just kill -9 the process). Kind of annoying.

I switch one of my monitors to another device at times (a PS5, which shouldn’t matter) and when I switch or switch it back to my PC, I usually have to do this.

I have reinstalled Wireplumber and I have pipewire-pulseaudio already installed, this is the output of wpctl status

PipeWire 'pipewire-0' [1.0.0, alex@pc, cookie:3401407996]
 └─ Clients:
        32. xdg-desktop-portal                  [1.0.0, alex@pc, pid:3218]
        36. WirePlumber                         [1.0.0, alex@pc, pid:2906]
        46. libcanberra                         [1.0.0, alex@pc, pid:3308]
        49. Plasma PA                           [1.0.0,alex@pc, pid:3308]
        55. WirePlumber [export]                [1.0.0, alex@pc, pid:2906]
        56. pipewire                            [1.0.0, alex@pc, pid:2123]
        61. pipewire                            [1.0.0, alex@pc, pid:2123]
        68. wpctl                               [1.0.0, alex@pc, pid:8854]
        75. Firefox                             [1.0.0, alex@pc, pid:4259]

Audio
 ├─ Devices:
 │      54. GP106 High Definition Audio Controller [alsa]
 │      62. (LCS) USB Audio Device              [alsa]
 │      64. Family 17h (Models 00h-0fh) HD Audio Controller [alsa]
 │  
 ├─ Sinks:
 │      57. GP106 High Definition Audio Controller Stéréo numérique (HDMI) [vol: 1.00]
 │  *   66. Family 17h (Models 00h-0fh) HD Audio Controller Stéréo analogique [vol: 0.50]
 │  
 ├─ Sink endpoints:
 │  
 ├─ Sources:
 │  *   48. (LCS) USB Audio Device Mono         [vol: 0.60]
 │  
 ├─ Source endpoints:
 │  
 └─ Streams:

Video
 ├─ Devices:
 │  
 ├─ Sinks:
 │  
 ├─ Sink endpoints:
 │  
 ├─ Sources:
 │  
 ├─ Source endpoints:
 │  
 └─ Streams:

Settings
 └─ Default Configured Node Names:
         0. Audio/Sink    alsa_output.pci-0000_21_00.3.analog-stereo

In plasma volume widget

Screenshot_20231130_091648

When I unplug my headphones the sound card sink disappears but the device stays, this is the same when I reconnect them.

Audio
 ├─ Devices:
 │      54. GP106 High Definition Audio Controller [alsa]
 │      62. (LCS) USB Audio Device              [alsa]
 │      64. Family 17h (Models 00h-0fh) HD Audio Controller [alsa]
 │  
 ├─ Sinks:
 │  *   57. GP106 High Definition Audio Controller Stéréo numérique (HDMI) [vol: 1.00]
 │  
 ├─ Sink endpoints:
 │  
 ├─ Sources:
 │  *   48. (LCS) USB Audio Device Mono         [vol: 0.60]
 │  
 ├─ Source endpoints:
 │  
 └─ Streams:

Video
 ├─ Devices:
 │  
 ├─ Sinks:
 │  
 ├─ Sink endpoints:
 │  
 ├─ Sources:
 │  
 ├─ Source endpoints:
 │  
 └─ Streams:

Settings
 └─ Default Configured Node Names:
         0. Audio/Sink    alsa_output.pci-0000_21_00.3.analog-stereo

In plasma widget settings it just disappears

Screenshot_20231130_091716

pactl load-module module-switch-on-connect didn’t fix the problem. Setting the sink by default didn’t fix either.

BTW I found out when I unplug/replug the headphones rapidly, the sink does switch as expected. When I unplug for more than 1 second I must restart pipewire to “power on” the internal sound card.

I guess a bug report will be needed to resolve this. I’ve seen similar reports with inactive internal sound following a suspend resume cycle. A power saving issue perhaps?

I solved the problem by disabling power_save with this command :

sudo tee /etc/modprobe.d/snd-hda-intel.conf <<< "options snd_hda_intel power_save=0"

Rebooted and now it works !

Thanks for updating what the issue was that was impacting you.