46

I recently updated my Ubuntu 19 to 20.04 and started experiencing strange issue: when I open sound settings and switch "output device" while my headphones are plugged in - sound goes out of headphones no matter what device I have chosen. The only thing, which seem to help, is plugging off my headphones.

This was not the case with Ubuntu 19. I could easily switch between built-in speakers on my laptop and headphones in the settings and it worked fine.

Has anyone else encountered such issue? Is there a way to fix it?

I believe my Ubuntu was 19.10 (but I am not sure about the minor version). My kernel seem unchanged after upgrade - 5.4.0-29-generic. The hardware, obviously, haven't changed either.

  • exactly the same for me - I'm using a Dell XPS 13 and I've just upgraded from 18.04 LTS to 20.04 LTS. I have 5 output audio devices listed and the sound settings panel works fine unless the Sennheiser USB headset is plugged in, in which case the sound always comes out of that. – Andy Oct 01 '20 at 16:11
  • I think I have the same issue. Upgraded from 18.04 to 20.04 on a custom built tower. I have 2 audio output devices, one of which is a usb headset. When I change the Output device any active music continues to play in the device it was already using. I have checked, and do not have gnome-alsamixer installed. – DeveloperWeeks Nov 02 '20 at 18:01
  • I have the same issue, if I have a USB headset plugged in, switching the audio output device has no effect. – Kris Nuttycombe May 01 '23 at 19:32

10 Answers10

46

A better solution is delete pulse audio config files in current user.

rm -r ~/.config/pulse/

Then logout & login or just reboot. Now you can change your audio device in system settings instead of pavucontrol.

  • 3
    I had an issue where all non-browser audio was being sent to speakers connected to the standard 3.5mm jack and I could not get it sent to my USB headset, even with changing the output device in settings. This solved the issue for me. Seems like a bug. – Donovan Solms Jan 11 '21 at 11:53
  • 6
    Just experienced this exact problem - everything routed through my primary speakers, switching outputs had no effect. Deleted the config for pulse as described here and it all jumped back into life (after issuing systemctl --user restart pulseaudio). Never seen anything like it - very frustrating. Thanks for this simple fix. – Scaine Mar 02 '21 at 12:36
  • // , Tried this out, and it worked for me. Has interfered with many a video conference attempted from my Linux devices. – Nathan Basanese Jul 05 '21 at 18:31
  • 3
    I have the Gnome extension “Sound input & output device chooser” installed and I just verified that it can cause this very issue. After removing the Pulse configuration (rm -r ~/.config/pulse/) and restarting the service (systemctl --user restart pulseaudio), the sound settings’ output switcher works. After enabling the Gnome extension and using it, it stops working. – kleinfreund Oct 13 '21 at 08:12
  • It works. Thanks. – zlodes Nov 29 '21 at 16:21
  • Just got this issue after upgrading from 20.04 to 22.04. Didn't have ~/.config/pulse/, but rm -r ~/.pulse* and restarting pulseaudio worked. – Magnus Gustavsson Apr 22 '22 at 19:29
  • Thank you @Scaine, it works perfectly. – Heros May 19 '22 at 14:48
  • i made a backup directory and then removed the files... this made the output work! however there is still some problem with rebooting and it not detecting the correct speakers. – Asher Jun 03 '22 at 18:24
28

Try installing pavucontrol and change your output device there:

sudo apt install pavucontrol
pavucontrol 

Worked for me so far as a quick fix but I can't tell you about the reasons why it works. Now I'm also able to switch output devices via the default sound settings again.

Some people also experience problems when timidity is installed.

You might want to have a look at these questions:

20.04: internal speaker (Audio) is not working in Ubuntu 20.04 LTS after upgrading from Ubuntu 18.04 LTS

No sound - Ubuntu 20.04 lts

arl
  • 296
  • 3
  • 4
  • So far it works, but it is so strange: inside pvaucontrol I have to select my "Built-in Audio Analog Stereo" as fallback device (green check) and also select Port: "Speakers (plugged in)" and this is the only device where there are 2 ports. And to switch back to headphones I have to select Port: "Headphones (unplugged)", which automatically unchecks the "fallback device" mark. So strange. I hope they fix it someday. – jtheterrible May 19 '20 at 21:46
  • 1
    Hmm, like you I found that after clicking around in pavucontrol for a bit, the standard sound settings started working. However, my USB headset now plays from the right channel only!! - the same headset works fine in so I know this isn't a hardware issue. I've also found that when trying to connect a Bluetooth headset, not only does the headset not connect properly, it causes the original problem to reappear. – Andy Oct 01 '20 at 19:39
  • This recipe, although it works (when you find the correct sequence of clicks), is sooo unconvenient, and it seems the only one that works for me... What frustrates most is that the problem was already known in May of 2020! – Roman Puchkovskiy Jan 12 '21 at 18:19
4

I think you might have gnome-alsamixer installed.

I had it installed in Ubuntu 18.04, and when I upgraded to 20 I started having this issue. I removed it using sudo apt-get autoremove gnome-alsamixer and it resolved the issue for me.

4

I can strongly recommend the Sound Input & Output Device Chooser GNOME Shell extension. It allows very easy and quick device switching (both input and output). Some screenshots:

drop-down

properties

tkazik
  • 245
3

My two cents.

Of all the options listed here (and in linked answers), only the one with pavucontrol gives any effect in my case. But it's too inconvenient, in my opinion.

I have 3 sound devices (that output sound), so earlier I had a script for switching cyclically between 2 of them (the third, with index 0, is no interest to me, so I always skip it). This was done with the following script:

