scaling_max_freq resists being altered despite write permission - android

I am trying to change the value stored in /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq which is currently set to "1512000". I am attempting to do this via adb shell.
I type su and then navigate to /sys/devices/system/cpu/cpu0/cpufreq. I then type
chmod 777 scaling_max_freq
I confirm that the chmod worked by typing
ls -l scaling_max_freq
and sure enough it is listed as -rwxrwxrwx. I then type
echo 124200 > scaling_max_freq
and then
cat scaling_max_freq
sadly this reports that the file is unchanged as "1512000". None of the lines executed responded with any kind of error.
Maybe the governor is immediately overwriting this? Maybe I need some extra type of permission? Maybe this is somehow fundamentally not allowed on an android device and I need to control the clock speeds via a different mechanism altogether? The problem must be soluable somehow as it it performed by SetCPU.
BTW, this was all on a rooted Sony xperia z, Android 4.4.2, build number 10.5.A.0.230

Someone suggested attempting to write to scaling_min_freq... I tried it and to my surprise it worked. I was even more surprised when, afterwards I set scaling_max_freq and that worked too. I found this amazing because this document suggests that if anything you should set them in the reverse order.
Anyway, it all seems to be working now.

Related

adb shell: can't use the ESCAPE key

I want to use vi when running adb shell. Starting "vi" is easy. However, I found that the ESC key doesn't seem to get through to it, so I can't exit insert mode.
More broadly, it doesn't appear that I'm able to send an ESC character to the adb shell at all. I've scanned the web pretty thoroughly and haven't been able to find anyone with a similar problem (much less an answer).
I'm running VRUFNK1 on a Samsung S4. On the PC end I'm running the "adb shell" command from Cygwin under Windows.
Ideas???
UPDATE: Here's are some possible clues.
The adb shell doesn't seem to be the problem. I can capture ESC in a file running
od -cb > file, so ESC seems to be getting to the program being run under the adb shell.
All commands get echoed in my "adb shell" (as if set -v was on, but it isn't).
I notice that input doesn't seem to get sent to adb shell from my cygwin shell in "raw mode" -- i.e., any text I type gets buffered locally until I hit carriage return -- then the entire line gets sent. I'm not sure why that would make ESC ineffective, but certainly vi doesn't expect to be receiving input in quite that manner and perhaps its an indication of something unusual in my environment.
Similar to #1, bash (Bash X) seems to receive it, although echoing from bash is very strange. I can use ESC to enter "edit mode" in my bash shell (Bash X) to scroll through my history (I've run set -o vi), but the experience is very strange. When I hit ESC,k, nothing changes on the screen but my location in the command history goes up one rung (as it should); subsequent presses of 'k' cause a 'k' to be echoed to the screen (instead of the relevant command from my history list). When I finally hit carriage return, the correct command from my history list is executed (!).
UPDATE 2: Progress…
I tried setting the stty value in the "adb shell" to the same as the ones in my cygwin bash shell and that didn't have any effect.
I also tried this: Avoiding escape timeout issues in vim but it didn't help.
I tried this (by reading in from a file using :so <filename>).
Unfortunately, the commands weren't recognized by "vi" (they are actually "vim" commands).
Partial Solution:
Typing a <cr> immediately after the ESC when in "vi" works -- the ESC is accepted and I can exit the editor. It's awkward, and the editing window is still unusable (as if TERM was set to the wrong value), but this is progress.
Also, things work fine when I ssh in. That shell gets started by the telnet server; similar situation as Terminal Emulator directly on the device. Ssh has its own server which then forks off the shell. In the case of the "adb shell", the shell is forked off by /sbin/adbd -- as far as I can tell, there is simply something unusual about that environment. This is a huge step for me -- at least now I have a way to do full screen editing on the device using my PC (rather than editing directly on the S4's tiny screen). Thanks to Jack Palevich for that suggestion.
I can only think of two things to try at this point:
Try running adb shell against someone's device (but the device must be running root, so that I can run Busybox's "vi") (BTW, the version of "vi" is not the problem -- it runs fine from ssh.)
As someone else to run "vi" in "adb shell" on my device, from their host (preferably someone who has succeeded in running "adb shell" and vi somewhere previously.
I'm starting to think that It Simply Doesn't Work.
UPDATE 3: Info from XDA Developers
I found some relevant posts on the XDA Developers forum. It seems to be the case that people have had problems with this for a long time (since at least 2010). I didn't find any solutions.
XDA Link 1
XDA Link 2
XDA Link 3
There is also a paragraph listing various perceived/proposed adb shell bugs that match my experience, here:
Proposed ADB Shell Bugs
You're right - it simply doesn't work under Windows or Cygwin shell. I found that the simplest way to make it work is to use PuTTYTray.
Check my answer in the linked thread for instructions and additional details.
Another solution: Use Windows PowerShell instead of cygwin. Commands like 'o', 'esc', and ':wq' work nicely here.

Android command list

I have many questions about Android command. I do not know where I should start But, anyway, I have put all question related Android commands. Here ;
Is subset of Linux commands come in Android by default ? Or, Are we installing something ?
In system/bin, there are lots of commands. Where can I find their meaning ? I have tried man, but man is not built in.
Can I start and stop application via start and stop command ?
Why cannot I run the reboot from terminal emulator ? The error permission is denied.
NOTE : feel free to reedit the question, if you see meaningless part.
Is subset of Linux commands come in Android by default ? Or, Are we installing something ?
A subset exists by default within the system. Things like ls, cd, mkdir, cat etc... are present. You can gain access to a wider range by installing Busy Box on a rooted device, as stated by Zac.
In system/bin, there are lots of commands. Where can I find their meaning ? I have tried man, but man is not built in.
The ADB Page is a good place to start. That covers many of the basic ADB and shell commands. It states near the bottom:
"For a complete list of commands and programs, start an emulator instance and use the adb -help command."
So you can use adb -help on an emualator or device to see a full list of the ADB and shell commands (note I think this list will be android specific commands only, it won't include things like cd,ls and other basic unix commands).
Can I start and stop application via start and stop command ?
No, it states on the ADB dev page:
start ........ Starts (restarts) an emulator/device instance.
stop ........ Stops execution of an emulator/device instance.
To start an application you'll use the am utility iirc it will look something like am start com.your.packagename It's been a while though, I might have syntax wrong. The instructions are listend if you issue the am command by itself with no params in a shell.
Why cannot I run the reboot from terminal emulator ? The error permission is denied.
The system prevents applications from rebooting the device unless they are signed with the same key as the OS. When you use the terminal emulator you are restricted to whatever permissions that application has declared. The reboot permission is not granted to any third party applications, so it won't work correctly from any terminals. You could probably do it if your device was rooted and you used su though
EDIT:
Here is another good resource that lists more of the shell commands
There are not many Linux commands included in android, however if you are rooted you can easily install busybox which has a large range of linux commands.
You need to have root access to reboot your device via the command line (to prevent any old app being able to do it)

Android phone calling bug after wrong chmod on /system

First, I know this question doesn't exactly belong here, but I'll explain later why I'm asking here instead of on the specific android board.
I'm developing an app, and yesterday I had some problems with sqlite, so I went on to checking how my database looked like. Found out I didn't have the sqlite3 actually installed on my phone, so I followed this answer to install it. I got some problems with the pushing part so I tried to alter the permissions on /system to try and make it work. I basically ran "chmod 7777 /system" on an adb shell. After that I still couldn't push the sqlite to the phone, so I quit the shell and tried to open it again, but I got a no permission error. When I unlocked the phone, every possible app (including system ones) started crashing, one after the other. I freaked out and took the battery off. at that time I had the phone connected through usb to a Ubuntu pc, with no headphones connected. When I turned the phone on again everything seemed to work properly, and I managed to push the sqlite to the system folder without any problem. I thought the problem was over and moved on with debugging and developing.
When I was going home, I was listening to some music with headphones and a friend called me. I answered but couldn't hear anything. I then later discovered that since then I can't hear anything and no one can hear me too. Every other sound related function works fine, except calling. I'm not hearing even that calling beep.
So that's why I'm asking here, as it's actually a question related to developing and coding stuff. Please, if anyone knows what this might be, answer here, I have tried many things to get it working again, but none of them worked. I read it could be a headphone related issue, but that seems to occur only on some motorola phones or something. I have a Galaxy S advance, 3 or 4 months old. I have also tried to change the chmod setting again, to chmod 4755 /system, but it remains the same. I'm getting really desperate here, I don't think customer support can solve this.
As nobody ansered yet, and also I think this is a too specific error for many people to know, I'll report what I did and discovered:
I changed the permissions of all the files in the folders /system and /system/app, not recursively.
A friend later told me UNIX systems sometimes have problem with executing programs that have too many permissions
All the system applications had full 777 permissions.
So I rebooted the device many times, even made a factory reset on it, but nothing seemed to work. So I began changing the permissions again. I tried to change everything to the default permissions (I used a friend device of same model as reference), and when I changed the system/app folder permissions to 755 and rebooted, it worked again!
So for all of you who don't know exactly how chmod and permissions on UNIX works, think twice before start to mess up with it.

execute "su" failed in my fully rooted Android device

while i add this line to my code
Process process = Runtime.getRuntime().exec("su -c");
or
Process process = Runtime.getRuntime().exec("su");
trying to run the"su" command,
process.exitValue() returns 1 which means fail.
This happens to my one Android device while my the other rooted android device works perfectly with this command. (process.exitValue() returns 0)
Can anyone teach me how to trace the error or how to fix it?
I am confused with this error while my two devices almost in the same condition.
Thanks for your reply in advance.
Hi guys,
Thanks for discussing this issue with me. Your reply hints me a clue that I have removed my old su and place a new su. Luckily enough, the return value is now 0 and I guess it means correct. However, Does any of you might know what is the difference between .exec("su -c") and .exec("su")? Please let me know if you know the difference.
I suspect you lack Superuser on the problematic phone, do you?
Or at least something about Superuser could be wrong (versions, binaries...)
su calls Superuser which allows root access or not.
Many problems seems to occurs on latest versions of Superuser.
Try to remove it and install other version:
http://goo.im/superuser
Another note: if you're trying to gain root access or to execute commands as root, you should not only use exec("su"). Take a look at the RootTools a library by stericson himself ;)
http://code.google.com/p/roottools/
The command su (which means Super User) is only valid on rooted phones. That is why your rooted phone recognizes it and works as expected. So, either you root your other device(s) or drop this idea on non-rooted phones :)
Since this is the only result I got for searching for the phrase, thought I'd post an update for anyone else coming across this.
Was following the instructions for installing Cyanogenmod. My issue was resolved by disabling Mass Storage mode on the device (change it to one of the other options).

Android rootshell: permission denied — sony xperia and MacOSX

so I'm trying to get root access on my Android in order to use Barnacle. But I keep getting the same error, over and over:
$ adb shell
$ rootshell
rootshell: permission denied
What is the deal with this? I mean, seems logical that I need some permissions to access rootshell, but I can't seem to find any way around it.
Anybody knows how?
Is there any other way to get root access to your phone? (An easy way, hopefully)
EDIT 1:
I will clarify the question.
Unix and Linux systems let you retrieve / change lost passwords for root user. Considering this:
Is there an easy way to root an Android device using the terminal on my Mac OS X? My device is an Xperia X10 mini pro.
Or, does anybody know why I get that permission denied error using adb and rootshell in the first place? It's supposed to work, as stated here?
Thnx!
A.
I'm not sure how much of a question this is or not or whether it is appropriate for StackExchange, but I'm gonna answer it anyway. I don't have enough rep to do anything else about the anyway :D
When you are trying to root any android phone in general, you need to run a program that gives you root access. You can't just simply say "adb give-me-root-permissions-please". :) But yeah, Google is your friend in this case. Apparently your phone the Sony Xperia needs a very specific rooting process that is enumerated here: http://forum.xda-developers.com/showthread.php?t=711907
I would recommend asking this kind of question THERE on XDA because that site is dedicated to questions like this. This site is for programming questions and the like :)
TO BE ROOT AT SONY XPERIA
you can use
king root software
or
rootkitXperia L
how to get temproot by 'getroot'
usage
push 'getroot' in device, set permission, and execute 'getroot'
adb push getroot /data/local/tmp
adb shell
$ cd /data/local/tmp
$ chmod 0755 getroot
$ ./getroot
use CVE-2013-6282 vulnerability
kernel start address 0xc0008000
In some cases, modify KERNEL_START_ADDRESS or KERNEL_SIZE in 'getroot.c'

Categories

Resources