How to Stop Ubuntu from Automatically Changing the Default Audio Device

The Audio Shuffle

Ubuntu utilizes an audio server (often PulseAudio or PipeWire) to manage sound. A common feature of this system is its attempt to be “smart” about new hardware. If you plug in a USB webcam with a built-in, low-quality microphone, or connect a monitor via HDMI that has tiny, tinny speakers, Ubuntu will often automatically switch your default audio input or output to that newly connected device. This means your high-end studio headphones suddenly go silent, and your Zoom call audio is unexpectedly routed through your monitor speakers.

Locking the Default Device

To maintain your preferred audio setup and stop Ubuntu from automatically changing the default audio device when new hardware is plugged in, you must adjust the underlying PulseAudio configuration.

Open your terminal application (Ctrl+Alt+T). You need to edit the PulseAudio configuration file. Type sudo nano /etc/pulse/default.pa and press Enter (you will need to enter your administrator password). Once the file opens in the nano text editor, use your arrow keys to scroll down and look for a line that reads: load-module module-switch-on-connect. This is the specific module responsible for the automatic switching. To disable it, simply add a hash symbol (#) to the very beginning of that line, changing it to #load-module module-switch-on-connect. Press Ctrl+O then Enter to save, and Ctrl+X to exit. Finally, restart the audio server by typing pulseaudio -k and pressing Enter.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.