Disable Turbo Boost / Set Constant CPU Speed in Ubuntu 22.04/24.04

Last updated: January 13, 2024 — Leave a comment

This tutorial shows how to turn off CPU turbo boost, and/or set constant maximum (or minimum) CPU speed in Ubuntu 22.04 and/or Ubuntu 24.04.

Disable turbo boost will limit your CPU speed to prevent running over the base frequency. It’s useful to save power and prevent your computer from overheating. For choice, user can also set constant CPU speed for either minimum power consumption or maximum performance.

Most machine today has option in the BIOS page to enable/disable and even change CPU frequency, however, it’s not flexible.

For Linux, the Kernel has a tool called cpupower can do the job from command line, and user can turn on/off turbo boost through sysfs. Gnome Desktop even has a GRAPHICAL extension (scroll-down to see step 4) to make things easier.

1. Disable turbo boost via single command:

Depends on the CPU scaling driver, there are 2 commands to enable/disable CPU turbo boost.

First, press Ctrl+Alt+T on keyboard to open up a terminal windows, then run following commands accordingly.

For ‘intel_pstate’ driver

If you have Intel CPU in your machine, first try running the command below:

cat /sys/devices/system/cpu/intel_pstate/no_turbo

The command should output:

  • 0 – means Turbo Boot is enabled!
  • 1 – Turbo Boost is disabled!
  • No such file or directory – other driver rather than intel_pstate is in use

If it outputs 0, then you can run command to set its value to 1 to disable turbo boost:

echo "1" | sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo

If 1, then use command to re-enable the feature:

echo "0" | sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo

For other scaling drivers

If the first command above outputs “No such file or directory”, then other scaling driver is in use.

In the case, run command to check anther sysfs:

cat /sys/devices/system/cpu/cpufreq/boost

As well, the command should output either 0 or 1. And, you can disable turo boost by setting its value to 1:

echo "1" | sudo tee /sys/devices/system/cpu/cpufreq/boost

Disable turbo boost on Startup

The commands above work until reboot! In next boot, you system will restore the change and by default enable the turbo boost feature.

In the case, you can create a systemd service to run the above command automatically while booting the system.

But, why not disable it from BIOS settings 🤔?

1. To do so, first run command to create a system service:

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

The command will create a service called boostoff.service and edit it in terminal. When it opens, paste following lines:

[Unit]
Description=Disable Turbo Boost at startup

[Service]
Type=oneshot
ExecStart=/bin/sh -c "echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo"

[Install]
WantedBy=multi-user.target

NOTE: for non-intel_pstate driver, use /sys/devices/system/cpu/cpufreq/boost instead of the bold text of ‘ExeStart’ value.

When done editing, press Ctrl+S to save file and Ctrl+X to exit.

2. Finally, enable the service, so to automatically disable turbo boost at startup:

systemctl enable boostoff.service

2. Set Minimum, Maximum, or Constant CPU Speed

Without turning off boost, you can for choice limit the maximum frequency or set a constant CPU frequency. This can be done a cpupower tool.

1. First, open terminal (Ctrl+Alt+T) and run command to install the tool for current Linux Kernel.

sudo apt install linux-tools-$(uname -r)

2. Then, you may run command to check which scaling driver is in use, minimum and maximum CPU frequency supported by your hardware, etc information.

cpupower frequency-info

3. To set constant minimum CPU Speed, just run:

sudo cpupower frequency-set --max 800MHz

This command will limit the maximum CPU speed to 800MHz, which is the minimum speed according to last screenshot. Change the number according to your cpupower frequency-info output.

To set constant maximum CPU Speed, run:

sudo cpupower frequency-set --min 4.30GHz --max 4.30GHz

Other than 4.30GHz, you can set any speed in last command that beyond your CPU capability. It will try running at maximum speed. If turbo boost disabled, then base frequency.

For choice, you may also set CPU to a specific speed by running command (2000MHz for example):

sudo cpupower frequency-set --freq 2000Mhz

Since Kernel 6.6, there’s also an option to disable turbo boost. But don’t know why, it does not work in my case for Intel CPU.

sudo cpupower set --turbo-boost 0

Disable GNOME Power Profile Daemon

For the default GNOME Desktop, the built-in power mode settings may conflict with the cpupower commands above.

In the case, you can disable the power-profiles-daemon by running the 2 commands below:

  • First, open terminal and stop the service:
    systemctl stop power-profiles-daemon.service
  • Then, mask it to prevent auto-run in next boot:
    systemctl mask power-profiles-daemon.service

(Optional) To re-enable the service, run:

systemctl unmask power-profiles-daemon.service
systemctl start power-profiles-daemon.service

Make cpupower option work in next boot

Like the command to disable turbo boost, cpupower also works until reboot!

To make it work at startup, first create the service:

  • Create a system service (some Linux creaet the service automatically after installed the tool):
    sudo nano /etc/systemd/system/cpupower.service
  • Then paste following lines and save by pressing Ctrl+S, then Ctrl+X. Also, change the command in bold accordingly.
    [Unit]
    Description=Adjust CPU speed via cpupower
    
    [Service]
    Type=oneshot
    ExecStart=/bin/sh -c "cpupower frequency-set --max 800MHz"
    
    [Install]
    WantedBy=multi-user.target

Then, enable the service via command:

systemctl enable cpupower.service

3. Check CPU Speed in RealTime

After (or while) making changes, you may monitor the real-time CPU speed, by running command:

watch -n1 "grep \"^[c]pu MHz\" /proc/cpuinfo"

It displays the frequency for all CPU cores and updates every second.

4. Use Graphical tool to Manage CPU Speed

If you’re looking for a graphical tool to manage CPU power and frequency, I’ve written about it via following tutorials. They include:

  • CPUPower-GUI that works in most Linux. With it, you disable/enable CPU cores, set min/max frequency per core basis, set default profile at boot, etc.
  • For default GNOME Desktop, I’m currently using cpufreq extension. It shows real-time frequency in top-panel, and provides preferences dialog to set min/max frequency, turn on/off CPU cores and turbo boost, and manage profile and governor.

Twitter

I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to let me know if the tutorial is outdated! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via [email protected] Buy me a coffee: https://ko-fi.com/ubuntuhandbook1 |

No Comments

Be the first to start the conversation.

Leave a Reply

Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

*