Power manager ��� linux

Power Management

Содержание

Power Saving techniques can be used to minimize the heat produced and conserve energy. On laptops, this can be especially important as it can significantly extend battery life and excessive heat can be both uncomfortable and loud on portable devices.

There are several options for managing power under Manjaro. In this article, we will introduce three of the more popular options.

TLP is the most commonly used option for automatic power management.

Installing TLP

TLP is available from the Manjaro repositories, can be installed with your favorite package manager or by using entering the following command into your terminal:

Now that it is installed, you need to start and enable the service. This can be accomplished with the command:

Configuring TLP

TLP can manually configured by editing the file /etc/default/tlp as described in The Official Documentation.

A simpler way to configure TLP is via the GUI tool TLPUI

To install TLPUI install the package tlpui using your favorite package manager or with the command

Laptop Mode Tools

An Alternative to TLP for laptops is Laptop Mode Tools(LMT).

Installing LMT

To install laptop-mode-tools , enter the following command into your terminal:

Once installed, to enable LMT to start automatically every time you boot your computer, enter the following into your terminal:

LMT automatically configures some settings for you in order to optimize your laptop’s battery life.

LMT Configuration

For configuration, the file to edit is /etc/laptop-mode/laptop-mode.conf >

The individual kernel modules can be configured from the configuration files present in /etc/laptop-mode/conf.d/

PowerTOP

PowerTop a diagnostic tool used to identify and report issues with power consumption and management. It can be used as a reporting tool, an automated power management tool or both.

Installing PowerTop

It can be installed as

Generating Reports

You can generate a report using powertop with the command:

This will create the file powertop.html in the current directory. You can open this file in any web browser.

If you are using TLP for power management you may notice some differences in the recommendations between the tools. The article Comparing TLP with PowerTop reporting describes some of the reasons for these differences.

Automated Tuning with PowerTop

The command sudo powertop —auto-tune» will allow PowerTop to automatically tune power management based on it’s recommendations.

From a practical perspective, the best way to use PowerTops auto-tuning is with a systemd service.

To create, start and enable a systemd service for PowerTop you can use the commands:

ThermalD

ThermalD, the Linux Thermal Daemon can be used to automatically handle CPU frequency scaling according to system load.

To install it, install thermald in your favorite package manager or use the command:

After installing it needs to be configured to automatically start at boot in order to work:

Источник

Install TLP – linux advanced power management for laptops

It is well known that the laptop / netbook is on battery is much less when working in one of the Linux systems than Windows installed on the same machine .
There are various tricks that you can apply to your laptop / netbook to save battery , but many of them depend on the hardware , distribution , and some are outdated or too difficult to install for normal users , etc.

TLP ( TLP – Linux Advanced Power Management) is more progressive management utility battery- for Linux , which applies different settings automatically when you log on and every time you change the power source , depending on your distro and hardware.

Earlier I wrote about this utility in the article the acceleration of Linux mint and similar “. In a new article will touch on a little bit more information about this utility .

Читайте также:  Kali linux пропал звук

Settings depending on the Power Source

  • Kernel laptop mode and dirty buffer timeouts
  • Processor frequency scaling including “turbo boost” / “turbo core”
  • Power aware process scheduler for multi-core/hyper-threading
  • Hard disk advanced power magement level and spin down timeout (per disk)
  • SATA aggressive link power management (ALPM)
  • PCI Express active state power management (PCIe ASPM) – Linux 2.6.35 and above
  • Runtime power management for PCI(e) bus devices – Linux 2.6.35 and above
  • Radeon KMS power management – Linux 2.6.35 and above, not fglrx
  • Radeon dynamic power management – Kernel 3.11 and above, not fglrx
  • Wifi power saving mode – depending on kernel/driver
  • Power off optical drive in drive bay (on battery)
  • Audio power saving mode – hda_intel, ac97

Additional functions

  • I/O scheduler (per disk)
  • USB autosuspend with blacklist
  • Enable or disable integrated wifi, bluetooth or wwan devices upon system startup and shutdown
  • Restore radio device state on system startup (from previous shutdown).
  • Radio device wizard: switch radios upon network connect/disconnect and dock/undock
  • Disable Wake On LAN
  • WWAN state is restored after suspend/hibernate
  • Untervolting of Intel processors – requires kernel with PHC-Patch
  • Battery charge thresholds – ThinkPads only
  • Recalibrate battery – ThinkPads only

Installation latest version into Linux Mint:

Before installing TLP , there are several conditions which it is desirable to perform :
First . If you added some power saving settings/scripts, etc. , delete them or TLP may not work properly ;
Second . Remove laptop-mode -tools package

Now open a terminal , copy and run the following commands :

TLP does not have a GUI , so after installing the energy efficiency of your laptop / netbook will start after the next and all subsequent logons. But not to reload it now , run the following command :

And also there are some packages with additional features that can be installed from the software manager or run the following command:

And some additional packages only for Lenovo ThinkPad laptops :

Источник

Linux power management guide for laptops

Updated — April 11, 2018 by Arnab Satapathi

