9

I followed the following Ask Ubuntu solution to display the options for enabling Performance mode in Ubuntu 22.04. However, in the Settings, Ubuntu tells me "Performance mode temporarily disabled due to high operating temperature." I don't understand why this error shows. My PC's temperature is normal. This error shows even mere seconds after turning on my computer, so it's not plausible. Is there a way I can tell Ubuntu to force-enable performance mode, just like with Windows?

screenshot showing Ubuntu saying that performance mode is temporarily disabled due to high operating temperature

facialrecognition
  • 435
  • 2
  • 6
  • 12
  • Excessive processor temperatures mere seconds after turning on a PC is plausible. For most CPU frequency scaling drivers you can set the performance CPU frequency scaling governor with this primative command: echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor. And then check it: grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor. I only work with primitive commands, you might have something running that overrides primitives. – Doug Smythies Jul 19 '22 at 05:21
  • I just tried your solution. Now, the scaling governor is performance. But the error persists. I found this solution,. I got it working by running sudo POWER_PROFILE_DAEMON_FAKE_DRIVER=1 /usr/libexec/power-profiles-daemon -r -v. It told me I'm in balanced mode. So I switched to performance, and now the error is gone. But to be honest, the fact that I have to do this manually at every startup is frustrating, and I'm not even sure if performance mode is really working or if it's just in name only. – facialrecognition Jul 19 '22 at 06:15
  • To set performance mode automatically during boot see this answer. – Doug Smythies Jul 19 '22 at 15:02

3 Answers3

9

Looks like you're on the desktop version of vanilla Ubuntu 22.04. You can use cpupower-gui from the official apt repository.

$ sudo apt install cpupower-gui

enter image description here It let's you set the scaling governor either individually on each cpu or for all of them in one go. So you can just set it to Performance straight away and apply.

To run the program, just press the super key/windows key and type "cpupower" and lunch the program from the launcher. Alternatively you can lunch it from the terminal with.

$ cpupower-gui

Mine permanently docked on the launcher bar as a favourite.

To check what your CPUs are currently using:

$ cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

Here's mine, I've got 16 cores:

$ cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
performance
performance
performance
performance
performance
performance
performance
performance
performance
performance
performance
performance
performance
performance
performance
performance
DanglingPointer
  • 1,123
  • 1
  • 13
  • 23
3

I had the same problem with my AMD Ryzen 5 3400G with Radeon Vega Graphics, running Ubuntu 22.04.

I solved the problem as follows :

sudo systemctl mask power-profiles-daemon.service
sudo systemctl stop power-profiles-daemon.service

Then I created three files in the following locations:

  1. /etc/default/mygovernor

    -rw-r--r-- 1 root root 447 Oct 2 13:11 mygovernor

with the following contents:

# J.T. 2022-10-02
# Environment file for systemd service /etc/systemd/system /mygovernor.service
# which set the cpufreq governor to be used by the system.  A list of supported
# governors may be found by the following command:
# "cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors"
# conservative ondemand userspace powersave performance schedutil

#GOVERNOR=powersave #GOVERNOR=schedutil #GOVERNOR=ondemand GOVERNOR=performance

  1. /etc/systemd/set-mygovernor

    -rwxr-xr-x 1 root root 884 Oct 2 13:05 set-mygovernor

with the following contents:

#! /bin/bash
# J.T. 2022-10-02
# This script is called by script /etc/systemd/system/mygovernor.service
# It will set the CPU Frequency Scaling governor to the value passed in
# the first command line argument "$1"

set -eu

FIRSTCPU=$(cut -f1 -d- /sys/devices/system/cpu/online) AVAILABLE=$(/bin/cat /sys/devices/system/cpu/cpu${FIRSTCPU}/cpufreq/scaling_available_governors)

Check if the specified commandline governor ID is supported on this PC

GOVERNOR=""

for gov in ${AVAILABLE}; do if [[ "${gov}" == "${1}" ]]; then GOVERNOR="${gov}" break fi done

if [ -z ${GOVERNOR} ]; then echo "Unknown governor =" "${1}" exit 1 fi

echo "Setting CPUFreq Scaling governor = "$GOVERNOR" for all CPUs"

for CPUFREQ in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor do [ -f "${CPUFREQ}" ] || continue echo -n "${GOVERNOR}" > ${CPUFREQ} done

  1. /etc/systemd/system/mygovernor.service

with the following contents:

# J.T. 2022-10-02
# This service set the cpufreq scaling governor, to the value of 
# environment variable "GOVERNOR" defined in file "/etc/default/mygovernor"
# This service will not execute unless Ubuntu service "power-profiles-daemon.service"
# is masked. It may be masked with the following command:
# "sudo systemctl mask power-profiles-daemon.service"

[Unit] Description=Set CPU Frequency Scaling governor ConditionVirtualization=no ConditionPathExists=/sys/devices/system/cpu/online

[Service] Type=idle EnvironmentFile=/etc/default/mygovernor ExecCondition=/bin/bash -xc '/bin/systemctl is-masked --quiet power-profiles-daemon.service && exit 1 || exit 0' ExecStart=/etc/systemd/set-mygovernor ${GOVERNOR}

[Install] WantedBy=multi-user.target

then I enabled and started the new service:

sudo systemctl enable mygovernor.service
sudo systemctl start mygovernor.service

You can monitor your governors with cpufreq-info from the package "cpufrequtils". Or use gkrellm system monitor with cpufreq-utils plugin.

It also works on Ubuntu 20.04 but you have to replace "power-profiles-daemon.service" with "ondemand.service". The rest is the same.

Hope this is what you were looking for. The code is base on a number of examples from the internet but I forgot where so I can't acknowledge them.

To change the governor edit /etc/default/mygovernor and restart mygovernor service.

0

I had the same issue and the following script made it work under performance mode.

#!/bin/bash
echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

Then, save the script file with a descriptive name, for example, "set_performance.sh" and execute the following command:

chmod +x set_performance.sh

However, If you want to run it automatically, you may do so using Systemd, you can create a service unit to achieve that. Here are the steps::

Create a service unit file. You can use the following command to open a new file in a text editor:

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

Inside the file, enter the following configuration for the service unit:

[Unit]
Description=My Script
After=network.target

[Service] ExecStart=/path/to/myscript.sh

[Install] WantedBy=default.target

Make sure to replace /path/to/myscript.sh with the location and name of your own script.

Notify Systemd of the changes by running the following command:

sudo systemctl daemon-reload

Enable the service unit to start on boot:

sudo systemctl enable myscript.service

Restart your system to apply the changes. The script will be automatically executed during startup.

Hope it helps!

NOTE: I realized after a bios update, this issue just disappeared.

Dux
  • 1