Q:

Ubuntu 13.10 suspend crashes KDE / black screen on wake

Setup
I have a fresh install of Ubuntu 13.10, with KDE (installed via Ubuntu server disk and sudo apt-get install kubuntu-desktop).
Problem
Whenever I suspend the computer while in KDE (either via sudo pm-suspend in Konsole or via KDE's interface), I get a black screen on wake up.
Attempted workarounds / fixes
If I press ctrl+alt+f1 and then ctrl+alt+f7 and I'm patient (20-30 seconds), I sometimes get back into KDE where I was, or sometimes I get back to the login screen (KDE crashed). But even when I get back into KDE, I get a notification saying that the special effects had to restart due to a graphics problem and then the fonts in all applications are... garbled.
If I suspend from another tty with sudo pm-suspend (while KDE is running on tty7), it works flawlessly (resumes instantly - no need to wait 20-30 seconds, KDE does not crash and does not cause font garble).
I tried changing graphics drivers and I get the same thing (I have Nvidia NVS300 and I'm using the latest proprietary drivers in Ubuntu repos). Also tried this Ubuntu freezes/crash after wake when upgraded to 13.10 and it didn't work.
This problem did not occur on the same system, when I was running Kubuntu 12.04.
Trying to find the problem...
Dmesg doesn't show any errors. I don't even know where to look further for any errors (any KDE logs?). Any help appreciated.

A:

I found this workaround. I made a script that switches to console before suspend and switches back after resume.
I put attached script into dir /etc/pm/sleep.d.  I gave it the name fix-black-screen and made it executable (sudo chmod +x /etc/pm/sleep.d/fix-black-screen).
#!/bin/bash

case $1 in
suspend)
    # Suspending to RAM.
    chvt 1
    sleep 1
;;
resume)
    # Resume from suspend.
    sleep 1
    chvt 7
;;
esac

Original fix found here.

