I’m going to rehash some of what I posted so bare with me.
Out of the box with no software installed the fan should run as long as the fan shim gets power. That I believe is a default fail safe mode.
If the fan control pin is a high or floating the fan is on. If it’s pulled low the fan stops. This is how the service controls the fan, it turns it “off” by pulling the fan control pin low. And on by letting the pin go high.
Your fan runs with the service stopped so the hardware is fine, its a software issue, something is pulling that pin low. Something on the Pi side of things.
What that something is, I have no idea?
The fan control pin is BCM 18 physical pin 12 on the GPIO header. The default state for that pin on bootup is floating (not grounded).
The normal sequence of events would be the fan starts when the Pi is powered up. Then once the service starts, if the temp is below the threshold, it turns the fan off by pulling the control pin low. Then if the temp rises above the threshold it puts the control pin high to turn the fan on. Yours isn’t doing that last step for some reason?
I have a Fan Shim and it worked as advertised in plain Buster so my best guess is something in RetoPi is messing with it. Only way to confirm it is to install just Buster on your Pi and setup the fan shim and see if it works as normal.
I added a pull down resistor to my Fan Shim fan control pin. With no input from the service, it pulls the pin low turning the fan off. I toggled the default state to off instead of on. The fan still turns on and off as before via software.
I use the button on the fam shim to do a shutdown and wanted the fan to stop when I do that, and now it does. No having to unplug my power supply to make it stop. And pressing the button again does a boot up. And once the service starts the fan starts. “Something” is pulling your fan control pin low and holding it there.