Ok yes its partly my fault but I seem to have power control panel for KDE and Gnome working on the same machine. If I use just the Gnome settings and close the lid of my laptop, it will lock up and the only way to get back to normal is to power the laptop off again (aka hold the power button in). If I use the KDE power setting and close the lid of my laptop, it powers down correctly and when I open it up again, I get Ubuntu exactly where I left it after entering the user password again. Why?
Actually I'm almost not interested in the why but the how do I use KDE's Power settings instead of Gnome but still use Gnome? Right now I have to remember to start the KDE setting otherwise its back to powering off the laptop again. Oh just for bug reports and the record, I'm running Ubuntu 7.10 with Compiz Fusion (this only became a problem in 7.10). on a Dell XPS M1210 with an Intel Graphics card and restricted driver a/b/g wireless card. Everything else is fine except suspend and hibernate (which never works)
So anyone with a solution?
Glyn solved my problem. The problem is to do with the Gnome Power manager, so we disabled it from starting up in the boot manager and wrote at the end of the file /etc/acpi/lid.sh.
grep -q closed /proc/acpi/button/lid/*/state if [ $? = 0 ] then /etc/acpi/sleep.sh fi
This forces the Laptop to sleep when the lid is closed. Oh you should try running "sudo /etc/acpi/sleep.sh" from a command line to double check your machine will sleep ok. I'm planning to put up a bug report for this pretty soon.