Optimizing laptop battery life with AcpiTool and PowerTOP
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 , 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.
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 . 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
at the command line.
In contrast to
inxi , 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
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.
You should pay special attention to the charge status of the battery when you call the software. Entering the
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 .
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
Both projects help organizations build their own containerized systems.
Mark Shuttleworth has resumed the position of CEO of Canonical.
Microsoft's open source code hosting platform CodePlex will come to an end after a more than 10-year stint.
Comes with Gnome 3.24
The bug was introduced back in 2009 and has been lurking around all this time.
The new release deprecates the sshd_config UsePrivilegeSeparation option.
Lives on as a community project
Five new systems join Dell XPS 13 Developer Edition that come with Ubuntu pre-installed.
The Skype Linux client now has almost the same capabilities that it enjoys on other platforms.
At CeBIT 2017, OpenStack Day will offer a wide range of lectures and discussions.