[Q] execute “su” failed in my fully rooted Android device - Android Software/Hacking General [Developers Only]

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 are almost in the same condition.
Thanks for your reply in advance.

Related

"Could not update itsutils.dll" unlock cid error

Hi!
I read the wiki page and I searched on the forum but I did not find answer.
When I try to unlock the cid (I have a G3), the cmd screen give me this message:
"Could not update itsutils.dll to the current version, maybe it is inuse? try restarting your device, or restart activesync"
What i have to do?
Thanks to all.
copy the files "EnableRapi" and "Cert_SPCS" to your device and run them (you can find them inside the folder "Utils".
Then run the "LokiwizMsl.bat" from your computer again and it should work.
This trick was already described in the sim unlock part of the wiki
but i've updated the cid unlock wiki with the info.
Hi!!
I still have that message. Could you check if i'm doing something wrong?
This is the guide from the wiki:
"Do the following :
- Copy the cab's from the Utils folder in the Lokiwiz03a.zip file to your Prophet and execute them (There are two files : "Cert_SPCS.cab" and "EnableRapi.cab")"
Sorry but this is not very clear because:
1) there aren't file called "Lokiwiz03a.zip"
2) Need I to do hard reset (or a soft reset) after execute that 2 files?
Please help me, I'm not the only one with that problem.
Thanks to all.
Pepez said:
Hi!!
I still have that message. Could you check if i'm doing something wrong?
This is the guide from the wiki:
"Do the following :
- Copy the cab's from the Utils folder in the Lokiwiz03a.zip file to your Prophet and execute them (There are two files : "Cert_SPCS.cab" and "EnableRapi.cab")"
Sorry but this is not very clear because:
1) there aren't file called "Lokiwiz03a.zip"
2) Need I to do hard reset (or a soft reset) after execute that 2 files?
Please help me, I'm not the only one with that problem.
Thanks to all.
Click to expand...
Click to collapse
Sorry thats the file from the sim unlock part, I've changed the wiki
the files you need are in pdamobiz.com_downgrade_and_unlockcid.rar
Hi!!! Thanks for your update!
I run the 2 files from my machine without hardreset after that.
That solved the Downgrade.bat operation (i did not receive the "itsutils.dll error") but it didn't work with the Cidunlock.bat command.
With the cidunlock.bat command I had the classic error and this one too from the cmd screen:
"CopyFileToTFFS(acidunlocked.bin:0, 0, 00010000)
ERROR: ITWriteDisk - internal error"
After that I made the last experiment.
I tried to update the rom without unlock the cid and I discovered with the Italian Prophet you don't have to unlock the cid.
So I solve my problem!! Thanks to all!
I hope to help someone with this post!
Easy fix to the "Could not update itsutils.dll to the current version..." error
1. Use prapi.exe to query value of 4097.
D:>prapi.exe -q -p 4097
Default is "2"
2. Use prapi.exe to set value of policy 4097 to "1"
D:\>prapi.exe -p 4097 1
Explanation :
4097
0x1001 RAPI Policy The Remote API (RAPI) policy restricts the access of remote applications that are using RAPI to implement ActiveSync operations on mobile devices.
0 ActiveSync service is shut down. RAPI calls are rejected.
1 Full access to ActiveSync is provided. RAPI calls are allowed to process without restrictions.
2 Access to ActiveSync is restricted to the SECROLE_USER_AUTH (User Authenticated) role. RAPI calls are checked against this role mask before they are granted. ( default )
Also check : http://www.xs4all.nl/~itsme/projects/xda/smartphone-policies.html

Turn off/power off the phone correctly from a custom application...

