Originally Posted by BCarey
As a work-around, flushing the memory cache makes it much more likely that hibernation will work. I created a file in /etc/pm/sleep.d ...
Thanks for that! It seems to work very well. Normally I have about 20% success rate of hibernation, and with this workaround, it's run well twice in a row. FWIW I slightly altered the script, so that it logs (to /var/log/pm-suspend.log ) if the cache-flushing works. I also gave the file a low number (i.e. 00_flush_memory_caches), so it runs first.
echo "free (pre-flush):"
echo 1 > /proc/sys/vm/drop_caches
echo "Memory caches flushed (workaround to try and get hibernation working)"
echo "free (post-flush):"
case $1 in
I'm not sure if this is related, but I occasionally wake up to a black screen, where I can still see and move my mouse cursor. This happened on S3 suspend, before I added this script. If anyone else is still having this problem, and you are using Ubuntu/Compiz, then you can try the following workarounds, in order of preference.
1) ctrl-alt-1 to open tty1 and then ctrl-alt-7 to shift back. (This occasionally works.)
2) ctrl-alt-1 to open tty1; log in; type
then ctrl-alt-7 again. (Assuming you are using Unity. This rarely works, but is worth a shot.)
3) As per this commment
, ctrl-alt-1 to open tty1 (log in if not logged in yet); type
$ killall -KILL compiz
$ compiz --replace --display :0s
then ctrl-alt-7 again. You will not have a working window manager, so you won't be able to alt-tab, etc., but at least you can save your files. Then, I restart to get a working computer again. FWIW I also read somewhere that you might be able to kill compiz with SIGUSR1, but I've not tried it yet.