#!/usr/bin/env bash

sinks_indices=($(pacmd list-sinks | grep index |
awk '{ print $NF }')) sinks_activity=($(pacmd list-sinks | grep index |
awk '{ if ($1 == "*") print "1"; else print "0" }')) inputs=($(pacmd list-sink-inputs | grep index | awk '{print $2}'))

find active sink

active_idx=0 for i in ${sinks_activity[*]} do if [ $i -eq 0 ] then active_idx=$((active_idx+1)) else break fi done

switch to next sink

swap_idx=$(((active_idx+1)%${#sinks_activity[@]}))

skip sink 0 because it's not used in my system

if [ $swap_idx -eq 0 ]; then swap_idx=$(((swap_idx+1)%${#sinks_activity[@]})) fi swap=${sinks_indices[$swap_idx]}

pacmd set-default-sink $swap &> /dev/null for i in ${inputs[*]}; do pacmd move-sink-input $i $swap &> /dev/null; done

It turned out that this script works. There is still one problem with it: when you reboot a system (or even start another application), the sound is output to any of the 2 devices unpredictably (at least I could not figure out the logic). But once you run the script, the sound gets output to whatever device you need.

It's very handy to assign it to a hotkey, so just one movement separates you from switching to another device (a lot more convenient that going to the menu; in 16.04 it was far better, the sound device checker was not so deep).

There is a similar problem with microphone, I was able to solve it by using pacmd list-source-outputs, pacmd set-default-source and pacmd move-source-output.

And just a note: when booting from 20.04 Live DVD, the problems (at least with switching between speakers/headphones) simply do not occur. Maybe it makes sense to just reinstall from scratch, hmmm...

1

I know this is a dead issue for most but my Google-Fu brought me here after a PC move and attaching sound to anything other than the headphone jack for the first time in a loooong time. Could only see S/PIDF out for an output option.

Just wanted to leave this for anyone else digging for an answer.

The fix for me was to change the PulseAudio configuration profile to Built-in Audio Analog Surround 5.1 Output + Analog Stereo Input.

uname -a
Linux <removed> 5.11.0-37-generic #41~20.04.2-Ubuntu SMP Fri Sep 24 09:06:38 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.3 LTS
Release:    20.04
Codename:   focal
aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: SB [HDA ATI SB], device 0: ALC892 Analog [ALC892 Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 0: SB [HDA ATI SB], device 1: ALC892 Digital [ALC892 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
sudo lspci -vv|grep -Audio
00:14.2 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 Azalia (Intel HDA) (rev 40)

Yes, I know it's an old box but it runs ;-)

G33K3RY
  • 11
1

On Ubuntu 20.04 LTS with Gnome I've had one incident so far where pulseaudio only sends output to the last audio device even when editing settings via the Sound settings dialog. Restarting pulseaudo service was enough to get the two resynchronized.

systemctl --user restart pulseaudio

Never had this problem with Cinnamon. I switched to Gnome a few weeks ago as work will be switching soonish.

Judd Rogers
  • 161
  • 1
  • 2
1

sudo apt-get remove --purge alsa-base

sudo apt-get remove --purge pulseaudio

sudo apt-get install alsa-base

sudo apt-get install pulseaudio

sudo alsa force-reload then reboot your system.

0

I like to suggest the following approach if you would like a shortcut to cycle through audio output devices (inspiration from this Linux Mint Forums topic):

  1. Create a bash script in /usr/local/bin/:

    sudo gedit /usr/local/bin/audio-device-switch.sh
    
  2. Copy and paste the following in the script:

    #!/bin/bash
    

    declare -i sinks_count=pacmd list-sinks | grep -c index:[[:space:]][[:digit:]] declare -i next_sink_index=0 declare active=pacmd list-sinks | sed -n -e 's/\*[[:space:]]index:[[:space:]]\([[:digit:]]\)/\1/p' declare -i next_index=0

    get devices list

    devices=() mapfile -t devices < <( pacmd list-sinks | sed -n -e 's/*?[[:space:]]index:[[:space:]]([[:digit:]])/\1/p' )

    find the active device and switch to next

    for (( i=0; i<${#devices[@]}; i++ )); do if [ ${devices[$i]} -eq $active ] ; then next_index=$i+1 next_index=next_index%sinks_count next_sink_index=devices[next_index%sinks_count] fi done

    #change the default sink pacmd "set-default-sink ${next_sink_index}"

    #move all inputs to the new sink for app in $(pacmd list-sink-inputs | sed -n -e 's/index:[[:space:]]([[:digit:]])/\1/p'); do pacmd "move-sink-input $app $next_sink_index" done

    #display notification declare -i ndx=0 pacmd list-sinks | sed -n -e 's/device.description[[:space:]]=[[:space:]]"(.*)"/\1/p' | while read line; do if [ $next_index -eq $ndx ] ; then notify-send -i audio-card "Sound output switched" "$line" exit fi ndx+=1 done;

  3. Save and close.

  4. Execute the following command to change permissions for the script:

    sudo chmod 755 /usr/local/bin/audio-device-switch.sh
    
  5. Run the script using to ensure that it works:

    audio-device-switch.sh
    

    You should get a notification saying the audio device is switched.

  6. Create a shortcut from the Settings providing the following config:

    shortcut dialog

AVIE
  • 1
0

I had the same issue and nothing worked, then I noticed that where you set Ubuntu mirrors, the options for universe, restricted and multiverse are turned off. Once enabled I have updated and Ubuntu pulled down Toshiba proprietary firmware for my Intel Audio Conexant...all working now.

Belin
  • 1