How to Stop Ubuntu Linux from Automatically Switching Audio Devices

The HDMI Audio Hijacking Issue

Ubuntu Linux is designed to be plug-and-play. Whenever it detects a new audio device, such as a USB headset or an external monitor connected via HDMI, the PulseAudio (or PipeWire) sound server will automatically switch your default audio output to that new device. While this is helpful for headsets, it is incredibly annoying if you plug in a secondary monitor just for the extra screen space, and Ubuntu suddenly mutes your high-quality desktop speakers to route the sound through the monitor’s terrible built-in speakers.

How to Disable Automatic Output Switching

You can edit the core PulseAudio configuration file using the terminal to comment out the specific module responsible for automatically switching audio sinks.

1. Open your terminal application.

2. Open the PulseAudio default configuration file with root privileges by typing: sudo nano /etc/pulse/default.pa

3. Scroll down through the text file until you locate the section handling switch-on-connect modules. You are looking for a line that reads: load-module module-switch-on-connect

4. To disable this module, you need to “comment it out.” Add a hash symbol (#) to the very beginning of the line so it looks exactly like this: #load-module module-switch-on-connect

5. Save the file by pressing Ctrl + O, press Enter, then exit nano by pressing Ctrl + X.

Applying the Fix

For the change to take effect, you need to restart the audio server. You do not need to reboot your entire computer to do this. Simply type pulseaudio -k in the terminal and press Enter to kill the current process. Ubuntu will immediately restart the audio server in the background. From now on, when you plug in a new HDMI monitor or USB headset, Ubuntu will recognise it but will not switch to it. If you want to use the new device, you must manually click the sound icon in the top right corner and select it from the output list.

Get the best tech tips delivered straight to your inbox.

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