[Android 5.0.2] Failure changing CPU speed

3,024 views
Skip to first unread message

eko.s...@gmail.com

unread,
Apr 13, 2015, 9:16:34 AM4/13/15
to automa...@googlegroups.com
Hi,

I'm currently using Android 5.0.2,  and I'm trying to build a flow to change the CPU speed when the device is locked/unlocked. When the event occurs (lock/unlock), I receive the following error:

"android.system.ErrnoException: open failed: ENOENT (No such file or directory)"

Any idea about what is causing that?

Phone configuration:
- Android 5.0.2
- Automate 1.0.16 Premium
- Rooted device
- All permissions installed and active

Thanks!
BR,

Fellipe F.

Automate developer

unread,
Apr 13, 2015, 12:43:33 PM4/13/15
to automa...@googlegroups.com, eko.s...@gmail.com
For the CPU set/get blocks to work the linux kernel has to be compiled with various modules the will allow the changing the governor and frequencies from the files system.

Does you device have an directory called:
/sys/devices/system/cpu/cpu0/cpufreq/

What files does it contain?

Also check the About phone in System setting, what's SELinux option, "permissive", or?

eko.s...@gmail.com

unread,
Apr 13, 2015, 12:51:33 PM4/13/15
to automa...@googlegroups.com, eko.s...@gmail.com
The folder exists and contains the following files and directories:

../cpufreq/
stats/
time_in_state
total_trans
affected_cpus
cpuinfo_cur_freq
cpuinfo_max_freq
cpuinfo_min_freq
cpuinfo_transition_latency
related_cpus
scalling_available_frequencies
scalling_available_governors
scalling_cur_freq
scalling_driver
scalling_governor
scalling_max_freq
scalling_min_freq
scalling_setspeed 

And the SELinux status is permissive.

Thanks!
BR,

Fellipe F.

Automate developer

unread,
Apr 13, 2015, 1:32:05 PM4/13/15
to automa...@googlegroups.com, eko.s...@gmail.com
It's all there. I've got reports of this before, but i can't figure out why it doesn't work for some users.

If you try changing the governor from using a a root shell, does it work?
For example:
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scalling_available_governors

Could you send me the system log, use the Help & feedback menu.

eko.s...@gmail.com

unread,
Apr 13, 2015, 1:52:36 PM4/13/15
to automa...@googlegroups.com, eko.s...@gmail.com
Doesn't work, I receive: 

root@m0:/# echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
can't create /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors: Permission denied." 

I sent to you the logcat file by email. Take a look on the line 150. Seems that it's trying to write on the wrong folder (cpu1):
 
java.io.FileNotFoundException: /sys/devices/system/cpu/cpu1/cpufreq/scaling_available_frequencies: open failed: ENOENT (No such file or directory)

Thanks!
BR,

Fellipe F.

Automate developer

unread,
Apr 13, 2015, 2:18:44 PM4/13/15
to automa...@googlegroups.com, eko.s...@gmail.com
Sorry my bad, you can't write to the scaling_available_governors, it's read-only, it should have been scaling_governor

Maybe only the cpu0 have an scaling_available_governors and not cpu1?

Could you please list the files in the cpu1 directory for me.

Automate reads the scaling_available_governors for each cpu to make sure only valid values are assigned.

eko.s...@gmail.com

unread,
Apr 13, 2015, 6:16:34 PM4/13/15
to automa...@googlegroups.com, eko.s...@gmail.com
Hi Henrik,

now I can write ;).

About the scaling_available_governors you're right, only cpu0 have it. What happens is that cpu1,cpu2,cpu3,... have a symlink (on the folder cpufreq) to .../cpu0/cpufreq. But this symlink disappear sometimes....I think when the cpu goes offline (pegasusq governor here). And this brings me a question: can I really assign different governors to different virtual cpu's if the scaling_governors is the same for all the cpu's? I don't think so...

And for you last question, the files inside the folder cpu1 are the same of the folder cpu0.

So, I think that this error is happening because when I choose to change the governor for all cpu's, Automate go into these folders (cpu1,cpu2,cpu3,etc) looking for the scaling_available_governors file, but if the cpu is offline the symlink doesn't exists and it raises an error (as you can see on the logcat file that I sent to you).

If this is true, and my first statement is also true, in this scenario, changing the frequency and the governor for each cpu doesn't make sense. You can only change for cpu0 and all the others cpu's will follow. Do you know if this behavior happens on the other Android's version?

Thank you once again!
BR,

