
{"id":45167,"date":"2024-01-12T15:45:40","date_gmt":"2024-01-12T15:45:40","guid":{"rendered":"https:\/\/ubuntuhandbook.org\/?p=45167"},"modified":"2024-01-13T03:03:43","modified_gmt":"2024-01-13T03:03:43","slug":"cpu-turbo-boost-ubuntu","status":"publish","type":"post","link":"https:\/\/ubuntuhandbook.org\/index.php\/2024\/01\/cpu-turbo-boost-ubuntu\/","title":{"rendered":"Disable Turbo Boost \/ Set Constant CPU Speed in Ubuntu 22.04\/24.04"},"content":{"rendered":"<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2023\/10\/cpu-icon.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-thumbnail wp-image-44610\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2023\/10\/cpu-icon-250x250.webp\" alt=\"\" width=\"250\" height=\"250\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2023\/10\/cpu-icon-250x250.webp 250w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2023\/10\/cpu-icon-300x300.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2023\/10\/cpu-icon-600x600.webp 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2023\/10\/cpu-icon-768x768.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2023\/10\/cpu-icon.webp 1200w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/><\/a><\/p>\n<p><b>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.<\/b><\/p>\n<p>Disable turbo boost will limit your CPU speed to prevent running over the base frequency. It&#8217;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.<\/p>\n<p>Most machine today has option in the BIOS page to enable\/disable and even change CPU frequency, however, it&#8217;s not flexible.<\/p>\n<p>For Linux, the Kernel has a tool called <code>cpupower<\/code> 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.<\/p>\n<p><!--more--><\/p>\n<h3>1. Disable turbo boost via single command:<\/h3>\n<p>Depends on the CPU scaling driver, there are 2 commands to enable\/disable CPU turbo boost.<\/p>\n<p>First, press <b>Ctrl+Alt+T<\/b> on keyboard to open up a terminal windows, then run following commands accordingly.<\/p>\n<h4>For &#8216;intel_pstate&#8217; driver<\/h4>\n<p>If you have <code>Intel<\/code> CPU in your machine, first try running the command below:<\/p>\n<pre>cat \/sys\/devices\/system\/cpu\/intel_pstate\/no_turbo<\/pre>\n<p>The command should output:<\/p>\n<ul>\n<li><b>0<\/b> &#8211; means Turbo Boot is enabled!<\/li>\n<li><b>1<\/b> &#8211; Turbo Boost is disabled!<\/li>\n<li><b>No such file or directory<\/b> &#8211; other driver rather than intel_pstate is in use<\/li>\n<\/ul>\n<p>If it outputs <b>0<\/b>, then you can run command to set its value to 1 to disable turbo boost:<\/p>\n<pre>echo \"1\" | sudo tee \/sys\/devices\/system\/cpu\/intel_pstate\/no_turbo<\/pre>\n<p>If <b>1<\/b>, then use command to re-enable the feature:<\/p>\n<pre>echo \"0\" | sudo tee \/sys\/devices\/system\/cpu\/intel_pstate\/no_turbo<\/pre>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/disable-turoboot.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-45169\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/disable-turoboot-700x469.webp\" alt=\"\" width=\"610\" height=\"409\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/disable-turoboot-700x469.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/disable-turoboot-300x201.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/disable-turoboot-768x515.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/disable-turoboot.webp 795w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<h4>For other scaling drivers<\/h4>\n<p>If the first command above outputs &#8220;No such file or directory&#8221;, then other scaling driver is in use.<\/p>\n<p>In the case, run command to check anther sysfs:<\/p>\n<pre>cat \/sys\/devices\/system\/cpu\/cpufreq\/boost<\/pre>\n<p>As well, the command should output either 0 or 1. And, you can disable turo boost by setting its value to 1:<\/p>\n<pre>echo \"1\" | sudo tee \/sys\/devices\/system\/cpu\/cpufreq\/boost<\/pre>\n<h4>Disable turbo boost on Startup<\/h4>\n<p>The commands above work until reboot! In next boot, you system will restore the change and by default enable the turbo boost feature.<\/p>\n<p>In the case, you can create a systemd service to run the above command automatically while booting the system.<\/p>\n<p><i>But, why not disable it from BIOS settings \ud83e\udd14?<\/i><\/p>\n<p><b>1.<\/b> To do so, first run command to create a system service:<\/p>\n<pre>sudo nano \/etc\/systemd\/system\/boostoff.service<\/pre>\n<p>The command will create a service called <code>boostoff.service<\/code> and edit it in terminal. When it opens, paste following lines:<\/p>\n<pre>[Unit]\r\nDescription=Disable Turbo Boost at startup\r\n\r\n[Service]\r\nType=oneshot\r\nExecStart=\/bin\/sh -c \"echo 1 &gt; <b>\/sys\/devices\/system\/cpu\/intel_pstate\/no_turbo<\/b>\"\r\n\r\n[Install]\r\nWantedBy=multi-user.target<\/pre>\n<p><b>NOTE<\/b>: for non-<code>intel_pstate<\/code> driver, use <code>\/sys\/devices\/system\/cpu\/cpufreq\/boost<\/code> instead of the bold text of &#8216;ExeStart&#8217; value.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/boostoff-service.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-45170\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/boostoff-service-700x454.webp\" alt=\"\" width=\"610\" height=\"396\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/boostoff-service-700x454.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/boostoff-service-300x195.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/boostoff-service-768x498.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/boostoff-service.webp 822w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p>When done editing, press <b>Ctrl+S<\/b> to save file and <b>Ctrl+X<\/b> to exit.<\/p>\n<p><b>2.<\/b> Finally, enable the service, so to automatically disable turbo boost at startup:<\/p>\n<pre>systemctl enable boostoff.service<\/pre>\n<h3>2. Set Minimum, Maximum, or Constant CPU Speed<\/h3>\n<p>Without turning off boost, you can for choice limit the maximum frequency or set a constant CPU frequency. This can be done a <code>cpupower<\/code> tool.<\/p>\n<p><b>1.<\/b> First, open terminal (Ctrl+Alt+T) and run command to install the tool for current Linux Kernel.<\/p>\n<pre>sudo apt install linux-tools-$(uname -r)<\/pre>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/apt-linux-tools.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-45171\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/apt-linux-tools-700x480.webp\" alt=\"\" width=\"610\" height=\"418\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/apt-linux-tools-700x480.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/apt-linux-tools-300x206.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/apt-linux-tools-768x527.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/apt-linux-tools.webp 777w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p><b>2.<\/b> Then, you may run command to check <i>which scaling driver<\/i> is in use, <i>minimum<\/i> and <i>maximum<\/i> CPU frequency supported by your hardware, etc information.<\/p>\n<pre>cpupower frequency-info<\/pre>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/cpu-freq-info.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-45172\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/cpu-freq-info-700x341.webp\" alt=\"\" width=\"610\" height=\"297\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/cpu-freq-info-700x341.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/cpu-freq-info-300x146.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/cpu-freq-info-768x374.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/cpu-freq-info.webp 795w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p><b>3.<\/b> <b>To set constant minimum CPU Speed<\/b>, just run:<\/p>\n<pre>sudo cpupower frequency-set --max 800MHz<\/pre>\n<p>This command will limit the maximum CPU speed to <code>800MHz<\/code>, which is the minimum speed according to last screenshot. Change the number according to your <code>cpupower frequency-info<\/code> output.<\/p>\n<p><b>To set constant maximum CPU Speed<\/b>, run:<\/p>\n<pre>sudo cpupower frequency-set --min 4.30GHz --max 4.30GHz<\/pre>\n<p>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.<\/p>\n<p>For choice, you may also <b>set CPU to a specific speed<\/b> by running command (2000MHz for example):<\/p>\n<pre>sudo cpupower frequency-set --freq 2000Mhz<\/pre>\n<p><b>Since Kernel 6.6<\/b>, there&#8217;s also an option to disable turbo boost. But don&#8217;t know why, it does not work in my case for Intel CPU.<\/p>\n<pre>sudo cpupower set --turbo-boost 0<\/pre>\n<h4>Disable GNOME Power Profile Daemon<\/h4>\n<p>For the default GNOME Desktop, the built-in power mode settings may conflict with the <code>cpupower<\/code> commands above.<\/p>\n<p>In the case, you can disable the power-profiles-daemon by running the 2 commands below:<\/p>\n<ul>\n<li>First, open terminal and stop the service:\n<pre>systemctl stop power-profiles-daemon.service<\/pre>\n<\/li>\n<li>Then, mask it to prevent auto-run in next boot:\n<pre>systemctl mask power-profiles-daemon.service<\/pre>\n<\/li>\n<\/ul>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/disable-powerprofile.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-45173\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/disable-powerprofile-700x479.webp\" alt=\"\" width=\"610\" height=\"417\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/disable-powerprofile-700x479.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/disable-powerprofile-300x205.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/disable-powerprofile-768x526.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/disable-powerprofile.webp 831w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p><b>(Optional)<\/b> To re-enable the service, run:<\/p>\n<pre>systemctl unmask power-profiles-daemon.service<\/pre>\n<pre>systemctl start power-profiles-daemon.service<\/pre>\n<h4>Make <code>cpupower<\/code> option work in next boot<\/h4>\n<p>Like the command to disable turbo boost, cpupower also works until reboot!<\/p>\n<p>To make it work at startup, first create the service:<\/p>\n<ul>\n<li>Create a system service (<i>some Linux creaet the service automatically after installed the tool<\/i>):\n<pre>sudo nano \/etc\/systemd\/system\/cpupower.service<\/pre>\n<\/li>\n<li>Then paste following lines and save by pressing Ctrl+S, then Ctrl+X. Also, change the command in bold accordingly.\n<pre>[Unit]\r\nDescription=Adjust CPU speed via cpupower\r\n\r\n[Service]\r\nType=oneshot\r\nExecStart=\/bin\/sh -c \"<b>cpupower frequency-set --max 800MHz<\/b>\"\r\n\r\n[Install]\r\nWantedBy=multi-user.target<\/pre>\n<\/li>\n<\/ul>\n<p>Then, enable the service via command:<\/p>\n<pre>systemctl enable cpupower.service<\/pre>\n<h3>3. Check CPU Speed in RealTime<\/h3>\n<p>After (or while) making changes, you may monitor the real-time CPU speed, by running command:<\/p>\n<pre>watch -n1 \"grep \\\"^[c]pu MHz\\\" \/proc\/cpuinfo\"<\/pre>\n<p>It displays the frequency for all CPU cores and updates every second.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/cpu-freq-realtime.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-45174\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/cpu-freq-realtime-700x347.webp\" alt=\"\" width=\"610\" height=\"302\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/cpu-freq-realtime-700x347.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/cpu-freq-realtime-300x149.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/cpu-freq-realtime.webp 750w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<h3>4. Use Graphical tool to Manage CPU Speed<\/h3>\n<p>If you&#8217;re looking for a graphical tool to manage CPU power and frequency, I&#8217;ve written about it via following tutorials. They include:<\/p>\n<ul>\n<li><a href=\"https:\/\/ubuntuhandbook.org\/index.php\/2020\/11\/cpupower-gui-simple-tool-adjust-cpu-frequency\/\" target=\"_blank\" rel=\"noopener\">CPUPower-GUI<\/a> 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.<a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2020\/11\/cpu-powergui-settings.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-43661\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2020\/11\/cpu-powergui-settings-600x518.webp\" alt=\"\" width=\"600\" height=\"518\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2020\/11\/cpu-powergui-settings-600x518.webp 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2020\/11\/cpu-powergui-settings-300x259.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2020\/11\/cpu-powergui-settings-768x663.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2020\/11\/cpu-powergui-settings.webp 796w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/li>\n<li>For default GNOME Desktop, I&#8217;m currently using <a href=\"https:\/\/fostips.com\/cpu-frequency-on-the-fly-ubuntu-debian\/\" target=\"_blank\" rel=\"noopener\">cpufreq extension<\/a>. It shows real-time frequency in top-panel, and provides <i>preferences<\/i> dialog to set min\/max frequency, turn on\/off CPU cores and turbo boost, and manage profile and governor.<a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/cpufreq-extension.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-45176\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/cpufreq-extension-700x463.webp\" alt=\"\" width=\"610\" height=\"403\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/cpufreq-extension-700x463.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/cpufreq-extension-300x198.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/cpufreq-extension-768x508.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/01\/cpufreq-extension.webp 1139w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>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&#8217;s useful to save power and prevent your computer from overheating. For choice, user can also [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":44610,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[2088],"class_list":["post-45167","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","tag-power"],"_links":{"self":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/45167","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/comments?post=45167"}],"version-history":[{"count":0,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/45167\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media\/44610"}],"wp:attachment":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media?parent=45167"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/categories?post=45167"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/tags?post=45167"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}