What do the power management tools in Linux do? (acpi, pm-utils, etc...)

21

9

I am really really confused about the power management tools available for Linux: I have Arch Linux with XFCE on my laptop.

The guides on the the Arch Linux wiki list

  • acpi
  • acpid
  • pm-utils
  • cpufreq
  • laptop-mode-tools

to manage power, suspension, disks and CPU, WiFi, etc.

But I can't understand what the relationships between them are. Apparently they don't require each other (dependencies are listed as optional) but it's not clear to me what this implies: do they work together doing different things or are they alternative to each others or conflict with each other or what?


At the moment I only have pm-utils (+upower) installed. Do I also need acpi and/or acpid? And what about laptop-mode-tools: is this kind of supervisor of all the other tools? If so, should I configure only laptop-mode-tools or also each of the other tools separately? How do they interact with lm-sensors and cpufreq?

In addition to this, there is XFCE Power Manager, which seems to be unrelated to any of the above tools, as it works even if they are not installed. So my question is again, if I install the others will they conflict with XFCE Power Manager? And what about the power management options included in Xscreensaver? Do they conflict or do they override the settings in XFCE Power Manager (or acpi or pm-utils)?

All I want to do really is to have an efficient use of energy:

  • be able to go to standby/suspension
  • don't have the fan running all the time
  • don't overheat/damage the CPU and the hard drive
  • turn off WiFi when in standby/suspension
  • et cetera

rs028

Posted 2011-08-15T15:59:00.423

Reputation: 407

Answers

24

  • acpi is just a small program that displays basic ACPI information.

  • acpid is a daemon that handles ACPI events - mostly power button, lid, battery and related stuff. For example, if the power button was pressed, acpid runs shutdown. When AC power is connected, acpid can run the apropriate laptop-mode-tools command. If you use systemd, then it replaces most of acpid's functionality.

  • cpufreq (now obsolete) is a set of tools for adjusting CPU frequency. The core functionality is part of the kernel and accessible through /sys, and cpufreq commands are just for convenience, but some scripts may require them.

  • cpufreqd (with the d) is an user-space daemon that can be used as a replacement for the default kernel-space governors (powersave, ondemand, performance). It is not necessary – for most uses, the standard governors are enough.

  • cpupower is a replacement for cpufreq – it allows setting CPU frequency settings from command line.

  • laptop-mode-tools does various system adjustments whenever you plug or unplug AC power to your laptop – for example, disk spin-down times or switching cpufreq governors. It is triggered by acpid on AC events, and is inactive the rest of the time.

    (Note: Some of the settings in laptop-mode-tools may actually hurt performance and/or sanity; for example, it disables Ethernet autonegotiation, which IMHO is just silly.)

  • pm-utils handle the preparations of suspending to memory and/or disk (running pre-suspend hooks, choosing the best method). They are inactive the rest of the time.

    You used to need pm-utils to cleanly suspend the machine, but on modern machines, pm-utils does very little as it can just tell the kernel to suspend. If you use systemd, then it replaces pm-utils.

  • Additionally, pm-utils comes with a pm-powersave command that performs most of the same functions as laptop-mode-tools. pm-powersave is triggered by upower when you plug/unplug AC power, and performs various adjustments.

  • systemd-logind has functions for suspending/hibernating, and handles the most common ACPI events (lid switch, power button, etc.) It replaces acpid and pm-utils on most systems.

    (Unlike pm-utils, however, systemd-logind does not come with any pre-suspend hooks or other workarounds by default, and only uses the default kernel suspend method. It expects driver bugs to be fixed in the drivers.)

  • upower is an abstraction layer for desktop applications to various power parameters. Programs can use it to check battery status, adjust backlight, or suspend the system without having to care about the specific platform. upower also uses PolicyKit to allow various actions (suspend, etc) without giving away full root privileges. It relies on pm-utils and acpid. GNOME and Xfce require upower for their "power management" settings.

  • Xfce Power Manager controls such parameters as display poweroff time, CPU scaling, LCD brightness, ACPI events... (The function are similar to acpid and laptop-mode-tools, which both only have one system-wide configuration, while XfPM allows per-user settings.) XfPM only manages the policy, but relies on upower for the actual mechanisms. Also, XfPM sends out[citation needed] such notifications as "Low battery".

Note: I'm not entirely sure what is the relation between XfPM, acpid, laptop-mode-tools, and upower. It seems to me that XfPM replaces most of acpid/l-m-t functions, but not all of them.

user1686

Posted 2011-08-15T15:59:00.423

Reputation: 283 655

thanks a lot for your explanation. Let me see if I understand: Xfce Power Manager is a sort of 'GUI' which relies on upower, which needs pm-utils and also acpid (although acpid is not a dependency but this might be an archlinux issue). pm-utils does only suspend and laptop-mode-tools does other adjustments, but they do not conflict because they do different things. However they both need acpid to know what is going on. And finally cpufreq (and cpufreqd) are probably not necessary because the kernel should take care of that. Is this more or less correct? – rs028 – 2011-08-15T18:32:41.667

@rsom: XfPM is both a GUI for adjusting the settings, and also a daemon that ensures the settings are applied. Other than that, correct. – user1686 – 2011-08-15T18:37:31.833

but it does so by passing orders to the other tools (sort of a higher-level daemon)? Also what about the power management settings in Xscreensaver? do they override those in XfPM or vice versa? – rs028 – 2011-08-15T18:53:39.883

AFAIK, Xscreensaver does not do any power-management on its own - it simply sets the apropriate parameters in the X11 server. (Try xset q.) It could be that Xfpm simply manages the same settings, or that it doesn't manage the screen at all and lets the screensaver do it. (I'm using GNOME, which has its own program named "GNOME Screensaver", and I don't know whether Xscreensaver is Xfce's default... Reading the source of Xfpm would perhaps give the best answer.) – user1686 – 2011-08-15T20:52:12.957

I think I understand a lot better now. thanks a bunch. – rs028 – 2011-08-16T14:44:37.083

Also, yes, Xfpm orders upower to change various settings or to suspend the machine. (I'm not sure, though, if it uses upower for everything or just certain parts.) – user1686 – 2011-08-16T15:25:15.397

@grawity: Your incorrect in regards to upower requiring acpid. It does not require acpid, and from what I could understand, it never did. your simplistic explanation removed this confusion, simply install both. The reality is I installed upower and pm-utils, yet have all the features acpid provides. The question is why? – J. M. Becker – 2012-05-01T01:32:14.663

Looks like I just found my answer, I read this statement on a Debian Sid wiki page. "If you use laptop-mode-utils it depends on acpid, pm-utils has options that can replace laptop-mode-tools by placing scripts in /etc/pm/power.d/" – J. M. Becker – 2012-05-01T01:36:24.797