Tristan-Hou / roottools

Automatically exported from code.google.com/p/roottools
0 stars 0 forks source link

Error: write failed: EPIPE (Broken pipe) #20

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello,

I don't know if I can raise issue, but here an issue I have when I when to set 
a property as I can do with a "adb shell setprop my.key my_value"

What steps will reproduce the problem?
1. Use RootTools.debugMode = true;
2. RootTools.useRoot = true;
3. if (RootTools.isRootAvailable()) {
    Log.i(TAG, "SU is available !");
    try {
     List<String> output = RootTools.sendShell("setprop my.key start", 5);
    } catch (IOException e) {
        // something went wrong, deal with it here
        e.printStackTrace();
        }
} else {
    Log.e(TAG, "SU is not available !");
}

What is the expected output? What do you see instead?
When I check getprop with:
adb shell getprop | grep my
I should see
[my.key]: [start]

But on logcat I can see:
Shell command: setprop my.key start
Error: write failed: EPIPE (Broken pipe)

What version of the product are you using? On what operating system?
RootTools v1.7

Please provide any additional information below.
I there any specific permission to use ?
Can I use this library on a app installed "normally" adb install app.apk ?

Original issue reported on code.google.com by cis.snak...@gmail.com on 3 May 2012 at 3:36

GoogleCodeExporter commented 8 years ago
Here after a detailled log:
05-03 17:38:06.109: D/RootTools v1.7(1755): Checking for su
05-03 17:38:06.109: D/RootTools v1.7(1755): Trying second method
05-03 17:38:06.109: D/RootTools v1.7(1755): Checking for su
05-03 17:38:06.109: D/RootTools v1.7(1755): su was NOT found here: /sbin/
05-03 17:38:06.109: D/RootTools v1.7(1755): su was NOT found here: /system/bin/
05-03 17:38:06.109: D/RootTools v1.7(1755): su was found here: /system/xbin/
05-03 17:38:06.109: D/RootTools v1.7(1755): su was NOT found here: 
/data/local/xbin/
05-03 17:38:06.109: D/RootTools v1.7(1755): su was NOT found here: 
/data/local/bin/
05-03 17:38:06.109: D/RootTools v1.7(1755): su was NOT found here: /data/local/
05-03 17:38:06.109: I/UiRecorderActivity(1755): SU is available !
05-03 17:38:06.109: D/RootTools v1.7(1755): Sending 1 shell command
05-03 17:38:06.129: W/System.err(1755): java.util.concurrent.TimeoutException
05-03 17:38:06.129: W/System.err(1755):     at 
com.stericson.RootTools.Executer.sendShell(Executer.java:95)
05-03 17:38:06.129: W/System.err(1755):     at 
com.stericson.RootTools.RootTools.sendShell(RootTools.java:1112)
05-03 17:38:06.129: W/System.err(1755):     at 
com.stericson.RootTools.RootTools.sendShell(RootTools.java:1079)
05-03 17:38:06.129: W/System.err(1755):     at 
com.stericson.RootTools.RootTools.sendShell(RootTools.java:1171)
05-03 17:38:06.129: W/System.err(1755):     at 
com.stericson.RootTools.RootTools.sendShell(RootTools.java:1197)
[...]
05-03 17:38:06.129: W/System.err(1755):     at 
android.view.View.performClick(View.java:3511)
05-03 17:38:06.129: W/System.err(1755):     at 
android.view.View$PerformClick.run(View.java:14105)
05-03 17:38:06.129: W/System.err(1755):     at 
android.os.Handler.handleCallback(Handler.java:605)
05-03 17:38:06.129: W/System.err(1755):     at 
android.os.Handler.dispatchMessage(Handler.java:92)
05-03 17:38:06.129: W/System.err(1755):     at 
android.os.Looper.loop(Looper.java:137)
05-03 17:38:06.129: W/System.err(1755):     at 
android.app.ActivityThread.main(ActivityThread.java:4424)
05-03 17:38:06.129: W/System.err(1755):     at 
java.lang.reflect.Method.invokeNative(Native Method)
05-03 17:38:06.129: W/System.err(1755):     at 
java.lang.reflect.Method.invoke(Method.java:511)
05-03 17:38:06.129: W/System.err(1755):     at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-03 17:38:06.129: W/System.err(1755):     at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-03 17:38:06.129: W/System.err(1755):     at 
dalvik.system.NativeStart.main(Native Method)
05-03 17:38:06.139: D/dalvikvm(1755): GC_EXPLICIT freed 81K, 10% free 
9272K/10243K, paused 1ms+1ms
05-03 17:38:06.149: D/RootTools v1.7(1755): Using Root
05-03 17:38:06.149: D/RootTools v1.7(1755): Shell command: setprop my.key start
05-03 17:38:06.149: D/RootTools v1.7(1755): Error: write failed: EPIPE (Broken 
pipe)
05-03 17:38:06.149: D/RootTools v1.7(1755): In finally block
05-03 17:38:06.149: D/RootTools v1.7(1755): Getting Exit
05-03 17:38:06.149: D/RootTools v1.7(1755): Exit done...

