Difference between revisions of "Talk:Power management"

From ArchWiki
Jump to: navigation, search
(Page purpose)
(suspend to hibernate require fix: new section)
 
(28 intermediate revisions by 11 users not shown)
Line 1: Line 1:
== Page purpose ==
+
== Suspend/resume service files ==
The power management options are quite cluttered around the wiki. This page should give an overview of the possible options where one can change power management settings. Descriptions for laptop-mode-tools is currently missing and there doesn't exist a wiki page for laptop-mode-tools yet. Also there is no description on how to use the laptop-mode-tools as I don't know how to use them. The precedence of the power setting options should be clarified. --[[User:BertiBoeller|BertiBoeller]] ([[User talk:BertiBoeller|talk]]) 01:24, 17 June 2012 (UTC)
+
 
: Thanks. The wiki indeed need a general Power Management page. However, application specific info should be moved to their page. e.g. Systemd related info should belong to [[Systemd]]. This page can be serve as index page of power management with links to other existing wiki page. -- [[User:Fengchao|Fengchao]] ([[User talk:Fengchao|talk]]) 03:05, 18 June 2012 (UTC)
+
I have the slight suspicion that the service files posted in the section [[Power Management#Suspend/resume service files]] might not work. Has anybody tried them or is actually using them? <br>
::Yes, having a general introduction to power management in Arch with links to all our articles would be really helpful, however I too recommend to move application-specific information to the proper pages. Please also link this article from others, and remember that we already have [[General Recommendations#Power management]] and [[Laptop#Power Management]] that may now overlap this article: duplication of information should always be avoided.
+
-- [[User:Jakobh|jakobh]] [[User talk:Jakobh|✉]]  03:12, 10 May 2013 (UTC)
::As fixed by Fengchao in the article, we do have a [[Laptop Mode Tools]] article and also other pages related to power management, e.g. [[Acpid]] which is not even mentioned here. Please search the wiki more thoroughly.
+
 
::-- [[User:Kynikos|Kynikos]] ([[User talk:Kynikos|talk]]) 11:41, 18 June 2012 (UTC)
+
: (Mod: the section was moved from [[systemd]] into [[Power Management]], so I moved this post too, fixed link along the way. -- [[User:Lahwaacz|Lahwaacz]] ([[User talk:Lahwaacz|talk]]) 10:24, 21 August 2013 (UTC))
:: Is it possible to rename the page? Perhaps a better name would be "Power Management (Overview)" to make the intention clear that this page should serve as a starting point for everyone interested in Archlinux power management. I had and have troubles finding out where to enable the power management options, especially as some options set in one place can be overruled by a setting in another place. My intention with this article was also to show the order in which the options are called. For example I was using the Kernel command line parameter for the audio powersave but the setting always overruled somwhere until I found out that it was pm-utils in combination with upower which overruled my setting.
+
 
:: Is it also possible to add an keyword to this page so that it shows up when someone searches for example for ''powersave''? --[[User:BertiBoeller|BertiBoeller]] ([[User talk:BertiBoeller|talk]]) 10:26, 15 July 2012 (UTC)
+
== Sleep hooks ==
::: You can create a page [[powersave]] and redirect to this page. See [[Help:Editing#Redirects]].
+
 
::: I do not think a rename is necessary. There are many overview pages in Arch Wiki without a overview in their name. Feel free to clean up and restructure this page to make it a really good overview.
+
Where is the exact difference between '''Suspend/resume service files''' approach and '''Hooks in /usr/lib/systemd/system-sleep'''?
::: -- [[User:Fengchao|Fengchao]] ([[User talk:Fengchao|talk]]) 02:48, 16 July 2012 (UTC)
+
 
 +
Is the latter obsolete?
 +
 
 +
-- [[User:Orschiro|Orschiro]] 07:33, 17 January 2014
 +
 
 +
:From {{ic|systemd-sleep(8)}}:
 +
::"Note that scripts or binaries dropped in {{ic|/usr/lib/systemd/system-sleep/}} are intended for local use only and should be considered hacks."
 +
:It's always preferred to use service files, they are much more flexible in handling the dependencies etc.
 +
:-- [[User:Lahwaacz|Lahwaacz]] ([[User talk:Lahwaacz|talk]]) 23:52, 31 January 2014 (UTC)
 +
 
 +
== Delayed hibernation service ==
 +
 
 +
I have found that the service file given in this section does not work. My laptop hibernates immediately after resuming from suspend. I have also found that the older version of this service found in the forum post does indeed work perfectly. Does anyone know why this is?
 +
[[User:Aouellette|Aouellette]] ([[User talk:Aouellette|talk]]) 16:16, 30 May 2015 (UTC)
 +
 
 +
== Resume file does not work after resuming from hibernation ==
 +
 
 +
The systemd unit {{ic|User resume actions}} presented on this page only worked for me after resuming from sleep, not from hibernate.  
 +
After adding {{ic|hibernate.target}} to the {{ic|After}} and {{ic|WantedBy}} lines it works both ways.
 +
However this is the first time I've done anything with such service files so I ain't sure if this is the optimal way.
 +
Can anyone confirm?
 +
 
 +
{{unsigned|18:30, 12 October 2015‎|PhilippD}}
 +
 
 +
:Actually, the {{ic|suspend@.service}} in [[Power_management#Suspend.2Fresume_service_files]] binds to {{ic|sleep.target}}, but {{ic|resume@.service}} binds to {{ic|suspend.target}}. They are not synonyms, systemd triggers {{ic|suspend.target}} and {{ic|sleep.target}} when the system is suspended to RAM, and {{ic|hibernate.target}} and {{ic|sleep.target}} when it is suspended to disk. This way you can bind your service to either one or both suspend methods using just a single target. -- [[User:Lahwaacz|Lahwaacz]] ([[User talk:Lahwaacz|talk]]) 19:17, 12 October 2015 (UTC)
 +
 
 +
== Bluetooth rfkill ==
 +
 
 +
Systemd now provides {{ic|systemd-rkfill.service}}. If you use {{ic|rfkill block}} to disable bluetooth, {{ic|systemd-rfkill.service}} will remember this and restore this state on next boot -- [[User:robtaylor|robtaylor]] ([[User talk:robtaylor|talk]]) Wed 18 May 16:10:05 BST 2016
 +
 
 +
== A "sensible value" for the laptop mode ==
 +
 
 +
The vast amount of specific information carried in this part, I find it a bit surprising. It seems "A sensible value for the laptop mode 'knob' is 5 seconds." could be heard in the mouth of a politician kicking the ball into touch.
 +
 
 +
From Documentation/laptops/laptop-mode.txt:
 +
 
 +
> The value of the laptop_mode knob determines the time between the occurrence of disk I/O
 +
and when the flush is triggered. A sensible value for the knob is 5 seconds. Setting the knob
 +
to 0 disables laptop mode.
 +
 
 +
So "5 (seconds)" is related to the virtual memory subsystem (in direct relation to ''vm.dirty_writeback_centisecs''). Then "0" turns laptop mode off, aha. It'd be cool to know *what* is laptop_mode is in the first place: Is it the whole vm configuration settings that are described in the docs? I believe not, as e.g. the conf files are not to be seen in present Arch (nor in other distros I know of).
 +
 
 +
A few things changed a bit since the Documentation/laptops/laptop-mode.txt was last edited, in 2004. I've searched extensively which part of it might still be up to date, without success so far. ''TLP'' has many if not most of the settings the doc explains. And so looks as an evolution of ''laptop_mode''. Would a guru or someone with knowledge about that be kind enough to specify the effect of ''vm.laptop_mode''?  [[User:Kozaki|kozaki]] ([[User talk:Kozaki|talk]]) 23:33, 1 September 2016 (UTC)
 +
 
 +
:The effect of the {{ic|vm.laptop_mode}} is described in the kernel docs in "The Details" section. The scripts that the docs talk about are probably [[Laptop Mode Tools]] nowadays. They are needed only to switch settings based on the current power source (and as a "bonus" they integrate most of the things in the [[Power_management#Power_saving]] section), but I bet the kernel settings are mostly the same as in 2004. -- [[User:Lahwaacz|Lahwaacz]] ([[User talk:Lahwaacz|talk]]) 08:41, 2 September 2016 (UTC)
 +
 
 +
:: I now see that, thank you Lahwaacz. Now as we may increase flush time to disk (to, say, ten minutes) via {{ic|vm.dirty_writeback_centisecs}}, delaying the flush up to five seconds via the {{ic|vm.laptop_mode}} knob doesn't make much sense regarding the ''disk'' power-savings... But it may help the ''cpu'' staying idle longer. Hence, whether set via [[laptop-mode-tools]], [[tlp]] or proper self-made [[udev]] rules. I.e. {{ic|vm.laptop_mode}} and {{ic|vm.dirty_*}} together help delaying and grouping system's activity ''as a whole'', allowing for longer power-saving efficient idle times. Please correct me if I'm wrong. [[User:Kozaki|kozaki]] ([[User talk:Kozaki|talk]]) 19:37, 4 September 2016 (UTC)
 +
 
 +
::: True, but the delay via {{ic|vm.laptop_mode}} makes sense also for other reasons. Let's say {{ic|vm.dirty_writeback_centisecs}} is set to something like 10 minutes and the disk is spun down due to inactivity and stays like that for e.g. 8 minutes, when it spins up due to user activity. Flushing all the cummulated dirty pages to the disk immediately might delay the request which caused the disk to spin up, so it's better to wait couple of seconds until there is chance that small high-priority requests have been serviced. Also, it might take couple of seconds to spin up the disk. -- [[User:Lahwaacz|Lahwaacz]] ([[User talk:Lahwaacz|talk]]) 20:14, 4 September 2016 (UTC)
 +
 
 +
== xss-lock ==
 +
 
 +
First of all I'm wondering why we are linking {{AUR|xss-lock-git}} instead of {{AUR|xss-lock}}. Secondly I wonder why we recommend the {{ic|-n}} flag; don't we want it to fork if we are closing the lid so presumably putting the computer into suspend/hibernate?
 +
 
 +
--[[User:Lindhe|Lindhe]] ([[User talk:Lindhe|talk]]) 20:09, 25 April 2017 (UTC)
 +
 
 +
:xss-lock-git is used because the release version has some bugs such as 100% CPU with certain window managers (for details, see upstream). The -n option is as used in the man page; a separate option is provided if you want to use the i3lock forking mode. The computer should however suspend regardless. -- [[User:Alad|Alad]] ([[User talk:Alad|talk]]) 21:57, 25 April 2017 (UTC)
 +
 
 +
== suspend to hibernate require fix ==
 +
 
 +
Rather than overriding the <code>suspend.target</code>, I think we should just add <code>RequiredBy=suspend.target</code> in the <code>[Install]</code> section of the service. It works for me, and I think this is cleaner. Can anyone else confirm that this works?
 +
--[[User:Svvac|Svvac]] ([[User talk:Svvac|talk]]) 14:16, 28 May 2017 (UTC)

Latest revision as of 14:16, 28 May 2017

Suspend/resume service files

I have the slight suspicion that the service files posted in the section Power Management#Suspend/resume service files might not work. Has anybody tried them or is actually using them?
-- jakobh 03:12, 10 May 2013 (UTC)

(Mod: the section was moved from systemd into Power Management, so I moved this post too, fixed link along the way. -- Lahwaacz (talk) 10:24, 21 August 2013 (UTC))

Sleep hooks

Where is the exact difference between Suspend/resume service files approach and Hooks in /usr/lib/systemd/system-sleep?

Is the latter obsolete?

-- Orschiro 07:33, 17 January 2014

From systemd-sleep(8):
"Note that scripts or binaries dropped in /usr/lib/systemd/system-sleep/ are intended for local use only and should be considered hacks."
It's always preferred to use service files, they are much more flexible in handling the dependencies etc.
-- Lahwaacz (talk) 23:52, 31 January 2014 (UTC)

Delayed hibernation service

I have found that the service file given in this section does not work. My laptop hibernates immediately after resuming from suspend. I have also found that the older version of this service found in the forum post does indeed work perfectly. Does anyone know why this is? Aouellette (talk) 16:16, 30 May 2015 (UTC)

Resume file does not work after resuming from hibernation

The systemd unit User resume actions presented on this page only worked for me after resuming from sleep, not from hibernate. After adding hibernate.target to the After and WantedBy lines it works both ways. However this is the first time I've done anything with such service files so I ain't sure if this is the optimal way. Can anyone confirm?

—This unsigned comment is by PhilippD (talk) 18:30, 12 October 2015‎. Please sign your posts with ~~~~!

Actually, the suspend@.service in Power_management#Suspend.2Fresume_service_files binds to sleep.target, but resume@.service binds to suspend.target. They are not synonyms, systemd triggers suspend.target and sleep.target when the system is suspended to RAM, and hibernate.target and sleep.target when it is suspended to disk. This way you can bind your service to either one or both suspend methods using just a single target. -- Lahwaacz (talk) 19:17, 12 October 2015 (UTC)

Bluetooth rfkill

Systemd now provides systemd-rkfill.service. If you use rfkill block to disable bluetooth, systemd-rfkill.service will remember this and restore this state on next boot -- robtaylor (talk) Wed 18 May 16:10:05 BST 2016

A "sensible value" for the laptop mode

The vast amount of specific information carried in this part, I find it a bit surprising. It seems "A sensible value for the laptop mode 'knob' is 5 seconds." could be heard in the mouth of a politician kicking the ball into touch.

From Documentation/laptops/laptop-mode.txt:

> The value of the laptop_mode knob determines the time between the occurrence of disk I/O and when the flush is triggered. A sensible value for the knob is 5 seconds. Setting the knob to 0 disables laptop mode.

So "5 (seconds)" is related to the virtual memory subsystem (in direct relation to vm.dirty_writeback_centisecs). Then "0" turns laptop mode off, aha. It'd be cool to know *what* is laptop_mode is in the first place: Is it the whole vm configuration settings that are described in the docs? I believe not, as e.g. the conf files are not to be seen in present Arch (nor in other distros I know of).

A few things changed a bit since the Documentation/laptops/laptop-mode.txt was last edited, in 2004. I've searched extensively which part of it might still be up to date, without success so far. TLP has many if not most of the settings the doc explains. And so looks as an evolution of laptop_mode. Would a guru or someone with knowledge about that be kind enough to specify the effect of vm.laptop_mode? kozaki (talk) 23:33, 1 September 2016 (UTC)

The effect of the vm.laptop_mode is described in the kernel docs in "The Details" section. The scripts that the docs talk about are probably Laptop Mode Tools nowadays. They are needed only to switch settings based on the current power source (and as a "bonus" they integrate most of the things in the Power_management#Power_saving section), but I bet the kernel settings are mostly the same as in 2004. -- Lahwaacz (talk) 08:41, 2 September 2016 (UTC)
I now see that, thank you Lahwaacz. Now as we may increase flush time to disk (to, say, ten minutes) via vm.dirty_writeback_centisecs, delaying the flush up to five seconds via the vm.laptop_mode knob doesn't make much sense regarding the disk power-savings... But it may help the cpu staying idle longer. Hence, whether set via laptop-mode-tools, tlp or proper self-made udev rules. I.e. vm.laptop_mode and vm.dirty_* together help delaying and grouping system's activity as a whole, allowing for longer power-saving efficient idle times. Please correct me if I'm wrong. kozaki (talk) 19:37, 4 September 2016 (UTC)
True, but the delay via vm.laptop_mode makes sense also for other reasons. Let's say vm.dirty_writeback_centisecs is set to something like 10 minutes and the disk is spun down due to inactivity and stays like that for e.g. 8 minutes, when it spins up due to user activity. Flushing all the cummulated dirty pages to the disk immediately might delay the request which caused the disk to spin up, so it's better to wait couple of seconds until there is chance that small high-priority requests have been serviced. Also, it might take couple of seconds to spin up the disk. -- Lahwaacz (talk) 20:14, 4 September 2016 (UTC)

xss-lock

First of all I'm wondering why we are linking xss-lock-gitAUR instead of xss-lockAUR. Secondly I wonder why we recommend the -n flag; don't we want it to fork if we are closing the lid so presumably putting the computer into suspend/hibernate?

--Lindhe (talk) 20:09, 25 April 2017 (UTC)

xss-lock-git is used because the release version has some bugs such as 100% CPU with certain window managers (for details, see upstream). The -n option is as used in the man page; a separate option is provided if you want to use the i3lock forking mode. The computer should however suspend regardless. -- Alad (talk) 21:57, 25 April 2017 (UTC)

suspend to hibernate require fix

Rather than overriding the suspend.target, I think we should just add RequiredBy=suspend.target in the [Install] section of the service. It works for me, and I think this is cleaner. Can anyone else confirm that this works? --Svvac (talk) 14:16, 28 May 2017 (UTC)