Every time I boot up I have to switch my audio output device to my "Line Out" headphones because for some reason my microphone defaults as a speaker.

See this screenshot [See this screenshot.


Simple fix in 19.10 that worked for me:

I couldn't get the solution @singrium proposed to persist on Ubuntu 19.10. It worked with device numbers in /etc/pulse/default.pa but as I connected for example my headset device numbers were changing and things stopped working. It didn't work with device names in /etc/pulse/default.pa.

The simple workaround I found is adding the pactl set default sink command in startup applications.

  1. Run: pactl list short sinks
  2. Note the device name you want to use as default
  3. Try to run: pactl set-default-sink <Your_Device_Name>
    This should work without giving you an error message.
  4. Open the application "Startup Applications" (Should be preinstalled on Ubuntu)
  5. Click on "Add"
  6. Give your startup item a name
  7. Copy your command from above into the command field:
    pactl set-default-sink 'Your-Device-Name'
  8. Click on "Save".

You are now good to go. Your default audio device will be set on each boot and as such be persistent. If you want to change the default device simply edit the device name in startup applications command.

| improve this answer | |
  • After an hour of trying, this is the only thing that worked for me, with a tweak to add 10 seconds delay: /bin/bash -c "sleep 10 && pactl set-default-sink 'alsa_output.pci-0000_07_00.1.hdmi-stereo-extra2'" – dez93_2000 Mar 16 at 19:59
  • 1
    Marking this answer as the new solution. This method is simpler and doesn't involve editing or deleting config files and I've had some users mention that the earlier marked answer caused issues with their system. – tiddlesticks May 2 at 0:37
  • Thank you phanky5 for the simple solution. – singrium May 3 at 11:51
  • which value is the device name? – anon58192932 Jun 8 at 23:35
  • assuming you want your audio-out as hdmi (such as for a TV) and your os keeps picking something else (like a gaming headset), here is a one-liner to put in startup apps (with appropriate delay): /usr/bin/pactl set-default-sink $(/usr/bin/pactl list short sinks|/usr/bin/gawk -F'\\s+' '$2 ~ /^.*[Hh][Dd][Mm][Ii].*$/ { print $2 }') – zpangwin Jul 12 at 22:48

EDIT (05/03/2020):
It seems that @phanky5 figured out a simpler solution. Please check it before you try this one.

Here is a well explained tutorial to set a default audio input/output.

First: List the audio output devices using

pactl list short sources  

Example of the output:

pactl list short sources
0   alsa_output.pci-0000_02_00.1.hdmi-stereo.monitor    module-alsa-card.c  s16le 2ch 44100Hz   SUSPENDED
1   alsa_input.usb-AVerMedia_Technologies__Inc._Live_Gamer_Portable_2_5202050100060-03.analog-stereo    module-alsa-card.c  
2   alsa_output.usb-Blue_Microphones_Yeti_Stereo_Microphone_REV8-00.analog-stereo.monitor   module-alsa-card.c  s16le 2ch 44100Hz   SUSPENDED
3   alsa_input.usb-Blue_Microphones_Yeti_Stereo_Microphone_REV8-00.analog-stereo    module-alsa-card.c  s16le 2ch 44100Hz   RUNNING

Second: To set a default output device run the command

pactl set-default-sink <'output_device_name'>

Example: pactl set-default-sink 'alsa_output.pci-0000_00_1f.3.analog-stereo'

Now, to make this work at every restart, follow this :

First, open the file /etc/pulse/default.pa using :

sudo -H gedit /etc/pulse/default.pa

Then scroll to the bottom of the file, where two lines starting with set- will be commented out.

Now, uncomment these lines and replace the words input and output with the number of the sink (for output) / source (for input) that you want to be the default.

Example (sets both default input and output):

### Make some devices default
set-default-sink 3
set-default-source 3

PS: As discussed in the comments with Bim, it is also possible (according to him) to put the input/output name in /etc/pulse/default.pa instead of the input/output number.


### Make some devices default
set-default-sink alsa_output.pci-0000_00_1f.3.analog-stereo
set-default-source alsa_output.pci-0000_00_1f.3.analog-stereo.monitor

After doing this, save and exit. Then, delete the ~/.config/pulse directory by running rm -r ~/.config/pulse, and then reboot the system. Once the system reboots, the appropriate devices should now be set as the defaults.

As mentioned by ahmorris in his answer, some had to comment this line load-module module-switch-on-connect in the file /etc/pulse/default.pa to be # load-module module-switch-on-connect in order to make the changes persistent.

| improve this answer | |
  • 3
    The user owns the home directory, so sudo isn't required when running sudo rm -r ~/.config/pulse – BenR Aug 24 '18 at 13:21
  • 1
    I think you mixed up sinks with sources in your first example output. – Willi Mentzel Oct 3 '19 at 17:53
  • It makes more sense to use the name string ('alsa_output.pci-0000_00_1f.3.analog-stereo' in the example) for set-default-sink, than the device number. The number can change, that name will most likely not... – Bim Oct 30 '19 at 13:56
  • @Bim I have the names changed too :-D. Both names and numbers change from one computer to another, I guess. – singrium Oct 30 '19 at 14:06
  • 1
    @singrium you say use pactl list short sinks and in the example below you use pactl list short sources. It is a little confusing. – Willi Mentzel Nov 3 '19 at 13:58

To make Singrium's answer work, I had to comment out this line from my /etc/pulse/default.pa by adding the #:

# load-module module-switch-on-connect

Otherwise, on startup my audio device would be set to my default device, but then would switch to my USB hub once it was detected. This prevents that switch and ensures your chosen audio device is the output.

| improve this answer | |
  • 3
    This was my problem too! I have a wireless headset connected through a hub which gets detected AFTER my default device has been set on start up, cheers for this one. – SidOfc Jul 30 '19 at 17:38
  • 1
    Was necessary for me with a HDMI output / display that can also act as an audio device. – Bim Oct 30 '19 at 13:51
  • 1
    This answer alone does the job if you just need to stop a USB headset stealing your audio on every startup. – Alexander Revo Jan 26 at 10:04
  • Why can't Ubuntu/Debian just send the audio to every available output, like Windows always did? – Rodrigo Apr 7 at 15:35

This can be done with PulseAudio Volume Control if you prefer to use a GUI.

Once you've opened PulseAudio Volume Control, choose the configuration (the last tab), then select the output and/or input you want to use from the profile dropdown menu. It should look similar to this

PulseAudio Volume Control can also be used to adjust volume levels for each input, output, system sounds and applications that are currently in use.

Here's a post from Linuxhint with more info on PulseAudio.

| improve this answer | |
  • Thanks for this solution. I start to regret having upgraded to 18.04.1. PulseAudio Volume Control disappeared too >:( – Alfonso Nishikawa Oct 2 '18 at 23:56
  • 1
    I should mention, I'm using Ubuntu studio, which has a few differences. although I did notice pulse was missing after the upgrade. 18.04 uses ALSA, but Pulse can be installed. Maybe this (same post from above) will help: linuxhint.com/pulse_audio_sounds_ubuntu – Starbuck Oct 5 '18 at 16:36
  • 1
    Yeah, I did that and worked :) Thx :) – Alfonso Nishikawa Oct 6 '18 at 18:56
  • For me this won't remember my TV (hdmi) output, if logged out, or disconnected/reconnected, it's back to speakers. – Christopher.L Dec 16 '19 at 0:52
  • Why can't Ubuntu/Debian just send the audio to every available output, like Windows always did? – Rodrigo Apr 7 at 15:36

