PulseAudio automatically switches to HDMI sound output on login

Bug #1847570 reported by Michael Vogt on 2019-10-10
448
This bug affects 109 people
Affects Status Importance Assigned to Milestone
PulseAudio
Fix Released
Unknown
pulseaudio (Ubuntu)
Medium
Daniel van Vugt
Eoan
Medium
Daniel van Vugt
Focal
Medium
Daniel van Vugt

Bug Description

[Impact]

On my freshly installed eoan system I have two output devices:
- HDMI/DisplayPort 2 - GK208 ...
- Line Out - Family 17h ...

When I login into the system pulseaudio always select the "wrong"
one (HDMI) and I need to go to gnome-settings/Sound/Output Device
and switch to "line out". This applies to every login/logout not
just reboots.

[Test Case]

0. Plug in a monitor that supports HDMI audio (one that appears in your Settings>Sound)

1. Log out and in again.

Verify the default audio device in Settings is still speakers or headphones. Not the monitor's HDMI audio device.

[Regression Potential]

The behaviour is changed back to what it was before 19.10, some users might find it inconvenient and prefer the auto switch but the feedback we got shows it's unreliable and an annoying for the majority of our users so we will got back to default to safest behaviour.

The fix proposed just reverts to the same code used in PulseAudio 12 and earlier. It has also been released and verified on focal already.

[Workaround]

Comment out:

load-module module-switch-on-port-available
load-module module-switch-on-connect

from /etc/pulse/default.pa

Michael Vogt (mvo) on 2019-10-10
summary: - Correct output device needs to be set again on each reboot
+ Correct output device needs to be set again on each login
description: updated
tags: added: eoan
summary: - Correct output device needs to be set again on each login
+ Preferred output device is not remembered between logins

confirm on 2 different systems here.

Changed in pulseaudio (Ubuntu):
importance: Undecided → High
status: New → Confirmed
Daniel van Vugt (vanvugt) wrote :

I just found a couple of existing reports for this so let's start by using bug 1631161.

Daniel van Vugt (vanvugt) wrote :

Workaround: Comment out:

load-module module-switch-on-port-available
load-module module-switch-on-connect

from /etc/pulse/default.pa

summary: - Preferred output device is not remembered between logins
+ PulseAudio automatically switches to HDMI sound output on login
Changed in pulseaudio (Ubuntu):
importance: High → Medium
Daniel van Vugt (vanvugt) wrote :

Please also report the bug upstream:

https://gitlab.freedesktop.org/groups/pulseaudio/-/issues

and tell us the new bug ID.

Even if it's unique to module-switch-on-connect, which only Ubuntu uses, it still sounds like a simple fault in that module.

Daniel van Vugt (vanvugt) wrote :

I *think* what we want from upstream is for module-switch-on-connect to ignore new connections which are detected around the same time as the daemon starting. Because those are not user-initiated but more likely just a side-effect of logging in.

Daniel van Vugt (vanvugt) wrote :

Or maybe just for Ubuntu, consider adding module parameter 'only_from_unavailable'. I wonder if that might have any undesirable consequences?

Daniel van Vugt (vanvugt) wrote :

I also wonder if the original reasons for us wanting that module (USB DACs and Bluetooth) still really need it in the current version.

Changed in pulseaudio:
status: Unknown → New
Jean-Baptiste Lallement (jibel) wrote :

On my laptop if I plug it to an HDMI monitor, HDMI is preferred. But if I plug a logitech dongle and still plugged to the monitor, the dongle is preferred. The selection of the headset or line-out is never preserved.

Jean-Baptiste Lallement (jibel) wrote :

The logitech dongle is viewed by pulseaudio as a second card.

Daniel van Vugt (vanvugt) wrote :

jibel, that's the intended behaviour. We default to always switching to the most recent audio device plugged in. To disable that you will need to comment out:

### Use hot-plugged devices like Bluetooth or USB automatically (LP: #1702794)
.ifexists module-switch-on-connect.so
load-module module-switch-on-connect
.endif

Changed in pulseaudio (Ubuntu):
status: Confirmed → Triaged
Didier Roche (didrocks) wrote :

@Daniel, however, this creates "interesting" issues, like when you have a pulseaudio server on the network. Even if your laptop is connected before the user session, it will always switch to the server, even if you reverted on this decision at previous reboot.
However what I describe above isn't a regression (contrary to this report).

