Felipe's Blog

Your go-to source for Linux/Unix-like – tech – engineering.

Tips to Reduce Laptop Temperature

without comments

The solution is to limit the speed. When we use our laptops disconnected from the power source, the system “changes personality.” Now, the focus is not on providing maximum performance but on obtaining the maximum autonomy from our battery.

To achieve decent autonomy, the CPU speed is limited to the minimum possible, reducing CPU consumption, which, in turn, lowers its temperature and consequently reduces the time the fans need to be active, preserving our precious battery.

If you want to get the most out of your laptop’s battery on GNU/Linux, you can take a look at Slimbook Battery, a program designed by SLIMBOOK to improve the autonomy of their own laptops. It may also work on laptops from other brands, provided they are based on Intel processors.

cpupower allows us to manage our CPU more easily and even automate the parameters we want to use when our system starts.

Installation

For Arch Linux and its derivatives:


sudo pacman -S cpupower

Manual Usage

First, we need to use this command to find out which speeds our CPU accepts:


sudo cpupower frequency-info


This command will give us a result like the following, where we will find the information we need:


sudo cpupower frequency-info
analyzing CPU 0:
driver: intel_pstate
CPUs which run at the same hardware frequency: 0
CPUs which need to have their frequency coordinated by software: 0
maximum transition latency: Cannot determine or is not supported.
hardware limits: 800 MHz – 4.50 GHz
available cpufreq governors: performance powersave
current policy: frequency should be within 800 MHz and 2.60 GHz.
The governor «powersave» may decide which speed to use
within this range.
current CPU frequency: Unable to call hardware
current CPU frequency: 809 MHz (asserted by call to kernel)
boost state support:
Supported: yes
Active: yes

To limit the maximum frequency of the CPU, you can use this command:


cpupower frequency-set -u 2600MHz

To set the minimum frequency of the CPU, you can use this command:

cpupower frequency-set -d 800MHz


Remember to change the frequency values in the above commands to the desired value. But do not remove the unit (MHz), otherwise, it will not work.

Daemon Configuration

The great advantage of cpupower is that it provides a systemd service that we can configure to start with the system and set the parameters we want at startup, so we don’t have to type any commands every time we turn on the computer.

First, we have to configure the service, for which we need to edit the /etc/default/cpupower file, for example:



sudo nano /etc/default/cpupower


Then, remove the hashtags (#) from the following lines and put the values you want to use. For example, my configuration is as follows:


governor='powersave'
min_freq="800MHz"
max_freq="2.6GHz"


Depending on your CPU, frequency values may be different.

Pay attention to the units used to set the frequency. The file usually includes comments with details about the allowed units.

Finally, activate and start the service to make the changes effective, and these will be applied automatically every time you start the system.


sudo systemctl enable cpupower.service
sudo systemctl start cpupower.service


If you want to disable the cpupower service, you can do it like this:


sudo systemctl disable cpupower.service
sudo systemctl stop cpupower.service


If you have modified the configuration file and want the changes to take effect immediately without restarting:


sudo systemctl restart cpupower.service

Checking Your System:

Here are the commands from the ls family that serve to obtain detailed information about the hardware you have. Their operation is simple, and they obtain information through the identification of each component and the information available on the internet.

  1. lscpu: This command will show detailed information about the central processor in your CPU; it does not have any additional options or functionality.bashCopy codelscpu
  2. lshw -short: This is a general-purpose utility that reports detailed but summarized information about all the hardware installed on the system, such as the processor, RAM, storage, USB drivers, or network adapters.bashCopy codelshw -short
  3. lspci: This command will display a list of all the peripherals connected to the PCI ports on your PC, along with their details. You can filter the results using grep, for example:bashCopy codelspci -v | grep "VGA" -A 12
  4. lsscsi: Shows information about SCSI devices connected to the system.bashCopy codelsscsi
  5. lsusb: Lists all devices connected to USB ports, as well as the USB controllers on the system. This helps you identify working ports and troubleshoot problematic peripherals.bashCopy codelsusb
  6. lsblk: Lists information about partitions on hard drives and other storage devices, including optical drives like DVD or BluRay.bashCopy codelsblk

Additional Commands:

Apart from the ls commands described earlier, there are other very useful commands that provide more information than a simple list of components. They are more precise in showing the exact overall state of the system:

  1. df -H: Displays all system partitions, their mount points, and the available space on each.bashCopy codedf -H
  2. fdisk: Equivalent to Diskpart in Windows, fdisk not only shows information about system partitions and volumes but also allows you to make modifications to them.bashCopy codefdisk
  3. free -m: Shows the amount of installed, free, and used RAM.bashCopy codefree -m
  4. dmidecode: Differs from the previous commands as it extracts hardware information directly from the DMI tables.bashCopy codedmidecode
  5. hdparm: Shows information about SATA devices connected to the system.bashCopy codehdparm

This article has been written based on readings from the websites: https://tecnoysoft.com/2023/03/08/como-reducir-la-temperatura-de-trabajo-de-nuestros-portatiles/ and https://hardzone.es/tutoriales/mantenimiento/informacion-hardware-linux/

Written by Felipe

December 13th, 2023 at 12:08 am

Posted in Arch,Linux

Tagged with , , ,