For laptops, battery life is one of the most important point to determine it’s usability, the longer is better. Bad linux power management profile could dramatically decrease the battery life, really, from 5-6 hours in windows to 2-3 hours in Linux, ultimately newbies will say Linux is very power hungry !

Most modern laptops uses the ACPI for power management, it’s much more flexible than old APM and managed by the OS, instead of BIOS. You don’t need to worry about ACPI, it’s already well integrated with Linux.

Here in this tutorial we are going to focus on normal usage like browsing, video and audio playback, word processing, note taking etc. etc, rather than totally idle state or heavy tasks like gaming.

Which Linux power management methods are worth to implement ?

In any UNIX like system everything could be tweaked to make it more power efficient, but few of them have noticeable power saving advantage. Bellow a few of them —

  1. Turn off discrete GPU like NVIDIA Optimus or AMD/ATI Hybrid Graphics
  2. Decrease display backlight
  3. CPU frequency scaling
  4. Spin down the hard drive
  5. GPU accelerated video playback
  6. Disable bluetooth, webcam, card reader
  7. Audio codec power management
  8. Optimize various kernel parameters
  9. Use power efficient network connection
  10. Use a lightweight desktop environment

This is a comprehensive list, there may be some useful power saving tweaks missing. Let’s dig a little deeper with those options above.

Low or weared out Laptop battery ? Here how you can show alerts on low battery automatically.

1. Turn off discrete GPU

If you are using a laptop with switchable discrete graphics card, make sure it’s turned off. This could be the biggest cause of power drain, almost tripling the power use than normal.

So how to turn off the discrete GPU ? It depends on your GPU and the Linux distro you are using. It’s one of the first thing to do after installing ubuntu or any linux distro.

If you are using a NVIDIA Optimus GPU and running a Debian or Debian derivative, have a look at this guide, Configure NVIDIA Optimus in Debian with bumblebee .

For Ubuntu and Linux Mint, have look here, Ubuntu nVIDIA Optimus setup .

If you are using AMD hybrid/switchable GPU and running Ubuntu or any Ubuntu derivative, look at this guide.

Читайте также:  С каких версий windows можно обновиться до windows 10

The vgaswitcheroo module could be handy, just run the commands bellow to turn off the discrete graphics.

Note: The vgaswitcheroo may not be always available.

2. Decrease display backlight

Laptop’s backlight is another major power consumer, reduce display brightness to a comfortable level, which should match the ambient light.

Most laptops could adjust display brightness with dedicated hot keys. If you are using KDE, Gnome, Cinnamon, Unity and other heavy weight desktops, it should work out of the box.

You may need to add the acpi_backlight=vendor boot time kernel parameter to the GRUB configuration for proper hotkey function, also don’t forget to update GRUB after adding this.

Though in lightweight desktop environments, hotkey functionality may not be available. In such case use the xbacklight app to manage display brightness.

You could directly change the brightness through the sysfs interface. For intel GPUs, try this command,

3. CPU frequency scaling

Casual tasks like browsing, reading pdf, playing audio doesn’t require massive CPU power, so under clocking the CPU saves a lot of power. Frequency scaling can intelligently scale up or down the CPU frequency according to need, or it could be set by user.

Probably need not to change anything here, as Linux kernel loads powersave or ondemand scaling governor by default, they are quite power saving and tries to always keep the CPU frequency lower.

If you are using Ubuntu and Unity desktop, there is a nice unity panel applet, indicator cpufreq.

Intel Sandy breeze or newer CPU uses the intel_pstate cpu scaling driver after kernel 3.9, it provides two CPU scaling governor, performance and powersave which is somewhat better than acpi_cpufreq driver.

If you are using a Intel turbo boost capable CPU, you may want to disable this facility while running on battery power.

4. Spinning down the hard drive

Laptop hard drives could consume up to 2.5 watt power, depending on task. So spinning down hard drives during low I/O activity period could save a descend amount of power.

Though power saving by hard drive spin down is controversial, as it causes lagging and spinning up the drive requires power surge.

Hard drive spin down could be set with the hdparm CLI app, install it in Debian or any Debain derivative

Now you could try to save some power by lowering the APM level, really works when very few apps are open and web browser is closed.

If you are using an external USB hard drive and it’s idle, i.e. just plugged in, you could completely spin down it to save a lot of power.

5. GPU accelerated video playback

If sole purpose is to play movies and watch youtube, you should use hardware accelerated video playback when possible. It off loads the video decoding task to GPU, thus reduces CPU usage and ultimately saves some power.

Media players like VLC, MPV or recent version mplayer support hardware accelerated video decoding. Try Baka-Mplayer, a lightweight mpv based media player with GPU accelerated video decoding support and nice Qt 5 based user interface.

You should also use a browser with GPU acceleration support, most modern browsers like Chromium, Firefox, Opera supports it, here is how to enable hardware acceleration in any chromium based browser.

Avoid playing flash videos in browser, as it doesn’t support GPU decoding there.

6. Disable bluetooth, webcam, PCI-E card reader

