I've recently made a barstick pedestal, using a raspberry pi 3b+ running retropie. While I was building the actual pedestal I had played some games on the pi and really had no issues. Once I got the actual joysticks and buttons wired and hooked up I've had issues with my emulationstation, pretty much asks for controller configuration on every boot, after I do so it works perfect, then i enter a game. Controls continue to work well and then when I exit the rom emulationstation is nonresponsive. It's as if my controls are forgotten. Even my keyboard doesnt work. The pi was given to me by a friend who got it from a relative. Not sure exactly what image it is running. When it boots it says wdct 2.5 stretch. Hope that's enough info for someone out the to lend a helping hand thanx!
Looks like a permissions problem or a funky named controller that's not saved or possibly other problems (disk full ?) that prevent Emulationstation to save the controller configuration.
My advice is to start with a clean image and work from there - https://retropie.org.uk/docs/First-Installation/.