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.

3
  • 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 1, 2020 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. Nov 2, 2020 at 18:01
  • I have the same issue, if I have a USB headset plugged in, switching the audio output device has no effect. May 1, 2023 at 19:32

10 Answers 10

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.

8
  • 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. Jan 11, 2021 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 2, 2021 at 12:36
  • // , Tried this out, and it worked for me. Has interfered with many a video conference attempted from my Linux devices. Jul 5, 2021 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. Oct 13, 2021 at 8:12
  • It works. Thanks.
    – zlodes
    Nov 29, 2021 at 16:21
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

3
  • 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. May 19, 2020 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 1, 2020 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! Jan 12, 2021 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.

3
  • This fixed the problem for me!
    – JRJurman
    Dec 1, 2020 at 6:29
  • Sometimes I have to change the output device/volume using PulseAudio volume control (pavcontrol) instead of the volume slider that's in Settings, but it's better than it not working at all. With gnome-alsamixer installed even pavcontrol wouldn't do anything. Dec 2, 2020 at 18:02
  • 1
    it's work in Ubuntu 22.04 May 23, 2022 at 9:18
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

0
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

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.

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 ;-)

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

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.

You must log in to answer this question.

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