Set Default Pulseaudio Output Device on Boot Linux

Wainaina Gichuhi
2 min readMay 28, 2023

--

Set Default Pulseaudio Output Device on Boot Linux
Linux sound fix

I figured this solution when attempting to make my headphones/headset the default output device on boot on Linux*. If headphones/headset are plugged in before boot, the default output device is the speakers*. Usually, one has to unplug them and plug them back in for pulseaudio to switch from speakers to headphones/headset.

To set a preferred output as the default, use the pacmd tool.

Open the terminal and run

pacmd list-sinks

There will be a lot of information but look for the index number and the corresponding device that will be your new default output device.

pacmd list-sinks output
pacmd list-sinks output

In the above case, we have 1 sound device, analog-stereo (index: 0). Your system may have multiple.

To switch to headphones, we run the following command on terminal.

pacmd set-sink-port 0 analog-output-headphones

The port analog-output-headphones is listed on ports section of analog-stereo.

output ports for analog-stereo
output ports for analog-stereo

However, the above command resets after rebooting the system or pulseaduio.

To make it permanent, edit /etc/pulse/default.pa and append the lines below:

### Make headphones default
set-default-sink 0
set-sink-port 0 analog-output-headphones

Remember to edit, comment or delete the above lines if you no longer want to use headphones as default.

Finally, restart pulseaudio to apply the new configuration

systemctl --user restart pulseaudio

Some applications (like Spotify) may require a restart to use the new default device.

Does pulseaudio consume a lot of physical memory (especially on Wayland) on your system? Check out this fix.

--

--