Pairing Debian Laptop with Bluetooth Headphones

I eat headphone jacks for breakfast so I've given up on buying wired headphones. I realised one day I could get bluetooth wireless, water-resistant headphones. One of the best purchases I've ever made. They are great. Good audio, and very convenient.

Except I still haven't figured out how to get my Debian laptop to connect to them reliably. When I want my laptop to output sound to my bluetooth headphones, it takes roughly 50 minutes to get it working to any degree at all.

So here's a loose assortment of things I try. First, a couple of shell commands.

sudo systemctl restart bluetooth
pulseaudio -k

Then, to control the bluetooth stuff, I start bluetoothctl, and in that interactive shell, I attempt to

1. Unpair headphones: remove mac_address
2. Power on controller: power on
3. Turn on scanning to find pairable headphones: scan on
4. Pair headphones: pair mac_address
5. Trust headphones (since no pin): trust mac_address
6. Connect to headphones: connect mac_address

I then leave that window open, or exit it with ctrlD. I have no idea if that makes any difference.

At this point I open pavucontrol to see that PulseAudio recognises that headphones are happening. Hopefully they show up under "Output Devices", or I try some other permutation of the above commands.

If they do show up, I go over to the "Configuration" tab and make sure they use the "A2DP Sink" profile.

Sometimes that works, sometimes it does not.