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! :)

  • 1
    This sounds like an XY problem http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem . Maybe you should focus on your actual problem "ubuntu crashes due to overheating". Last time I had a problem like that I had to upgrade my BIOS (2010). – xangua Jun 12 '15 at 04:50
  • There are many answers. Any that I give would be based on primitive commands and not on higher level tools. The answer depends on which frequency scaling driver you are using. Do: cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_driver and perhaps edit that information into your question. – Doug Smythies Jun 12 '15 at 06:10
  • @xangua I don't think so. I had the same problem once, the hardcoded temperature limit of my cpu was 85°C, which could be easily reached when having Minecraft and Chrome up at the same time, simply because the heat sink was designed in a way it could actually have been left away. – s3lph Jun 12 '15 at 07:27
  • I thank you for your answers; my laptop has a sticker A4 VISION AMD - I know how to get the info easily under windows but not in ubuntu. Also, changing the maximum processor speed in windows is simple; the information you guys are giving me feels already too advanced for me... I just wish I could make it stop crashing, same way i had fixed it in windows, lower CPU max down to 70% Thanks again! – user1452304 Sep 08 '15 at 07:41

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
  • 1
    seems adjusting min and max frequencies have no immediate effect on clock speed. while doing $ watch -n1 “cat /proc/cpuinfo | grep Hz” with my governor in performance mode I get 3.4GHz whenever I set both min and max to be 5GHz – linker Feb 21 '23 at 20:42
  • @LiNKeR I'm not sure about the reliability of this command but I did had good results with the small app I used. My laptop's fans were going crazy because of this issue. I then used auto-cpufreq if I remember. You should give it a try – Brewal Feb 22 '23 at 21:48
  • Thanks, works like a charm on my Ubuntu 24.04 LTS – Dude named Ben Jun 22 '24 at 16:33
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
  • 530
  • Tried indicator-cpufreq, affected by https://github.com/xuancong84/indicator-cpufreq/issues/5. After fixing that and running indicator-cpufreq -f it didn't seem to display a credible frequency. Running watch -n1 'cpufreq-info | grep "frequency is" | sort -h' however displays meaningful data (updating periodically). This also shows that the limit imposed by cpupower-gui works well. So, I use both in combination now. This is Ubuntu 24 on Thinkpad X1 gen 12, on Intel Ultra 7 165U. – Jan-Philip Gehrcke Feb 06 '25 at 08:37
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,073
  • 1
    The acpi-cpufreq scaling driver conservative governor does not use the lowest CPU frequencies. It uses a slower CPU frequency Verses load response curve. The powersave governor uses the lowest CPU frequencies. – Doug Smythies Jun 12 '15 at 06:27
  • I have added info in comments up-top; I will look into your solution, yet still unsure of what all of this means even though I have read of cpufrequtils in other places, i'm worried I could mess something up. – user1452304 Sep 08 '15 at 07:42
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.