Xbox 360 Controller not working in retropie

Hi.
I have setup retropie to autostart not using its own entry (which is number 3) but using the custom.sh script.
Retropie starts normally but the controller is not working.
When i launch retropie from inside a desktop environment the controller works fine.
What should i do?

just to link the GitHub issue that is open for same case https://github.com/MichaIng/DietPi/issues/3928