0

I made a new 22.04.1 LTS install today. I wanted to test an app I made that modifies your CPU's clock frequency. The first step for testing was to change the scaling governor to userspace so I can set a specific frequency. I ran the following command in a bash shell:

sudo echo "userspace" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

I tried both with and without quotes on the word userspace and the path. I know this just changes the one core, but I was just testing

I ran into the issue: bash: /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor: Permission denied

I found this post: scaling governor throws permission error for su, and according to the accepted solution, modified my command to the following:

sudo sh -c "echo -n userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"

But now I get: sh: echo I/O error. I was really confused, and I found a guide on another website I can't find again. Anyway, I changed my code to:

echo "userspace" | sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

Again, I tried with and without quotes on both the word userspace and the path. But now I get:

userspace

tee: /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor: Invalid argument

What I was just wondering is if there is any way to set the cpu scaling governor from the command line? I know there are packages like cpupower, but I would like to set scaling governor and frequency without any required packages. If this is not possible, please let me know.

Thank you so much for your help!

Android776

  • 1
    does the folder /sys/devices/system/cpu/cpu0/cpufreq/ and file scaling_governor inside it exist? if it exists, you should be able to write it as root, but if it doesn't exist, you cannot create it. If it doesn't exist that means you have no "cpufreq" available , and you should dig into bios / kernel configurations - can you post your cpu information and grep FREQ /boot/config-$(uname -r) please? – Cagri Sep 14 '22 at 14:48
  • Hello @Cagri thank you so much for getting back to me. Yes the folder and file does exist. I don't have access to the Ubuntu PC right now, but I will get back to you later with the cpu information and grep result. – IntegralPilot Sep 14 '22 at 22:21

0 Answers0