OK, finally some good news (for me, anyway): I found the cause of “black screen freeze” and a way to recover from it.
For some unknowable reason I’m not allowed to edit my own older posts, so I cannot update the original as I promised; hopefully people find it here…
TL;DR workaround / recovery from the black screen (connected via SSH):
sudo apt remove xscreensaver
killall xscreensaver
export DISPLAY=:0
xset dpms force off
Details:
The “black screen” freeze has something to do with xscreensaver: I refrained from using it for the past few weeks (as well as limiting the RAM usage as mentioned earlier), but I needed to lock the screen over this weekend – and when I came back, it was stuck on a black screen again.
Since the screen lock was the only difference in my recent activity, I now knew where to look, and soon found out that 1) killing, restarting or removing xscreensaver does not help, and 2) after starting it again and trying to activate it from command line, it runs into some issue:
xscreensaver-command: blanking
xscreensaver-command: waiting for status change
xscreensaver-command: read status property: 0x3f8: 0, 1743357497, 0, 0
xscreensaver-command: read status property: 0x3f8: 0, 1743357497, 0, 0
xscreensaver-command: read status property: 0x3f8: 0, 1743357497, 0, 0
... (repeats)
xscreensaver-command: Timed out waiting for screen to blank
Clearly xscreensaver has some trouble talking to the GPU or X-server, telling it to blank the screen, so it would not take much imagination to come to the conclusion the opposite is also true, and the “black screen freeze” is simply the screen being stuck in a blanked state – which explains why the cursor keeps moving and even changes shape to text cursor / resize / hyperlinks as I move it around: the GPU is fine and all the applications are running, it’s just all stuck behind some black overlay.
I tried to find out how xscreensaver performs the blanking in hope it could be reverted in some other way, and while xset may not be exactly what’s used by xscreensaver internally, running xset dpms force off seems to be enough to shake off whatever weird state the system was in and get the running session back into a working state.
After recovering from the stuck state, the obvious preventive measure is to use a different screen locking tool – assuming they are not suffering from the same issue (remains to be seen I suppose).