Fellipe F.

 (which make sense since the cpufreq need to be the same for all the cpu's ;p).

Automate developer

unread,
Apr 13, 2015, 6:55:40 PM4/13/15
to automa...@googlegroups.com, eko.s...@gmail.com
Wow, great find, thanks!

Currently Automate uses the
/sys/devices/system/cpu/kernel_max
to determine the number of available CPUs, but i think i should use the
/sys/devices/system/cpu/present
or
/sys/devices/system/cpu/possible
or maybe even the
/sys/devices/system/cpu/online
instead.

A governor that rearranges the /sys/devices/system/cpu directory with symlinks it will be difficult handle, Automate will "update" the same cpu 4 times.
This probably depends on the kernel and current governor, not Android version. My devices has a cpu#/cpufreq directory for each cpu.

I could check if the cpufreq directory exists before writing to the scaling_governor, scaling_min_freq, scaling_max_freq, etc files.

eko.s...@gmail.com

unread,
Apr 14, 2015, 10:28:49 AM4/14/15
to automa...@googlegroups.com, eko.s...@gmail.com
I'm glad to help somehow. All the solutions that you propose seems to work well, but you still need to check if the cpufreq directory exists before write. Also, IMHO you need to think that: 
  1. online: ensure that you'll write on valid and active CPU's, cover both scenarios (kernels that use symlink or not), but will ignore the cores that the governor put temporally offline.
  2. possible: ensure that you'll see valid CPUs present on the system, but it can be temporally offline. In this case, it will fail to write on symlinks but you'll update all the  cores on kernels that doesn't use symlink.
  3. presentyou'll see a CPU present on the system, but it can be permanently offline, which fails on symlinks and doesn't make much sense apply to them.
So maybe possible with a cpufreq check is the best solution in that case.

Thanks!
BR,

Fellipe F.

Automate developer

unread,
Apr 14, 2015, 12:59:36 PM4/14/15
to automa...@googlegroups.com, eko.s...@gmail.com
I think i'll use the online CPUs, you would still be able to bring the other CPUs online by changing governor on the remaining online CPU.

I'll release a new Alpha soon.

eko.s...@gmail.com

unread,
Apr 14, 2015, 1:31:41 PM4/14/15
to automa...@googlegroups.com, eko.s...@gmail.com
For kernels like mine that use symlink it's perfect. But imagine the following scenario where the kernel doesn't use symlink:
  1. 4 cores: 2 actives (cpu0/cpu1), 2 temporally offline (cpu2/cpu3);
  2. Read /sys/devices/system/cpu/online which returns cpu0,cpu1
  3. Apply new governor, min_freq and max_freq on cpu0 and cpu1
  4. When cpu2 and cpu3 goes online again, they will have different governor, max and min freq from cpu0 and cpu1.
Now imagine the following:
  1. 4 cores: 2 actives (cpu0/cpu1), 2 temporally offline (cpu2/cpu3);
  2. Read /sys/devices/system/cpu/possible which returns cpu0,cpu1,cpu2,cpu3
  3. Apply new governor, min_freq and max_freq on cpu0,cpu1,cpu2,cpu3.
  4. When cpu2 and cpu3 goes online again, all cores will have the same governor, max and min freq.

What do you think?

BR,
Fellipe F.

Automate developer

unread,
Apr 14, 2015, 1:44:24 PM4/14/15
to automa...@googlegroups.com, eko.s...@gmail.com
Okay, we'll try with possible.

Automate developer

unread,
Apr 16, 2015, 1:52:21 PM4/16/15
to automa...@googlegroups.com, eko.s...@gmail.com
Let me know if the latest Alpha (1.0.17a2) is working for you.


On Tuesday, April 14, 2015 at 7:31:41 PM UTC+2, eko.s...@gmail.com wrote:

mrgo...@gmail.com

unread,
Aug 17, 2015, 3:27:11 AM8/17/15
to Automate, eko.s...@gmail.com
guys can u help me? i bougth a huawei gplay mini then i root the device but when i install a cpu cores manager only 4 cores are active and then go to root explorer and only cpu 0,cpu1,cpu2,cpu3 got the cpufreq folder and the other not. when supose is a octacore i try to copy cpufreq folder from cpu 0 to any of the others cpu but cant do it,hope u help me guys sorry for my bad english 

Automate developer

unread,
Aug 17, 2015, 1:37:07 PM8/17/15
to Automate, eko.s...@gmail.com, mrgo...@gmail.com
You can't copy/move/rename files in the /sys/devices/system/cpu folder, it's not "real" files nor folders.
The cpufreq folder may not be available if the CPU is offline.

vladimi...@gmail.com

unread,
Feb 23, 2017, 5:57:01 AM2/23/17
to automa...@googlegroups.com
Hi!
I can't change the CPU governors. I get a line in the log "open failed: EACCES (Permission denied)". I read this thread and still don't understand how to solve it. Could you please explain me how to fix the problem?
Thanks!

Henrik "The Developer" Lindqvist

unread,
Feb 23, 2017, 5:06:48 PM2/23/17
to Automate
It seems not even root have access to the files on some device, likely because SELinux is enforced.
Try using another "SuperSU SELinux context" in Automate settings.

Vladimir Beliakov

unread,
Feb 28, 2017, 9:32:34 AM2/28/17
to automa...@googlegroups.com, eko.s...@gmail.com
I tried System server, and it worked :)

Thank you very much!

Sasha Rosenthal

unread,
Mar 25, 2021, 10:30:55 PM3/25/21
to Automate
I just recently installed a custom OS/kernel, one of the things they do is add a bunch of new CPU governors (which are in fact showing up inside of automate), but when I try to set the governer to any governer (including the stock ones) I get the same error valdimi was getting, "android.system.ErrnoException: open failed: EACCES (Permission denied)". I know that my device has SELinux in permissive mode and I looked for the "SuperSU SELinux context" in Automate settings but couldn't find it. The custom rom is android 10 (havoc os v3.0 if it helps) and I'm using magisk for root. Any help would be appreciated. Thanks

Henrik "The Developer" Lindqvist

unread,
Mar 27, 2021, 9:49:46 AM3/27/21
to Automate
"Root" doesn't necessarily mean access to everything.
It might be possible to use another SELinux "context" so the CPU speed set block works.
I don't know how, but it would involve changing the "Superuser shell command" option in settings.
Reply all
Reply to author
Forward
0 new messages