Power saving for laptops
sudo apt-get install powertop indicator-power upower laptop-mode-tools
then run the following
gksu lmt-config-gui ;for laptop mode tools sudo powertop --calibrate ;note will run for some time
turn off bluetooth, check power settings for suspends
1). Enter the following in terminal: sudo gedit /etc/rc.local
2). Enter: rfkill block bluetooth
Suspend and hibernate
Suspend saves everthing to RAM, hibernate to disk. Suspend wakes up faster, Hibernate saves your batteries more. Hybrid modes try to combine the best of both worlds.
Ubuntu guide how to hibernate my computer and test it
Archlinux page on suspend and hibernate
good Archlinux thread on troubleshooting
Hibernate
ways to hibernate
pm-hibernate
is a collection of scripts that solve a lot of strange hibernation problems and bugs (see the man page). They should not be needed any more
systemctl hibernate
is the way you should be hibernating [1]
needs trying
systemd-sleep
apparently a disaster.
Uswsusp
A collection of suspend tools:
s2ram, s2disk, s2both
[5] (didn't work for me) NB not tried this yet.
How to Enable Hibernate in Ubuntu Linux
swapping
You can create a swap file or use a swap partition. It makes a difference if the file / partition is encrypted or not. It makes a difference if your swap is encrypted or not. a good general article on creating files or partitions NB. apparently for some people the solution is to create a swap file (haven't tried this yet)
swapon -s
will tell you if your swap is running or not.
swap files
find out if your swap partition is encrypted
blkid | grep swap
Turn encryption on
That is pretty simple
sudo ecryptfs-setup-swap
Turn swapfile enctyption off
The idea is to turn off swap, remove the ecryptfs layer, reformat your partition with normal swap and enable it. We use sda5 as an example for the swap partition, please use your own (fdisk -l will tell you which swap partition you are using - or in /etc/crypttab)
sudo swapoff -a sudo cryptsetup remove /dev/mapper/cryptswap1 sudo vim /etc/crypttab *remove the /dev/sda5 line* sudo /sbin/mkswap /dev/sda5 sudo swapon /dev/sda5 sudo vim /etc/fstab *replace /dev/mapper/cryptswap1 with /dev/sda5*
how to disable encryption on your swap file
edits to enable hibernation
Edit this file: /var/lib/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
eg.: sudo gedit /var/lib/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
Add this content:
[Re-enable hibernate by default in upower] Identity=unix-user:* Action=org.freedesktop.upower.hibernate ResultActive=yes [Re-enable hibernate by default in logind] Identity=unix-user:* Action=org.freedesktop.login1.hibernate ResultActive=yes
This will add hibernate option in menu. But if you want to hibernate, when LID will close, then execute this (this will enable hibernation when LID is closed):
sudo sed -i 's/#HandleLidSwitch=suspend/HandleLidSwitch=hibernate/g' /etc/systemd/logind.conf
And restart system or execute: sudo systemctl restart systemd-logind.service (https://unix.stackexchange.com/questions/125832/no-hibernate-option-in-power-manager-on-mint-16-mate)
If you have change your hard disk or the partition table, then your computer will save a session, but it won't be able to resume it upon power up, acting as if it was rebooted rather than hibernated.
In this case, you have to inform initramfs-tools about the correct partition uuid. First of all, take note of the id of your swap partition with
$ ls /dev/disk/by-uuid -la
Then, edit the file /etc/initramfs-tools/conf.d/resume accordingly.
Finally update initramfs with
# update-initramfs -u
It it still doesn't work, try to specify the restore partition to Grub too. However, it should not be necessary.
Edit the file /etc/default/grub specifying the UUID of your swap partition:
GRUB_CMDLINE_LINUX="resume=UUID=6098d082-4654-4840-8937-7337d14b2c5d other-option=value"
or simply use the device
GRUB_CMDLINE_LINUX="resume=/dev/sda1 other-option=value"
Don't forget to update Grub.
# update-grub
Reboot, and try to hibernate:
# pm-hibernate
Other files
/sys/power/resume
/sys/power/resume_offset
/sys/power/reserverd_size