I'm writing an application in which I would be able to turn off/shutdown/power off the phone.
From what I read around the net there is no way to turn off the device from an application. Is this true?
On rooted phones you could use the reboot -p command, but:
Users who have a rooted phone are very few, I think maybe 1-5%.
From what I read reboot does not unmount filesystems.
If there is no way to turn off the phone without using the root command, what is the correct procedure to do that using reboot -p?
Have you checked the way the power off dialog turns the phone off?. It's a system service, though, and it runs with root priviledges, but you could find something to make it work there
You mean this? I tried to use the method shutdownAfterDisablingRadio() but I seem that can be used only by the operative system and not by custom applications, is that wrong?
The thing that worries me is that into 16000 applications on the Market there is not one that turns off the phone without requiring root permissions.
Have you considered using "am" to execute the Android system call via shell from within your application? IANAP -- I don't know the ins and outs of using AM to execute system calls, but I *do* know that it /can/ do so.
They have an app like this already...its called "quick boot"
Power off your phone, power off into bootloader, and power off into recovery mode?
Zei said:
They have an app like this already...its called "quick boot"
Power off your phone, power off into bootloader, and power off into recovery mode?
Click to expand...
Click to collapse
For rooted phones, he wants to make it for non-rooted phones
Zei said:
They have an app like this already...its called "quick boot"
Power off your phone, power off into bootloader, and power off into recovery mode?
Click to expand...
Click to collapse
noob it doesnt power off it reboots
IConrad01 said:
Have you considered using "am" to execute the Android system call via shell from within your application? IANAP -- I don't know the ins and outs of using AM to execute system calls, but I *do* know that it /can/ do so.
Click to expand...
Click to collapse
Very interesting! I did not know this tool. I tried to start some intent but have not yet managed to turn off the phone.
Code:
am start -a android.intent.action.ACTION_REQUEST_SHUTDOWN
Starting: Intent { act=android.intent.action.ACTION_REQUEST_SHUTDOWN }
Error: Activity not started, unable to resolve Intent { act=android.intent.action.ACTION_REQUEST_SHUTDOWN flg=0x10000000 }
Zei said:
They have an app like this already...its called "quick boot"
Power off your phone, power off into bootloader, and power off into recovery mode?
Click to expand...
Click to collapse
JAguirre1231 said:
For rooted phones, he wants to make it for non-rooted phones
Click to expand...
Click to collapse
Exactly.
In any case, if there is no alternative, I'd still know about the correct procedure for rooted devices.
JD82 said:
In any case, if there is no alternative, I'd still know about the correct procedure for rooted devices.
Click to expand...
Click to collapse
Bump
__________________
Code:
Process p = Runtime.getRuntime().exec("su");
OutputStream os = p.getOutputStream();
os.write("reboot\n".getBytes());
os.flush();
Should work on most ROMs.
senab said:
Code:
Process p = Runtime.getRuntime().exec("su");
OutputStream os = p.getOutputStream();
os.write("reboot\n".getBytes());
os.flush();
Should work on most ROMs.
Click to expand...
Click to collapse
for non-rooted phones, su shouldn't work :\
senab said:
Code:
Process p = Runtime.getRuntime().exec("su");
OutputStream os = p.getOutputStream();
os.write("reboot\n".getBytes());
os.flush();
Should work on most ROMs.
Click to expand...
Click to collapse
Thanks for your reply.
How to run a command as root I already knew:
Code:
public static boolean runRootCommand(String command) {
Process process = null;
DataOutputStream os = null;
try {
process = Runtime.getRuntime().exec("su");
os = new DataOutputStream(process.getOutputStream());
os.writeBytes(command+"\n");
os.writeBytes("exit\n");
os.flush();
process.waitFor();
} catch (Exception e) {
Log.d("*** DEBUG ***", "Unexpected error - Here is what I know: "+e.getMessage());
return false;
}
finally {
try {
if (os != null) {
os.close();
}
process.destroy();
} catch (Exception e) {
// nothing
}
}
return true;
}
[...]
runRootCommand("reboot -p");
I would be interested to know the correct sequence of commands to execute to turn off the phone without the risk of corrupting the filesystem.
I do not think is sufficient to run "reboot -p". Or it is?
@xidominicanoix: I know su doesn't work on non-rooted phones. I was answering JD82 for the procedure on rooted phones.
JD82 said:
I would be interested to know the correct sequence of commands to execute to turn off the phone without the risk of corrupting the filesystem.
I do not think is sufficient to run "reboot -p". Or it is?
Click to expand...
Click to collapse
On linux, reboot is the same command as "shutdown -r -q now". According to this manpage (i'm not on my Ubuntu machine right now to check there):
When the shutdown time arrives, shutdown notifies all users tells init not to spawn more getty's, writes the shutdown time into the /var/log/wtmp file, kills all other processes on the system, sync's, unmounts all the disks, sync's again, waits for a second, and then either terminates or reboots the system.
Click to expand...
Click to collapse
So yes, reboot *should* unmount the filesystems first avoiding corruption.
Hi senab and thanks for your reply.
In Ubuntu I restart without problems using "reboot", but I read this about the android version:
The basic command to reboot the device is called "reboot". Merely writing reboot will perform a restart of the device. The command will call "sync" before rebooting the device, but will not unmount the file systems. This is up to you. If a full system is running on the device, this might prove to be slightly difficult, and many people just reboot and hope for the best.
Click to expand...
Click to collapse
I would not release an application that causes damage to the user's filesystem.
sync is *usually* enough to avoid corrupting filesystems.
When it isn't is when the space between the sync and the actual reboot allows something to mess with the filesystem. Without looking at the actual implementation details of the reboot command, it may, in fact, be done in a way that is actually thread-SAFE.
Actually, since this reboot command actually sends a signal to the kernel, I believe that it is, in fact, thread safe.
Of course, another way to deal with this is to do something like remounting all corruptable filesystems as read-only just before issuing the reboot command. That would include /data, /sdcard, and possibly (if using apps2sd) /system/sd. I believe that this is excessive though.
Note: the reason why shutdown and reboot aren't available without root is simple: You don't want some douchebag writing a malicious program that randomly reboots any phone that it happens to be installed on.

[Q] Can not root P920

Dear mate, I want to be Super user for some application.
I did root with many methods such as SuperOneClick, z4root, CWM_Flasher, Megratron etc.
All of them could not worked but it not make my phone a brick.
Example result on SuperOneClick, it shown some false on some stage as.
" Starting ADB Server: *daemon not running, starting it now on port 5....
Checking if rooted: False
Checking for shell root: False
Checking for shell root: False (*repeating text again*)
Shell rooting device..step#1: rm fail for /data/local/tmp/boomsh, No such file
Shell rooting device..step#2: rm fail for /data/local/tmp/sh, No such file
Shell rooting device..step#6: [**]Zerg Rush - Android 2.2/2.3 local root [**] (C.. "
After that program not respond but phone can be running after reboot process.
Other example on CWM, it said "adb server is out of date" and "su: permission denied"
Other trying with Megatron,
It shown
run-as: Package 'com.ti.fmrxapp' has corrupt installation
After that phone re-boot then same message shown again with 5 lines
And " su: permission denied"
Re-boot again with some text is complete but my phone still not Super User.
about device:
Model Number: LG-P920
Firmware version: LGP920-V20c-APR-25-2012
Android version: 2.3.5
Kernel version: 2.635.7
For pc is win7, has Antivira virus protector but turn off on installation process.
Anyone could be help, very appreciate in advance
I known my question quite simple and may annoy your guy but I am trying with many methods that I found on this commuity.
I am not sure may be my phone have some trouble or I missed some step
Chokchai_Siwa said:
Dear mate, I want to be Super user for some application.
I did root with many methods such as SuperOneClick, z4root, CWM_Flasher, Megratron etc.
All of them could not worked but it not make my phone a brick.
Example result on SuperOneClick, it shown some false on some stage as.
" Starting ADB Server: *daemon not running, starting it now on port 5....
Checking if rooted: False
Checking for shell root: False
Checking for shell root: False (*repeating text again*)
Shell rooting device..step#1: rm fail for /data/local/tmp/boomsh, No such file
Shell rooting device..step#2: rm fail for /data/local/tmp/sh, No such file
Shell rooting device..step#6: [**]Zerg Rush - Android 2.2/2.3 local root [**] (C.. "
After that program not respond but phone can be running after reboot process.
Other example on CWM, it said "adb server is out of date" and "su: permission denied"
Other trying with Megatron,
It shown
run-as: Package 'com.ti.fmrxapp' has corrupt installation
After that phone re-boot then same message shown again with 5 lines
And " su: permission denied"
Re-boot again with some text is complete but my phone still not Super User.
about device:
Model Number: LG-P920
Firmware version: LGP920-V20c-APR-25-2012
Android version: 2.3.5
Kernel version: 2.635.7
For pc is win7, has Antivira virus protector but turn off on installation process.
Anyone could be help, very appreciate in advance
I known my question quite simple and may annoy your guy but I am trying with many methods that I found on this commuity.
I am not sure may be my phone have some trouble or I missed some step
Click to expand...
Click to collapse
here use this to Root your P920
enable usb debugging before you start.
http://vulnfactory.org/public/megatron_windows.zip
OptimusRs, Thanks for your help.
But your file could not run, anyway I tried with other Megatron.
It could running but could not root.
The result after running as captured picture.
Could I have anymore help.
http://forum.xda-developers.com/showthread.php?t=2195753

I am very desperate! Will donate as well! Rooting issue with Asus TF700T

Hi amigos on the internet!
I recently purchased an Asus TF700T about a week ago and still I'm having trouble rooting it.
Tried basically every method I could. I desperately seek help!
My device is unlocked though SU say's there is no binary installed.
I don't have fastboot on my device it only shows three images which is the RCK logo ANDROID logo and WIPE DATA logo.
There is not USB logo.
I have JB 4.2.1
Build number :
JOP40D
If you need anymore information I would be glad to provide! Please and thank you for taking the time! I just want to root and have TWRP on it
Unfortunately I do not know how to get TWRP
When trying to root it with DeBugfs I get this
Waiting for device to be detected…
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
Found system partition at: /dev/block/mmcblk0p1
Step 1 – Pushing files…
failed to copy ‘debugfs’ to ‘/data/local//debugfs’: Permission denied
failed to copy ‘su’ to ‘/data/local//su’: Permission denied
failed to copy ‘debugfsinput’ to ‘/data/local//debugfsinput’: Permission denied
failed on ‘/data/local/tmp’ – Permission denied
link failed File exists
Rebooting…
Once your devices has finished restarting,
Press any key to continue . . .
Step 2 – Rooting…
For this step, ignore any error messages that say “File not found”
Unable to chmod /data/local/debugfs: No such file or directory
/system/bin/sh: can’t open /data/local/debugfsinput: No such file or directory
rm failed for /data/local/tmp, Permission denied
failed on ‘/data/local/tmp.bak’ – No such file or directory
rm failed for /data/local/su, No such file or directory
rm failed for /data/local/debugfs, No such file or directory
rm failed for /data/local/debugfsinput, No such file or directory
Rebooting…
Once your devices has finished restarting,
Press any key to continue . . .
Finally the following appears:
Rooting FAILED! You may want to try running this tool again.
Your device region may not be supported if you see this message again.
Press any key to continue . . .
Your help will be greatly appreciated it! I will also donate through pay-pal since I'm very desperate, haha. Thanks again!
You need to run the tool as administrator
Also, have you used the unlock file from Asus. You must be unlocked, bootloader unlocked, for this to work.
http://forum.xda-developers.com/showthread.php?t=2094746
Sent from my ASUS Transformer Pad TF700T using Tapatalk 4
Mkami said:
Your help will be greatly appreciated it! I will also donate through pay-pal since I'm very desperate, haha. Thanks again!
Click to expand...
Click to collapse
What is your firmware version? If you are on anything later than 10.6.1.14.8, then you have to downgrade in order to root... You are already unlock and why don't install custom recovery and custom rom...
You don't have to donate to me because I am here trying to help out new user....
Mkami said:
My device is unlocked though SU say's there is no binary installed.
I don't have fastboot on my device it only shows three images which is the RCK logo ANDROID logo and WIPE DATA logo.
There is not USB logo.
Click to expand...
Click to collapse
Apparently you didn't read the text in the upper left corner - recent bootloaders activate fastboot already in the bootloader menu.
So you can use fastboot to install TWRP (read the guide on the teamw.in website or here on xda), then TWRP will offer you to install a root app.
And ignore the "you have to downgrade to root" advice - that's only relevant if you don't want to or can't unlock.
Hey guys thanks for replying to this post! Luckily I was able to get full step by step help by a member on XDA he was super helpful! Got my tablet rooted and rommed Thanks for looking at my post! Much obliged

[Q] PANIC: System call looped around EINTR 100 times

When running the android emulator, I always get the following error message before the emulator process is killed.
PANIC: .//android/sockets.c:1002:int socket_recvfrom(int, void *, int, SockAddress *): System call looped around EINTR 100 times: recvfrom(fd,buf,len,0,sa.sa,&salen)
I am using Android SDK / AVD Manager on Mac OSX10.10 (64 bit) and Java version 1.7.0_65.
Does anyone know what this means, why this happens, and how it can be alleviated?
Any help would be greatly appreciated.

Categories

Resources