This worked for me in Ubuntu 20.04.

Like was said before you have to list the audio output devices:

pactl list short sinks

And than you can add your chosen device to /etc/pulse/client.conf file like this:

default-sink = alsa_output.pci-0000_00_1f.3.analog-stereo

NOTE: You have to remove the "!" from the original line.

| improve this answer | |
  • 2
    Recently had to fix my pulse setup since upgrading from 19.10 to 20.04 brought all kinds of audio weirdness. I decided to remove ~/.config/pulse and was left with one quirk being my headset becoming the default audio device. If this is the case this answer: askubuntu.com/a/1115641/177314 works like a charm too and requires less technical knowledge :) – SidOfc May 22 at 9:45

In my case, on my Bionic/18.04.3 changes in /etc/pulse/default.pa doesn't works (1)!

pactl list short sink
2   alsa_output.pci-0000_00_1f.3.analog-stereo …

pactl set-default-sink 2 
# or 
pactl set-default-sink 'alsa_output.pci-0000_00_1f.3.analog-stereo'

works fine in CLI,

make change in my ~/.profile based on post How to startup a script automatically after login, add line:

pactl set-default-sink 'alsa_output.pci-0000_00_1f.3.analog-stereo'

and it works after reboot

(1) I have some error en my /var/log/syslog in all case with number or all text:
[pulseaudio] main.c: Sink output 2 does not exist.
[pulseaudio] main.c: Sink output 'alsa_output.pci-0000_00_1f.3.analog-stereo' does not exist.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.