I should mention that it randomly succeeded booting once, and I could use SSH to view some files. But after doing startx, I got a permission error, and then the raspberry pi shut down (crashed?)
oops.se
Raspbian can't boot on a Raspberry Pi 5, you need to use a recent "Raspberry Pi OS".