10

I would like to know how to change (lower, in my case) CPU speed easily to adjust my needs. I have done research on the internet and it appears the same answers come back... "there is no need to lower your CPU speed". Well, great for the majority, yet, I have a need for it. It has always been the simplest way for me to stop my laptop from overheating and crashing... yes, ubuntu crashes due to overheating,... I had to go through updates 4 times before getting through using icepacks and a fan...

So here is my question: How can I easily control my CPU speed in Ubuntu? Any answer concerning this question is greatly appreciated! Thank You all in advance! :)

5 Answers5

7

With Ubuntu 22.04, I managed to easily change CPU frequency with cpupower-gui

sudo apt install cpupower-gui

cpupower-gui

Brewal
  • 171
5

One of the best ways to do this is to install indicator-cpufreq if you wish to do the limit frequently [since this app starts on login]:

sudo apt install indicator-cpufreq

While if you do limits not so often, you can install cpufrequtils

sudo apt install cpufrequtils

These are the safe ways too, in the sense that you do not have to do edits inside the system.

Dinei
  • 105
2017561-1
  • 520
  • 1
  • 7
  • 19
4

You've not mentioned the CPU model, so we don't know if it supports scaling, but if it does, you could try using cpufrequtils from the repositories.

  1. Install: sudo apt-get install cpufrequtils

  2. sudo cpufreq-set -g powersave - this will change the governot to convervative, and use the lowest frequency

  3. sudo cpufreq-set -f <supported-frequency> - to change the frequency manually.

For more info look at cpufreq-info --help and cpufreq-set.

mikewhatever
  • 33,013
0

I was in a similar situation where my AMD processors were overheating. I performed the following actions:

  1. Disable the CPU Boost permanently.
  2. Reduce the maximum CPU frequency until the temperature detected with psensor was low enough (in my case I wanted it to stay below 80 degrees celsius)
  3. Adjust bios settings so the cpu wasn't overly worked until my OS adjustments took affect.

I disabled CPU Boost Permanently, by creating/enabling a systemd service that disabled it on boot:

sudo nano /etc/systemd/system/boostoff.service

[Unit] Description=Disable Turbo Boost at startup

[Service] Type=oneshot ExecStart=/bin/sh -c "echo 0 > /sys/devices/system/cpu/cpufreq/boost"

[Install] WantedBy=multi-user.target

sudo systemctl daemon-reload sudo systemctl start boostoff.service sudo systemctl status boostoff.service sudo systemctl enable boostoff.service

I then changed every CPU's profile to the desired value as follows. Please keep in mind that mine will likely vary from yours because the number of cores might be different. You can see the true range of the number of policies with ls /sys/devices/system/cpu/cpufreq/. Also, I would view one of your policies' scaling_max_freq files to see what yours is currently set at as a baseline:

sudo nano /etc/systemd/system/slowercpu.service

[Unit] Description=Slow down cpu at boot

[Service] Type=oneshot ExecStart=/bin/bash -c "for i in {0..31}; do echo 1800000 | sudo tee /sys/devices/system/cpu/cpufreq/policy$i/scaling_max_freq; done"

[Install] WantedBy=multi-user.target

sudo systemctl daemon-reload sudo systemctl start slowcpu.service sudo systemctl status boostoff.service sudo systemctl enable boostoff.service

Lastly, I adjusted my bios settings to also disable cpu boosting and do what I can to slow down the CPU. It's also worth mentioning that in my case, I could take some load off my CPU by configuring my system to use the GPU more for various apps such as the browsers. I also raised my computer off the ground a little, so more air could enter through a vent. All these things have finally made this system more stable. I hope this helps someone, because I wish I had this guidance from the beginning!

0

I did this with setting up in /etc/sysfs.cfg

In my case I did fill in this file the following line for each cpu

devices/system/cpu/cpufreq/policy0/scaling_max_freq = 2700000
devices/system/cpu/cpufreq/policy1/scaling_max_freq = 2700000

and it worked for me. To find out how the exact path is to your controls, you've only to search through /sys/ as the lines in the /etc/sysfs.ctl do exactly that, they set up the values in this place. I had 8 cpus so there are 8 lines beginning with policy0 and ending with polidy7.

To quick check how it works on your system I did use the inline function:

cpufreq-info

with that function you may see how your system operates the cpu at the moment. So if it is setted up you may check if that worked or not.

To quick check how it workes you may do such kind of a command

sudo /bin/sh -c " echo 2700000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq "

if you only want to give a special programm rules you could use the tool cgroups. I think to drop down the speed is not allways better for the temperatur as if you get than because of this to much processes waiting, your cpus will run all the time on full speed and your system stays slow. But I did it because of the same reason. My cpu is now not more running with full speed 3100000 and uses a maximum value of 2700000 what is quick enough for me and doesn*t disturbs at all. I've never got the heat that quick up.