Skip to content

Instantly share code, notes, and snippets.

@xsnpdngv
Last active September 8, 2020 08:49
Show Gist options
  • Save xsnpdngv/1bb42e315f42f1b0276a2fb5f53f0ff1 to your computer and use it in GitHub Desktop.
Save xsnpdngv/1bb42e315f42f1b0276a2fb5f53f0ff1 to your computer and use it in GitHub Desktop.
Set CPU governor to powersave on Ubuntu
#!/bin/sh
sudo apt-get install cpufrequtils
echo 'GOVERNOR="powersave"' | sudo tee /etc/defaults/cpufrequtils
sudo /etc/init.d/cpufrequtils restart
cpufreq-info
@xsnpdngv
Copy link
Author

xsnpdngv commented Apr 26, 2017

To add indicator/setter GUI

sudo apt-get install indicator-cpufreq psensor
indicator-cpufreq

In order to literally set CPU frequency userspace governor is required which is not available by default.

Your system is using intel_pstate driver. There are only two governors available when using this driver: powersave and performance.
The userspace governor is only available with the older acpi-cpufreq driver (which will be automatically used if you disable intel_pstate at boot time; you then set the governor/frequency with cpupower):

disable the current driver: add intel_pstate=disable to your kernel boot line
boot, then load the userspace module: modprobe cpufreq_userspace
set the governor: cpupower frequency-set --governor userspace
set the frequency: cpupower --cpu all frequency-set --freq 800MHz

To temporarily add a boot parameter to a kernel:

Start your system and wait for the GRUB menu to show (if you don't see a GRUB menu, press and hold the left Shift key right after starting the system). Now highlight the kernel you want to use, and press the e key. You should be able to see and edit the commands associated with the highlighted kernel. Go down to the line starting with linux and add your parameter e.g., intel_pstate=disable to its end.
Now press Ctrl + x or F10 to boot.

To make this change permanent:

sudo vi /etc/default/grub

Find the line starting with GRUB_CMDLINE_LINUX_DEFAULT and append e.g., intel_pstate=disable to its end. For example:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash intel_pstate=disable"

Finally, start a terminal and run: sudo update-grub
to update GRUB's configuration file.

On the next reboot, the kernel should be started with the boot parameter. To permanently remove it, simply remove the parameter from GRUB_CMDLINE_LINUX_DEFAULT and run sudo update-grub again.

To verify your changes, you can see exactly what parameters your kernel booted with by executing cat /proc/cmdline.

Wiki Page

@fabriciorsf
Copy link

Error at the path...
Correct: /etc/default/cpufrequtils (default, without 's')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment