Ubuntu Hibernate on Lid Close

I had my Thinkpad T60 set up to hibernate at the log in screen when the lid is closed. After updating Ubuntu to 10.04, this didn’t work any more. I’ve gotten used to upgrades resetting this behavior, but this time the steps I’ve used in the past didn’t work.

With a little Googling, I came up with these modified instructions:

  • Log out of your X session
  • Go to a TTY session with Ctrl+Alt+F1
  • Log in
  • export DISPLAY=:0
  • sudo -u gdm gconf-editor
  • Switch to the graphical session with Ctrl+Alt+F8 (note, the graphical session used to be F7, but in Ubuntu 10, it’s now F8. If F8 doesn’t work try F7 or F9.
  • Select /apps/gnome-power-manager/buttons/lid_battery and change the value to hibernate
  • Close gconf-editor
  • Switch back to the TTY session and log out
  • Go back to the log in session with Ctrl+Alt+F8