Sebastien Bacher (seb128) wrote :

Daniel, could you keep an eye on this one and see if we can help upstream to fix it?

Changed in pulseaudio (Ubuntu Eoan):
assignee: nobody → Daniel van Vugt (vanvugt)
Bickhaus (bickhaus) wrote :

In case it's helpful, I posted a bug about this (but, perhaps, incorrectly as an ALSA problem) with my Alsa and PulseAudio information: https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1846290

Above, it was mentioned that perhaps this is regards to module-switch-on-connect. FWIW, when I was testing Fedora 31, it correctly picked my onboard sound controller rather than my HDMI monitors (which have an audio passthrough but no onboard audio capabilities/speakers of their own) from the start and never tried to switch the output device to HDMI.

I have further noticed that when I try to launch games via Steam, they have no sound, even if I make sure line out is the selected sound output device in gnome-settings prior to launching Steam. I did not have this problem on 19.04, so I wonder if it's related? Any tips on how I can further investigate and maybe file a separate bug report if necessary?

I have 2 4K monitors, that do not even have speakers hooked up to them (but they apparently have Audio Controllers). Ubuntu 19.10 gnome-control-center chooses one of these speakerless monitors over my Laptop's built-in speakers on each reboot. It will not persist my preference.

Screenshot: https://i.stack.imgur.com/kLYWy.png
AskUbuntu: https://askubuntu.com/questions/1183052/

Daniel van Vugt (vanvugt) wrote :

We have configured PulseAudio in Ubuntu to prefer newly plugged in audio devices, which up until 19.04 was uncontroversial. The bug here is that the new version of PulseAudio thinks logging in with an HDMI/DisplayPort monitor already attached counts as newly plugged-in.

If you need a workaround then see comment #3.

Upstream is working on it so please keep an eye on:
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/749

tags: added: regression-release
Markus W (z-mw) wrote :

One additional aspect to note is that some desktop monitors reconnect to the system when returning from power-save mode. In my case the sound selection is changed to HDMI/DisplayPort whenever this happens. Changing the sound setting back 10+ times a day is extremely annoying.

#3 is not a workaround as it disables switching to headphone out on plugin.

This work-around is working for me:
https://askubuntu.com/a/1183074/256054

However, this is only a work-around and the bug remains.

Stelios (st-roum) wrote :

Every time my monitor returns from power-saving mode i have to change the sound settings. Again and again and again, every single day. If i disable HDMI audio using Pavucontrol, it will still be enabled automatically the moment my monitor comes back from power saving mode.

For me, HDMI audio is selected in the options but sound plays in the desired device. What is annoying is that I have to go to settings every time I need to adjust the volume because the top right menu adjusts HDMI audio. Am I having the same issue?

Dclaw (dclaw123) wrote :

I have the same issue as echaskaris above. Audio plays, but volume control in the top right corner, as well as with keyboard keys defaults to the HDMI output, so there's no control. Setting it to line out restores volume control there for the duration of my session.

Richard Khoury (richiek) wrote :

And same for me, as #21 and #22.

Brandon Nolet (bnolet) wrote :

To me, this is SUPER strange, but maybe someone can help me out here:

When I add `amdgpu.dc=0` to `GRUB_CMDLINE_LINUX_DEFAULT` in `/etc/default/grub` (and update-grub), this audio switching issue disappears.

All I know about the `dc` option is that it force enables or disables the Display Core driver.

How this might be relevant, is not obvious to me.

Brandon Nolet (bnolet) wrote :

Just for context, I added this because when locking, my Ubuntu 19.10 install would brick and I'd have to press the reset button on my rig.

David Osolkowski (qidydl) wrote :

I'm encountering the same issue, and I can confirm it started only after upgrading to 19.10 from 19.04 a few days ago, so this is definitely a regression caused by a recent change.

This bug is so annoying if you have your screen turn off due to inactivity that I'm inclined to press 1. for a fix and 2. to write something about it in the known issues section for 19.10.

description: updated
Changed in pulseaudio (Ubuntu Focal):
status: Triaged → In Progress
Daniel van Vugt (vanvugt) wrote :
Changed in pulseaudio (Ubuntu Focal):
status: In Progress → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pulseaudio - 1:13.0-1ubuntu5

