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
-
Juno Tab 3 Launches with Ubuntu 24.04
Anyone looking for a full-blown Linux tablet need look no further. Juno has released the Tab 3.
-
New KDE Slimbook Plasma Available for Preorder
Powered by an AMD Ryzen CPU, the latest KDE Slimbook laptop is powerful enough for local AI tasks.
-
Rhino Linux Announces Latest "Quick Update"
If you prefer your Linux distribution to be of the rolling type, Rhino Linux delivers a beautiful and reliable experience.
-
Plasma Desktop Will Soon Ask for Donations
The next iteration of Plasma has reached the soft feature freeze for the 6.2 version and includes a feature that could be divisive.
-
Linux Market Share Hits New High
For the first time, the Linux market share has reached a new high for desktops, and the trend looks like it will continue.
-
LibreOffice 24.8 Delivers New Features
LibreOffice is often considered the de facto standard office suite for the Linux operating system.
-
Deepin 23 Offers Wayland Support and New AI Tool
Deepin has been considered one of the most beautiful desktop operating systems for a long time and the arrival of version 23 has bolstered that reputation.
-
CachyOS Adds Support for System76's COSMIC Desktop
The August 2024 release of CachyOS includes support for the COSMIC desktop as well as some important bits for video.
-
Linux Foundation Adopts OMI to Foster Ethical LLMs
The Open Model Initiative hopes to create community LLMs that rival proprietary models but avoid restrictive licensing that limits usage.
-
Ubuntu 24.10 to Include the Latest Linux Kernel
Ubuntu users have grown accustomed to their favorite distribution shipping with a kernel that's not quite as up-to-date as other distros but that changes with 24.10.