Hibernate on power button - login screen
Every once in a while my SO-User (significant other user) leaves the computer but doesn't hibernate it. I want to push the power button to save some energy, but as I'm not in her session, the computer doesn't respond.
Is there a way to configure Ubuntu 11.10 to hibernate whenever the power button is pushed?
I already applied this solution, but that only works inside a session.
Solution 1:
I don't know the answer to the specific question you asked, but you can set the computer to automatically suspend after a set idle time:
Open "System Settings" from the power/gear menu (top right in Unity).
Click "Power"
Choose a suitable timeout.
Suspend isn't quite the same as hibernate, and there's no manual "do it now" feature, but it'll still save you power.
(Alternatively, you could log yourself in, and suspend it from your own session. Your SO would have to switch back to her own session when she returns.)
Solution 2:
After reading through Ubuntu's acpi setup, it seems like the issue is that when the login manager is running, there is no suitable handler running. So, according to the nicely-commented /etc/acpi/powerbtn.sh
, it defaults to just shutting down the computer. You'd like to change this behavior? I think you just need to remove the final line of powerbtn.sh
:
/sbin/shutdown -h now "Power button pressed"
and insert
/usr/sbin/pm-hibernate
above the handlers for X power management daemons (the three lines of comments), like this:
...
test -f /var/lock/acpisleep && exit 0
-> pm-hibernate
# If the current X console user is running a power management daemon that
...
and ACPI will invoke hibernation instead using your DE's power handling. Note that this change will affect all ttys, not just the X tty. That is, the power button will hibernate the computer when you're in tty1. If you're like most Ubuntu users, this isn't a deal breaker, because most people (myself included) spend 99% of their time in X.