I have a RPi4 with an USB microphone (I think it's unrelated to the issue) and jack speakers powered via USB. This set up worked flawlessly in a RPi3B, by the way. (Raspberry Pi OS)
The problem is that there is no sound at all from the speakers, unless the RPi is also connected to an HDMI screen.
In fact, while only the speakers are connected, if I right click the audio icon on the top right corner of the desktop, it says "No devices found". Even weirder, when I try to enter raspi-config>System Options>S2 Audio, it just comes back to the original raspi-config menu, as if I could not enter S2 Audio.
However, if I plug in an HDMI screen (with speakers), suddenly both devices are detected. The desktop corner audio icon works and I can choose the jack. In that case it works. If I then unplug the HDMI it will still work, but if I reboot with only speakers connected I'm back with the issue.
I also tested with different jack headphones and the situation is the same. It must be something related to the audio cards or HDMI/jack selection, but after going through internet for 2 days I have failed to find a solution
Thanks in advance!