Works great at first then randomly doesn’t start

every time i install Kodi, it works great for a while. I turn it on, use it, turn it off and repeat and then randomly just stops working. I will try to start it up and just get a black screen. Then it just is stuck at a black screen or goes back to the RetroPie ports menu. Then i have to purge everything and reinstall

and then it happens again. randomly.

Any ideas? i have tried starting it with no controllers plugged in, but my keyboard also stopped working somewhere along the line and only the F keys work unless im in setup menus.

This is on retropie 4 on raspberry pi 3