How to Stop Ubuntu from Automatically Switching Audio Output to HDMI When Connected to a Monitor

When you connect an external monitor or a TV to an Ubuntu laptop via an HDMI or DisplayPort cable, the operating system attempts to be helpful by automatically routing both your video and audio signals to the new display. However, if your external monitor has terrible built-in speakers—or no speakers at all—you will suddenly find your system entirely muted.

Constantly having to open the Sound settings to manually switch the audio output back to your laptop speakers or Bluetooth headphones every time you plug in a monitor is a tedious chore. Fortunately, you can configure the PulseAudio sound server to ignore new HDMI audio devices.

How to Stop Automatic Audio Switching in Ubuntu

Ubuntu uses PulseAudio to manage sound devices. A specific module, module-switch-on-connect, is responsible for this automatic hijacking. To stop the behavior, you simply need to disable this module.

  1. Open your terminal application (Ctrl+Alt+T).
  2. You need to edit the PulseAudio configuration file. Open it with a text editor like nano (using sudo):

sudo nano /etc/pulse/default.pa

  1. Scroll through the file until you find the following line:

load-module module-switch-on-connect

  1. To disable this module, you need to “comment it out” by placing a hashtag (#) at the very beginning of the line, so it looks like this:

#load-module module-switch-on-connect

  1. Save the file and exit the text editor (if using nano, press Ctrl+O, Enter, then Ctrl+X).
  2. Finally, you need to restart the PulseAudio server for the changes to take effect. Run the following command:

pulseaudio -k

What Happens Now?

The next time you connect your HDMI monitor, Ubuntu will still instantly send the video signal to the display, but your audio output will remain exactly where it was before you plugged the cable in. If you ever do want to use the monitor’s speakers, you can still manually select the HDMI audio output from the Sound settings panel.

Get the best tech tips delivered straight to your inbox.

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