Ubuntu 20.04 change sound output device issue

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.


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.


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


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.


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...


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