It's an issue that i'm tracking long time ago, but without answer. I'm already end to load several roms to a clean install of 5.22 dev, and after a reboot, I STILL GOT THIS PROBLEM.
First, i thought it was the old "gamelist.xml" (since it was an old romset that i have, scraped with "skraper"). I delete all gamelist.xml, and for a while, it worked. I add games to the collection, and the issue is back...
Then, i made the fresh install of 5.22, run it, wait to generate the SHARE partition, save config, restart, upload all the roms that i have, without pcmanfm (the file explorer embedded with batocera...even pressing F1, copy files and then exit gave me black screen, so i use a live distro for copy files) and checking that there's no gamelist.xml on any folder (except the gamelist that already comes on prboom, nes, and the other demo games...) or images of older scraps, reboot, enter batocera, enter a game, exit....BLACK SCREEN 🙁
I'm in a point of "don't know what to do". I don't want to go back to Recalbox or lakka, since they don't have all the emulators that batocera have.
Like you, sometimes is random. I enter a game on atari2600, exit, and all is OK. I enter other game, (ex: atari5200), exit, and the black screen is back.