---------------
pulseaudio (1:13.0-1ubuntu5) focal; urgency=medium

  * Add 0031-lp1847570-Revert-switch-on-connect-Do-not-ignore-HDMI-sinks.patch
    to revert to PulseAudio v12 behaviour and ignore monitors with HDMI ports.
    At least until a proper solution arrives in PulseAudio v14. (LP: #1847570)

 -- Daniel van Vugt <email address hidden> Wed, 11 Dec 2019 16:34:39 +0800

Changed in pulseaudio (Ubuntu Focal):
status: Fix Committed → Fix Released
Daniel van Vugt (vanvugt) wrote :

mvo and others, please test the above fix on Ubuntu 20.04 if it is convenient.

When and if confirmed to be working we will propose the same to 19.10.

Nicolas Delvaux (malizor) wrote :

@vanvugt: I booted the latest 20.04 daily (which does contain the new pulseaudio package) and I confirm the behaviour is now back to "normal", which is to say to the 19.04 (and older) behaviour.

So this is indeed fixed on Focal in my point of view.

Bryan Quigley (bryanquigley) wrote :

I just want ahead and upgraded to Focal. Definitely fixed here, thanks!

BloodyIron (bloodyiron) wrote :

Any word how long before this might hit main repos for 19.10?

Changed in pulseaudio (Ubuntu Eoan):
status: Triaged → In Progress
Daniel van Vugt (vanvugt) wrote :
Changed in pulseaudio (Ubuntu Eoan):
status: In Progress → Fix Committed
description: updated
tags: added: focal
Sebastien Bacher (seb128) wrote :

Uploaded to the SRU queue nowb

APolihron (apolitech) wrote :

The fix is only for the HDMI output? The same issue is with displayport :(

Release 'eoan-proposed' for 'pulseaudio' was not found

Martin Gerdzhev (mgerdzhev) wrote :

I have 2 displayport monitors that have no speakers and this is happening all the time. It also happens when the resolution changes or the monitor scaling is changed.

Daniel van Vugt (vanvugt) wrote :

Hmm, upstream have now written a proper fix destined for PulseAudio 14:

https://gitlab.freedesktop.org/pulseaudio/pulseaudio/merge_requests/225

Maybe we should change to that.

Daniel van Vugt (vanvugt) wrote :

It appears the upstream fix in master (PulseAudio 14) does not apply and can't work in PulseAudio 13 so we will stick with the revert in PulseAudio 13. The patch in comment #34 is still awaiting sponsorship/publishing.

Mathew Hodson (mhodson) on 2019-12-31
Changed in pulseaudio (Ubuntu Eoan):
status: Fix Committed → Triaged

When will the fix be released?

Bill Duetschler (bikergeek) wrote :

I have an Nvidia based video card that has 2 DVI outputs, an HDMI output, a DisplayPort output. I have 2 monitors that are plugged in to the DVI outputs, and nothing plugged in to the HDMI or DP outputs. And still, XUbuntu insists on switching audio to the HDMI outputs that have nothing plugged into them.

Daniel van Vugt (vanvugt) wrote :

The fix for 19.10 is queued and on the way:
https://launchpad.net/ubuntu/eoan/+queue?queue_state=1

Changed in pulseaudio (Ubuntu Eoan):
status: Triaged → Fix Committed
Changed in pulseaudio:
status: New → Fix Released
BloodyIron (bloodyiron) wrote :

Waiting on release for Eoan :D

Thanks for getting this fixed! \o/

description: updated

Hello Michael, or anyone else affected,

Accepted pulseaudio into eoan-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/pulseaudio/1:13.0-1ubuntu1.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-eoan to verification-done-eoan. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-eoan. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

tags: added: verification-needed verification-needed-eoan

How do I update only pulseaudio? I get:

$ sudo apt upgrade pulseaudio/eoan-proposed
Reading package lists... Done
Building dependency tree
Reading state information... Done
Selected version '1:13.0-1ubuntu1.1' (Ubuntu:19.10/eoan-proposed [amd64]) for 'pulseaudio'
Selected version '1:13.0-1ubuntu1.1' (Ubuntu:19.10/eoan-proposed [amd64]) for 'libpulse0' because of 'pulseaudio'
Calculating upgrade... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 pulseaudio : Depends: libpulse0 (= 1:13.0-1ubuntu1.1) but 1:13.0-1ubuntu1 is to be installed
 pulseaudio-module-bluetooth : Depends: pulseaudio (= 1:13.0-1ubuntu1)
E: Broken packages

Nicolas Delvaux (malizor) wrote :

Successfully tested on eoan.
I enabled the proposed repository, upgraded everything (so including pulseaudio 13.0-1ubuntu1.1) then rebooted.
The audio device is no longer switched to HDMI when the screen wake up after standby or when login-out and in.

(note that the workaround from the description was not applied, so no possible confusion here)

So this is all good from my point of view.

tags: added: verification-done verification-done-eoan
removed: verification-needed verification-needed-eoan
Bickhaus (bickhaus) wrote :

I also upgraded everything from the proposed repo and tested. This issue is fixed for me as well. I power cycled each monitor monitor (I have two.) in succession, and the output device selected remained the motherboard line out throughout. Line out was also selected at boot, where previously at each boot, it would reset to one of my monitors.

I was previously using the workaround but reenabled switch-on-connect and switch-on-port-available (removed the hashtags commenting them out) prior to installing the new pulse audio packages.

Maksim S (max-svo) wrote :

After enabling proposed, did
sudo apt install pulseaudio pulseaudio-module-bluetooth pulseaudio-utils
to update only present packages related to pulseaudio

Can confirm the issue is now fixed for me.

spike speigel (frail-knight) wrote :

This seems to have also fixed another issue where my sound would switch to HDMI sink from headphones when changing screen resolutions in XFCE:

https://bugs.launchpad.net/ubuntu/+source/xfce4-settings/+bug/1858250
https://bugzilla.xfce.org/show_bug.cgi?id=16335

All autopkgtests for the newly accepted pulseaudio (1:13.0-1ubuntu1.1) for eoan have finished running.
The following regressions have been reported in tests triggered by the package:

sphinxbase/0.8+5prealpha+1-7 (armhf)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/eoan/update_excuses.html#pulseaudio

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Daniel van Vugt (vanvugt) wrote :

That armhf test failure doesn't seem to look related to this change. Can someone just retry a rebuild?

I can confirm that hdmi is not selected when monitor returns from sleep (I did something and the correct sound device would be selected at startup before updating from proposed). However, closing and reopening the monitor manually causes HDMI to be selected. I don't think that used to happen previously.

Never mind the however part, it is fixed.

Sebastien Bacher (seb128) wrote :

The autopkgtest issue got resolved on a retry

Robert (snajper-ro) wrote :

i take off earphones from the socket, my acoustics sounds correct(switch signal from earphones to acoustics)
but when i take on my earphones to socket, acoustics sounds , but earphones don't.

settings->sound, it chooses proper device(earphones), but it doesn't work proper(not switch signal from acoustics to earphones)

it is my old bug description
https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1847570

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pulseaudio - 1:13.0-1ubuntu1.1

---------------
pulseaudio (1:13.0-1ubuntu1.1) eoan; urgency=medium

  * Add 0031-lp1847570-Revert-switch-on-connect-Do-not-ignore-HDMI-sinks.patch
    to revert to PulseAudio v12 behaviour and ignore monitors with HDMI ports.
    At least until a proper solution arrives in PulseAudio v14. (LP: #1847570)

 -- Daniel van Vugt <email address hidden> Wed, 18 Dec 2019 13:26:53 +0800

Changed in pulseaudio (Ubuntu Eoan):
status: Fix Committed → Fix Released

The verification of the Stable Release Update for pulseaudio has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

BloodyIron (bloodyiron) wrote :

Woot! Thanks for rolling this out all involved! \o/ Stuff like this is why I love FOSS.

Now to try it out!

BloodyIron (bloodyiron) wrote :

So far it's fixed for me! Yay!!!

Matthew M. Dean (fireculex) wrote :

I still get this issue even on focal, or atleast the fix is the same. I have a USB headset and upon reboot it always switches to the USB headset regardless if HDMI was selected last. It's a desktop so things don't get unplugged.

Daniel van Vugt (vanvugt) wrote :

Since this bug is closed, please open new bugs for any ongoing issues. Just run:

  ubuntu-bug pulseaudio

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.