Original comment by cis.snak...@gmail.com on 3 May 2012 at 3:41

GoogleCodeExporter commented 8 years ago
I don't think this is an error with RootTools but with setprop. Does this same 
command work if executed from the shell on your phone?

Original comment by Stericso...@gmail.com on 3 May 2012 at 3:43

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
With Android Terminal Emulator you mean ?
I am trying ...

SO the result:
a getprop works.

But for setprop i need su, but when I try su:

app_66@android:/ $ su
su: uid 10066 not allowed to su

:/

Original comment by cis.snak...@gmail.com on 4 May 2012 at 7:28

GoogleCodeExporter commented 8 years ago
Ok I tried again now I have:
[...]
05-04 09:33:51.587: D/RootTools v1.7(3834): su was found here: /system/xbin/
[...]
05-04 09:33:51.587: D/RootTools v1.7(3834): Sending 1 shell command
05-04 09:33:51.597: W/System.err(3834): java.util.concurrent.TimeoutException
05-04 09:33:51.597: W/System.err(3834):     at 
com.stericson.RootTools.Executer.sendShell(Executer.java:95)
05-04 09:33:51.597: W/System.err(3834):     at 
com.stericson.RootTools.RootTools.sendShell(RootTools.java:1112)
05-04 09:33:51.597: W/System.err(3834):     at 
com.stericson.RootTools.RootTools.sendShell(RootTools.java:1079)
05-04 09:33:51.597: W/System.err(3834):     at 
com.stericson.RootTools.RootTools.sendShell(RootTools.java:1171)
05-04 09:33:51.597: W/System.err(3834):     at 
com.stericson.RootTools.RootTools.sendShell(RootTools.java:1197)
[...]
05-04 09:33:51.627: D/RootTools v1.7(3834): Using Root
05-04 09:33:51.627: D/RootTools v1.7(3834): Shell command: setprop my.key 1
05-04 09:33:51.627: D/RootTools v1.7(3834): Done reading input stream
05-04 09:33:51.627: D/RootTools v1.7(3834): error stream: su: uid 10065 not 
allowed to su

Strange, how a "su" binary cannot provide access to it ?

Original comment by cis.snak...@gmail.com on 4 May 2012 at 7:37

GoogleCodeExporter commented 8 years ago
I'm not sure what is happening there, however I am pretty certain that what is 
happening is not related to the RootTools library :\

Original comment by Stericso...@gmail.com on 4 May 2012 at 1:49

GoogleCodeExporter commented 8 years ago

Original comment by Stericso...@gmail.com on 23 May 2012 at 4:22

GoogleCodeExporter commented 8 years ago
I have the same EPIPE broken issue on rooted android 4.0.3 devices with and 
without RootTools. So the issue shall not be related to RootTools. The problem 
is almost all the devices I tested broke the same way.

To test without RootTools, use this basic code:

Process su = Runtime.getRuntime().exec("/system/xbin/su"); // my is here

DataOutputStream os = new DataOutputStream(
su.getOutputStream());

// Getting the id of the current user to check if this is root
os.writeBytes("id\n"); // IOException EPIPE broken thrown there.
os.flush();

Off course, this is the correct path and name. I also tried many different su 
supposed to be OK but failed the same way.

Original comment by Crouze...@gmail.com on 14 Sep 2012 at 8:25