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
Restart.
Source
- Me after a few hours of pain and suffering.