I have an RPi4 installed with ubuntu20.10. I connect it to a display(TV) using an HDMI cable.

The problem is the output is by default set to a 3.5mm jack. I override that by running the raspi-config script and then I change the audio output to HDMI.

How to set default audio output to HDMI?

I opened /boot/config.txt

/boot/config.txt was empty

Also I tried to access the opt folder

cd: /opt: No such file or dir

  • Does / should Ubuntu use config.txt as per Debian? Maybe adding the lines in usercfg.txt Saying that, there are some answers in ubuntu-mate.community/t/… that may help and the 'how to' config docs at core.docs.ubuntu.com/en/guides/intro/get-started have two sound sections.
    – user115418
    Commented Dec 1, 2020 at 15:52
  • There are many Ubuntu releases, so unless you identify which no one knows, but whatever you CAN NOT use a Raspberry Pi OS solution.
    – Milliways
    Commented Dec 1, 2020 at 23:45
  • Yeah, @Milliways I have mentioned the ubuntu release '20.10' Commented Dec 3, 2020 at 11:35
  • @Andyroo I guess Debian doesn't use config.txt. I posted that just to clarify. I will check the solutions you mentioned. Commented Dec 3, 2020 at 11:37
  • @Milliways Ubuntu lots of Rapsberry Pi OS solutions work on Ubuntu/debian, specially now that Raspberry Pi OS comes with pulseaudio. The flip side is even more true... debian solutions almost always work on Raspberry Pi OS
    – Ray Foss
    Commented Dec 10, 2020 at 1:08

1 Answer 1


Note Not working on 21.10
Tl;Dr: Run the commands in the codebox to configure pulseaudio... and restart.

Things to note:

  • There is no raspi-config outside RaspberryPi OS
  • The config file you seek is in /boot/firmware/config.txt
  • But hdmi mode 2 probably ins't your issue... That's about DVI mode, if you can manually turn the audio on, that's not the problem.
  • pulseaudio has a config file at /etc/pulse/default.pa used by Ubuntu
  • You can override it for the current user by copying it to ~/.config/pulse/default.pa

The sink doesn't exist at GDM login apparently... but you can set the profile anyway. Userland pactl breaks and and the gui sound indicator shows no icon... but it selects the HDMI audio by default, and so does the volume control.

I have an ArgonOne which has a breakout board which connects to the headphone, probably tripping a headphone plugged in sensor. I tried disabling the sensor, but that didn't work.

Btw, Ubuntu 20.10 seems to use GDM to start pulseaudio, it's not a service and the daemonization is disabled. Also, pulse is known to be finnicky when independent digital and analog audio devices run off the same card... that may be why the GUI isn't able to set the default sink normally.

To fix for Pi 4B, run the following as the user you normally log into.

cp /etc/pulse/default.pa ~/.config/pulse/
sed -i 's/load-module module-switch-on-connect/# &/' ~/.config/pulse/default.pa



  • Me after a few hours of pain and suffering.
  • I tried running the code block. Its not working. :sad: Commented Dec 10, 2020 at 13:05
  • @BaskaranPanneerselvam Try now. This worked reliably. I had a lot of false starts due to a race condition. Pulseaudio 14 would help, with it's blacklist, but we have 13. The card is simply not ready when the settings are loaded. And the is no way to unload the modules in a way that reliably results in headphones being unselected. The best way I've found is to disable the module entirely.
    – Ray Foss
    Commented Dec 10, 2020 at 14:15
  • still no change Commented Jan 14, 2021 at 20:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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