How can I make my linux system (ubuntu) automatically choose the performance governor when it works with ac and switch automatically to ondemand when it is on battery (and vice versa)?

Is it also possible to switch to the lowest CPU frequency if the battery state drops below a certain value?

I am looking for a solution which is independent of the used desktop environment.


The solution may interfer with another cpu scaling mechanism installed in ubuntu by default. For example there is a file /etc/init.d/ondemand which sets the CPU to ondemand...

Are there other pitfalls like this one?


You could use laptop-mode-tools. You can specify the governor and max/min frequency while on AC or BATTERY via config files. (Archwiki page)

Another option which gives you more control (rules per battery level) is Cpufreqd (thinkwiki page).

You can also tune your cpu based on acpi events (Archwiki page)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.