Power saving for laptops: Difference between revisions

From Edgar BV Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 17: Line 17:
= Suspend and hibernate=
= Suspend and hibernate=


Suspend saves everthing to RAM, hibernate to disk. Suspend wakes up faster, Hibernate saves your batteries more.
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.


[https://help.ubuntu.com/stable/ubuntu-help/power-hibernate.html Ubuntu guide how to hibernate my computer and test it]
[https://help.ubuntu.com/stable/ubuntu-help/power-hibernate.html Ubuntu guide how to hibernate my computer and test it]
Line 28: Line 28:


[https://www.linux.com/news/how-suspend-and-hibernate-laptop-under-linux A great article on various types of suspend and hibernate, how to check if your machine works with the kernel or requires different types of suspend / hibernates]
[https://www.linux.com/news/how-suspend-and-hibernate-laptop-under-linux A great article on various types of suspend and hibernate, how to check if your machine works with the kernel or requires different types of suspend / hibernates]
= Hibernate =
== ways to hibernate ==
<pre>pm-hibernate</pre>
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
<pre>systemctl hibernate</pre>
is the way you should be hibernating
[https://wiki.archlinux.org/index.php/Power_management/Suspend_and_hibernate#Hibernation]
[https://wiki.archlinux.org/index.php/Power_management#Power_management_with_systemd]
[http://manpages.ubuntu.com/manpages/bionic/man8/systemd-suspend-then-hibernate.service.8.html]
needs trying
<pre>systemd-sleep</pre>
apparently a disaster.
<pre>Uswsusp</pre>
A collection of suspend tools:
<pre>s2ram, s2disk, s2both</pre>
[https://wiki.archlinux.org/index.php/Uswsusp]
NB not tried this yet.
== 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. [https://wiki.archlinux.org/index.php/Swap#Swap_file_creation 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)
<pre>
swapon -s
</pre>
will tell you if your swap is running or not.
=== swap files ===
[https://help.ubuntu.com/community/EnableHibernateWithEncryptedSwap]
[https://askubuntu.com/questions/396136/encrypted-home-partition-encrypted-swap-working-hibernate]
[https://www.linuxquestions.org/questions/slackware-14/luks-encryption-swap-and-hibernate-627958/]
== 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:
<pre>
[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
</pre>
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):
<pre>
sudo sed -i 's/#HandleLidSwitch=suspend/HandleLidSwitch=hibernate/g' /etc/systemd/logind.conf
</pre>
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)
=== Other files===
/sys/power/resume
/sys/power/resume_offset
/sys/power/reserverd_size

Revision as of 07:39, 13 July 2018

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

Hibertnate will not wake up properly with an encrypted swap partition by default. This is how to go about getting it to work

Archlinux page on suspend and hibernate

good Archlinux thread on troubleshooting

A great article on various types of suspend and hibernate, how to check if your machine works with the kernel or requires different types of suspend / hibernates

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]

[2]

[3]

needs trying

systemd-sleep

apparently a disaster.

Uswsusp

A collection of suspend tools:

s2ram, s2disk, s2both

[4] NB not tried this yet.

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

[5]

[6]

[7]

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)

Other files

/sys/power/resume

/sys/power/resume_offset

/sys/power/reserverd_size