If you rarely use bluetooth, webcam or the PCI-E card reader, it’s better to turn them off. Disable the bluetooth with rfkill or hard block it with hotkeys if available. How to turn off bluetooth with rfkill

To disable bluetooth in Linux by blacklisting related kernel modules, create a text file /etc/modprobe.d/no-bluetooth.conf and put the blacklist files bellow there.

You could block the webcam in the same way, create a text file /etc/modprobe.d/no-webcam.conf and put the blacklist configuration there.

My laptop has a Realtek PCI-E card reader, I never used it, so I’m turning it off. Your card reader could be different, just find out which kernel driver it’s using with lspci -k and blacklist it. Blacklist configuration for Realtek RTS5209 card reader

You should also disable other unused devices too, like inbuilt GSM module or fingerprint scanner, if your laptop have any.

7. Audio codec power management

If you are not playing audio files frequently, put the sound card in idle state. As a temporary test, you could run the command bellow as root.

Читайте также:  Linux не видит wifi broadcom

To make it permanent, find the Audio device, usually it’s connected through PCI-E interface.

Note the PCI Bus ID and identify the kernel driver in use.

If you are using a Intel HDA sound card, create the /etc/modprobe.d/idle-audio.conf kernel driver configuration file and put the configuration bellow there.

If you are using AC’97 codec based card, use this configuration

8. Optimize various kernel parameters

Add some extra kernel parameters to the GRUB configuration to make the system even more power efficient.It could be done in different ways, in Ubuntu or Debian add the extra parameters to the /etc/default/grub file inside the line GRUB_CMDLINE_LINUX_DEFAULT=»quiet» .

  1. If your laptop’s CPU is Intel sandy Breeze or newer, save some power by idling the GPU, add i915.i915_enable_rc6=1
  2. To enable intel GPU framebuffer compression, add i915.i915_enable_fbc=1

Don’t orget to run sudo update-grub after adding those kernel parameters.

Now disable some features through the sysctl.conf file, add the configurations listed bellow to the sysctl.conf file, you need root privilege to edit the file.

  1. Add kernel.nmi_watchdog=0 to disable NMI watchdog, it’s useless for most users.
  2. Add vm.dirty_writeback_centisecs=1500 to reduce writes to HDD.

Don’t forget to run sudo sysctl -p to apply the new configurations.

Runtime power management for PCI-E devices, helps to save power power on low activity PCI-E devices. An one line script to set auto power management.

I’m not going to play with the SATA link power management, as it may cause data loss.

9. Use power efficient network connection

Here I mean use a network adapter technology which consumes less power.

  • Ethernet is most power efficient, use ethernet cable whenever possible. However Gigabit ethernet is not power efficient, could draw up to 1 Watt of power.
  • The second choice is bluetooth, if you are tethering from a phone, for this you have to enable bluetooth.
  • Third choice is Wi-Fi, it consumes significantly more power than ethernet and bluetooth.
  • Worst choice is mobile broadbrand, i.e. a GSM/CDMA modem, it could consume 2 to 2.5 watt power.

10. Use a lightweight desktop environment

Bloated desktops like KDE, Cinnamon, Unity draws much more power than lightweight desktops, as there are many background services, file indexing apps running on them.

So It’s good to choose a lightweight desktop environment like LXDE, LXQt or XFCE while running on battery power.

How to track power usage and optimize Linux power management ?

Powertop is a great app for this purpose, it provides an easy to understand result and possible hints to optimize power management.

In Debian, Ubuntu or any other derivative install powertop with apt-get.

Now take a measurement and generate a report for 1 minuite in HTML format with the powertop command.

Open up the HTML file with your favorite web browser and explore different results, the Tuning section is interesting.

Enough linux power management and power saving tweaks, hope it’s simple enough and most readers will find it useful.

If you have any question or suggestion please leave comments, that will make this guide even better. Also share this tutorial with friends if you like it.

stumbled onto this accidentally when i noticed that my rig was just power hungry with linux mint Rosa. Used to get about an hour and a half now im manging to squeeze 4 hours out of it. I know im really pushing it will need to get a replacement oem battery next week. My Rig and Gpu thank you for more fun times with my pc

Thanks for the feedback. Happy to know that you’ve found this guide useful.

November 22, 2016

xbacklight not working and also the command is not working.Don’t know about the grub.Display brightness still same.How do I fix this?

November 23, 2016

Does the /sys/class/backlight/intel_backlight/ folder exists ?

xbacklight won’t work if ACPI backlight is configured properly.

To add acpi_backlight=vendor kernel parameter edit the /etc/default/grub file ar root, find the line GRUB_CMDLINE_LINUX_DEFAULT and add acpi_backlight=vendor line there. See this> https://cdn.pbrd.co/images/7DRfxdpm.png

Try the second command too, if intel_backlight doesn’t exists, try /sys/class/backlight/acpi_video0/brightness .

Kon supratim ? Mahata babu ?

Good tutorial, I got a good idea how Linux power management works.

Thanks for your valuable feedback, keep visiting.

Источник

Оцените статью