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.

10 Answers10

49

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.

31

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

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