Optimizing laptop battery life with AcpiTool and PowerTOP
Charge!
AcpiTool and PowerTOP ensure a sustainable battery lifetime and guarantee low energy consumption of laptops running Linux by identifying power hogs and maintaining the battery.
Far from the next power outlet, many users look anxiously at their laptop's battery charge state. Although modern hardware relies on several tricks to save power, whether or not they actually work often depends on your hardware.
One option available to Linux users is managing power through the ACPI kernel modules (see the box titled "The ACPI Dilemma"). Recent machines also let you configure many components on the fly to reduce energy consumption. The small command-line programs AcpiTool and PowerTOP can help you keep track of your power demands and keep your laptop from shutting down when you really need it.
The ACPI Dilemma
The Advanced Configuration and Power Interface (ACPI) standard was created in 1996 as a successor to the APM standard. Since then, ACPI has evolved steadily and adopted new technologies, such as USB, PCIe, and SATA. Unlike ACPI's predecessor APM, the operating system rather than the BIOS controls ACPI, so the two standards are incompatible. ACPI relies on functions implemented in the respective hardware, which explains why only the old APM energy management standard is suitable for older computers without the appropriate routines.
Linux and other free operating systems typically use ACPICA (ACPI Component Architecture), an ACPI reference implementation developed by Intel. The operating system calls the DSDT (Differentiated System Description Table) built into the BIOS with parameters for individual components and controls the computer's individual operating states accordingly.
Soon after its original specification, ACPI became a key technology because of the ever-increasing spread of mobile computers. For this reason, in 1999 Microsoft launched its own Windows variant of ACPI, which is not fully compatible with the Intel specification. Hardware manufacturers mostly test their new components against the Microsoft specification because of the dominance of Windows, so errors may occur on systems that use the Intel implementation. As Bill Gates once revealed [1], Microsoft consciously caused this problem to make life difficult for alternative operating systems.
The Linux developer community, which Microsoft's efforts primarily targeted, has now solved many of the problems related to ACPI: Linux now supports Windows modes by pretending to be Windows when the BIOS asks. Developers correct problematic reactions to bad DSDT tables quickly after they become known, so in many cases, laptops that have been around for a few months can use most ACPI modes. Even if you have brand new hardware with many new components, all the ACPI techniques will typically work after a short period of time.
Specifics
AcpiTool resides in the repositories of virtually all the major distributions, and you can install it conveniently from there via the respective package manager. If it is missing from your choice of distribution, you can quite easily build the tool from the source code [2]. After installation, call acpitool
in a terminal window. The software works in userspace, so you do not need root privileges (Figure 1). The program parses the contents of the /proc/acpi
directory and converts it to a legible format.
AcpiTool understands a large number of parameters, some of which, however, only work on ASUS, Toshiba, and Lenovo brand laptops, as well as older IBM devices. These features result from certain characteristics of the hardware, but most switches work properly on all laptops. For a list of the available options, you can type
acpitool --help
at the command line.
Info
In contrast to inxi
[3], for example, acpitool
is not used primarily to spit out comprehensive information about the hardware. Users are typically interested in the battery status and supported modes, and if you are battling a laptop that unexpectedly insists on running at full power all the time, information on the CPU and the thermal sensors can help, as well.
To view all the relevant data, type
acpitool -bcftv
at the command line. The software then lists the relevant information. If the output contains notes on an incomplete directory structure below /proc/acpi
, this indicates that kernel modules are missing or that some functions are not supported by the hardware.
In the case of unsupported functions, you can call the sensors-detect
command at the command line with root privileges.
The software is included in the lm-sensors package, which is found in the repositories of most distributions. It detects the sensors in the notebook and, if you allow this to happen, adds corresponding modules to your Linux configuration.
Battery Problems
You should pay special attention to the charge status of the battery when you call the software. Entering the
acpitool -Bv
command outputs detailed information. Of course, even the latest laptops with state-of-the-art lithium-ion and lithium-polymer batteries can suffer from a kind of "memory effect" after extended operation with many cycles, which often significantly reduces capacity [4].
This memory effect phenomenon occurs after many partial discharges with subsequent recharging. Notebooks that run almost exclusively on the power supply are especially vulnerable: The electronics controlled by the operating system automatically recharge the battery as of a specific discharge threshold. The resulting chemical processes involved in partial charging and discharging affect the voltage in cells over time.
The output from AcpiTool with the -Bv
parameters gives you three important pieces of information on the battery status (Figure 2): the Remaining capacity (milliamp-hours, mAh), the Design capacity (i.e., the original maximum battery capacity), and the Last full capacity (i.e., the capacity that existed before the last charging).
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.
-
SUSE Renames Several Products for Better Name Recognition
SUSE has been a very powerful player in the European market, but it knows it must branch out to gain serious traction. Will a name change do the trick?
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.
-
Linux Sees Massive Performance Increase from a Single Line of Code
With one line of code, Intel was able to increase the performance of the Linux kernel by 4,000 percent.
-
Fedora KDE Approved as an Official Spin
If you prefer the Plasma desktop environment and the Fedora distribution, you're in luck because there's now an official spin that is listed on the same level as the Fedora Workstation edition.
-
New Steam Client Ups the Ante for Linux
The latest release from Steam has some pretty cool tricks up its sleeve.
-
Gnome OS Transitioning Toward a General-Purpose Distro
If you're looking for the perfectly vanilla take on the Gnome desktop, Gnome OS might be for you.