[Q] Permission denied on complex shell script - Android Q&A, Help & Troubleshooting

I'm porting a script that runs well on android 4.0.4 to android 4.4.2
Simplified it does this:
Code:
ls *.a | ./busybox xargs ./busybox rm -f
I'm using a busybox binary in mi app's folder (/data/data/com.myapp.bla/)
The error I'm getting is:
Code:
xargs: ./busybox: Permission denied
However, if I run
Code:
./busybox rm -f x.a
it works.
The ./busybox that it's complaining about it's the second, the one that calls rm. The first get's executed. Whatever I put as the second command won't get executed.
I'm rooted and can execute simple commands as root, the problem is when a comand has a nested command inside.
same thing happens with rsync -e.
I've tested this on Samsung galaxy note 10.1 android 4.0.4 where it works fine, and Samsung galaxy note 10.1 2014 edittion android 4.4.2 where it fails.
I'm sensing this has something to do with SELinux set in enforced. I can't change it whatsoever. I've tryed everything on the net besides reflashing a new kernel and changing image.

rombusevil said:
I'm porting a script that runs well on android 4.0.4 to android 4.4.2
Simplified it does this:
Code:
ls *.a | ./busybox xargs ./busybox rm -f
I'm using a busybox binary in mi app's folder (/data/data/com.myapp.bla/)
The error I'm getting is:
Code:
xargs: ./busybox: Permission denied
However, if I run
Code:
./busybox rm -f x.a
it works.
The ./busybox that it's complaining about it's the second, the one that calls rm. The first get's executed. Whatever I put as the second command won't get executed.
I'm rooted and can execute simple commands as root, the problem is when a comand has a nested command inside.
same thing happens with rsync -e.
I've tested this on Samsung galaxy note 10.1 android 4.0.4 where it works fine, and Samsung galaxy note 10.1 2014 edittion android 4.4.2 where it fails.
I'm sensing this has something to do with SELinux set in enforced. I can't change it whatsoever. I've tryed everything on the net besides reflashing a new kernel and changing image.
Click to expand...
Click to collapse
I tried executing the example command in /data/local/tmp as shell user and it works. Same command in my app's folder executed as the linux user of the app and it works too. Problem is that I need to access different directories not owned by my app's user, such as /sdcard/
If there's a way that I can change selinux policies at runtime or disable it without reflashing please let me know.
Thanks in advance

Related

[Q] How to Complete uninstall Chainfire 3d drivers

Please help before installing and apply nvidia patch my games like plant vs zombie running without problem.
but after unsuccessful attempt of play nvidia games on my deivce Samsung SGSL i9003.
i uninstall this, set plugin to default and uninstall drivers.
But Still my games are no longer running.
I face problem with plant vs zombie. it crash as it start but before chainfire3d it run perfectly.
waiting for reply asap..
manrock111 said:
Please help before installing and apply nvidia patch my games like plant vs zombie running without problem.
but after unsuccessful attempt of play nvidia games on my deivce Samsung SGSL i9003.
i uninstall this, set plugin to default and uninstall drivers.
But Still my games are no longer running.
I face problem with plant vs zombie. it crash as it start but before chainfire3d it run perfectly.
waiting for reply asap..
Click to expand...
Click to collapse
bro the same problem happened to my phone so i reflashed my custom rom.
Please use the Q&A Forum for questions Thanks
Moving to Q&A
I have the same problem. Chainfire caused me many problems. I want to completely remove it, but I can't.
I put another ROM and whiped data, and it still makes problems. Please help!
manrock111 said:
Please help before installing and apply nvidia patch my games like plant vs zombie running without problem.
but after unsuccessful attempt of play nvidia games on my deivce Samsung SGSL i9003.
i uninstall this, set plugin to default and uninstall drivers.
But Still my games are no longer running.
I face problem with plant vs zombie. it crash as it start but before chainfire3d it run perfectly.
waiting for reply asap..
Click to expand...
Click to collapse
Hy i have same problem . Can you solve this problem? /clear completly chainfire3d/
Same problem, I used to be able to run The Settlers and other games, now I can't..
I uninstalled drivers, set plugin to default, then uninstalled the app, but still it doesn't work
Having root access from recovery is a must to solve problems if you run into them (run "/system/lib/cf3d_uninstall.sh" as root to remove the driver and restore the old one)
1. boot into jb recovery mode
2. run "adb devices" - to make sure the phone drivers are ok (should output a long hex string and "device")
3. run "adb shell" from command prompt
4. in shell prompt "sh system/lib"
5. still in shell "sh /cf3d_uninstall.sh"
phone will reboot and you have working jb system
- it worked for me but no guarantee it'll work for you!
hope it helps.
if sh /cf3d_uninstall.sh doesnt work , try 'sh /system/lib/cf3d_uninstall.sh" instead.
another solve
guys at first i tried to use adb
i got no permissions
so i thought i can use terminal emulator
first open terminal emulator
write SU and give terminal the superuser rights
now use the command
"/system/lib/cf3d_uninstall.sh"
or
"sh /cf3d_uninstall.sh"
after success
your phone will stop giving orders and responding
now you can remove the battery and you are done
ty i hope i helped
mido1122 said:
guys at first i tried to use adb
i got no permissions
so i thought i can use terminal emulator
first open terminal emulator
write SU and give terminal the superuser rights
now use the command
"/system/lib/cf3d_uninstall.sh"
or
"sh /cf3d_uninstall.sh"
after success
your phone will stop giving orders and responding
now you can remove the battery and you are done
ty i hope i helped
Click to expand...
Click to collapse
Under JB, I don't find any system/lib folder at all... Any idea where's the chainfire3D placed in it?
Same problem in my gt2 p3100
manrock111 said:
Please help before installing and apply nvidia patch my games like plant vs zombie running without problem.
but after unsuccessful attempt of play nvidia games on my deivce Samsung SGSL i9003.
i uninstall this, set plugin to default and uninstall drivers.
But Still my games are no longer running.
I face problem with plant vs zombie. it crash as it start but before chainfire3d it run perfectly.
waiting for reply asap..
Click to expand...
Click to collapse
please help chainfire3d has spoiled my android gaming life.
Terminal emulator displaying ''not found''
mido1122 said:
guys at first i tried to use adb
i got no permissions
so i thought i can use terminal emulator
first open terminal emulator
write SU and give terminal the superuser rights
now use the command
"/system/lib/cf3d_uninstall.sh"
or
"sh /cf3d_uninstall.sh"
after success
your phone will stop giving orders and responding
now you can remove the battery and you are done
ty i hope i helped
Click to expand...
Click to collapse
Terminal emulator displaying ''not found''
dailyuse17 said:
Terminal emulator displaying ''not found''
Click to expand...
Click to collapse
Below is my Logs:
######## Below was executed from Windows command prompt. I have "adb.exe" installed in the Desktop\404 ##########
C:\Users\Chu\Desktop\404>adb kill-server
C:\Users\Chu\Desktop\404>adb wait-for-device
* daemon not running. starting it now *
* daemon started successfully *
C:\Users\Chu\Desktop\404>adb shell
########## After you've executed 'adb shell', i will login to the phone as user shell ##########
[email protected]:/ $ su
########## You have to switchuser to root to gain full access, as seen below, you are "root" ##########
[email protected]:
# cd /system
cd /system
[email protected]:/system # cd lib
cd lib
########## Above, i change directory to /system/lib ##########
[email protected]:/system/lib # ls cf*
ls cf*
cf3d_uninstall.sh
########## Found the file to be cf3d_uninstall.sh and execute the shell script with the command below ##########
[email protected]:/system/lib # sh cf3d_uninstall.sh
sh cf3d_uninstall.sh
rm failed for /system/lib/cf3d_sh, No such file or directory
usage: reboot [-n] [-p] [rebootcommand]
########## There, the phone will restart, and you'll get back your phone. Just ignore the "no such file or directory" error above. It'll still work ##########
Good luck.
manchuks said:
Below is my Logs:
######## Below was executed from Windows command prompt. I have "adb.exe" installed in the Desktop\404 ##########
C:\Users\Chu\Desktop\404>adb kill-server
C:\Users\Chu\Desktop\404>adb wait-for-device
* daemon not running. starting it now *
* daemon started successfully *
C:\Users\Chu\Desktop\404>adb shell
########## After you've executed 'adb shell', i will login to the phone as user shell ##########
[email protected]:/ $ su
########## You have to switchuser to root to gain full access, as seen below, you are "root" ##########
[email protected]:
# cd /system
cd /system
[email protected]:/system # cd lib
cd lib
########## Above, i change directory to /system/lib ##########
[email protected]:/system/lib # ls cf*
ls cf*
cf3d_uninstall.sh
########## Found the file to be cf3d_uninstall.sh and execute the shell script with the command below ##########
[email protected]:/system/lib # sh cf3d_uninstall.sh
sh cf3d_uninstall.sh
rm failed for /system/lib/cf3d_sh, No such file or directory
usage: reboot [-n] [-p] [rebootcommand]
########## There, the phone will restart, and you'll get back your phone. Just ignore the "no such file or directory" error above. It'll still work ##########
Good luck.
Click to expand...
Click to collapse
my phone camera doesnot work well due to chainfire3d how to uninstall completely . at this time i m completely uninstall the chai fire 3d but camera does not work . my camera shows the blur photos when in the camera mode
How to do this when installed it by mistake on samsung gt-i9505 please? thanks.
---------- Post added at 02:36 AM ---------- Previous post was at 02:05 AM ----------
Ok, like i didn't see the file in the folders concerned, this saved me (applied it without looking or searching the file i didn't see). big up and thanks.
http://forum.xda-developers.com/showpost.php?p=39301435&postcount=8
Help me please...
bolibo said:
Having root access from recovery is a must to solve problems if you run into them (run "/system/lib/cf3d_uninstall.sh" as root to remove the driver and restore the old one)
1. boot into jb recovery mode
2. run "adb devices" - to make sure the phone drivers are ok (should output a long hex string and "device")
3. run "adb shell" from command prompt
4. in shell prompt "sh system/lib"
5. still in shell "sh /cf3d_uninstall.sh"
phone will reboot and you have working jb system
- it worked for me but no guarantee it'll work for you!
hope it helps.
Click to expand...
Click to collapse
Hi.. i tried what you have suggest but still not able to recover my phone...please help me
:crying::crying::crying::crying::crying::crying::crying:
:\android-sdk-windows\platform-tools>adb devices
List of devices attached
0123456789ABCDEF device
C:\android-sdk-windows\platform-tools>adb shell
[email protected]:/ $ sh /system/lib/cf3d_uninstall.sh
sh /system/lib/cf3d_uninstall.sh
mount: Operation not permitted
/system/lib/cf3d_uninstall.sh[4]: can't create /system/lib/libGLESv1_CM.so: Read
-only file system
Unable to chown /system/lib/libGLESv1_CM.so: Read-only file system
Unable to chown /system/lib/libGLESv1_CM.so: Read-only file system
Unable to chown /system/lib/libGLESv1_CM.so: Read-only file system
Unable to chown /system/lib/libGLESv1_CM.so: Read-only file system
Unable to chmod /system/lib/libGLESv1_CM.so: Read-only file system
/system/lib/cf3d_uninstall.sh[11]: can't create /system/lib/libGLESv2.so: Read-o
nly file system
Unable to chown /system/lib/libGLESv2.so: Read-only file system
Unable to chown /system/lib/libGLESv2.so: Read-only file system
Unable to chown /system/lib/libGLESv2.so: Read-only file system
Unable to chown /system/lib/libGLESv2.so: Read-only file system
Unable to chmod /system/lib/libGLESv2.so: Read-only file system
rm failed for /system/lib/cf3d_uninstall.sh, Read-only file system
rm failed for /system/lib/cf3d_sh, No such file or directory
usage: reboot [-n] [-p] [rebootcommand]
reboot: Operation not permitted
reboot: Operation not permitted
reboot: Operation not permitted
reboot: Operation not permitted
reboot: Operation not permitted
reboot: Operation not permitted
1|[email protected]:/ $
Help
Hello, guyz. the solution for this problem is that you should unistalled the divers you have installed to reduce the graphics (which u have installed in chainfire 3d) unistalled it and you are ready play your game again with the same graphic which you have earlier
thanks!
manju_xda said:
Hi.. i tried what you have suggest but still not able to recover my phone...please help me
:crying::crying::crying::crying::crying::crying::crying:
:\android-sdk-windows\platform-tools>adb devices
List of devices attached
0123456789ABCDEF device
C:\android-sdk-windows\platform-tools>adb shell
[email protected]:/ $ sh /system/lib/cf3d_uninstall.sh
sh /system/lib/cf3d_uninstall.sh
mount: Operation not permitted
/system/lib/cf3d_uninstall.sh[4]: can't create /system/lib/libGLESv1_CM.so: Read
-only file system
Unable to chown /system/lib/libGLESv1_CM.so: Read-only file system
Unable to chown /system/lib/libGLESv1_CM.so: Read-only file system
Unable to chown /system/lib/libGLESv1_CM.so: Read-only file system
Unable to chown /system/lib/libGLESv1_CM.so: Read-only file system
Unable to chmod /system/lib/libGLESv1_CM.so: Read-only file system
/system/lib/cf3d_uninstall.sh[11]: can't create /system/lib/libGLESv2.so: Read-o
nly file system
Unable to chown /system/lib/libGLESv2.so: Read-only file system
Unable to chown /system/lib/libGLESv2.so: Read-only file system
Unable to chown /system/lib/libGLESv2.so: Read-only file system
Unable to chown /system/lib/libGLESv2.so: Read-only file system
Unable to chmod /system/lib/libGLESv2.so: Read-only file system
rm failed for /system/lib/cf3d_uninstall.sh, Read-only file system
rm failed for /system/lib/cf3d_sh, No such file or directory
usage: reboot [-n] [-p] [rebootcommand]
reboot: Operation not permitted
reboot: Operation not permitted
reboot: Operation not permitted
reboot: Operation not permitted
reboot: Operation not permitted
reboot: Operation not permitted
1|[email protected]:/ $
Click to expand...
Click to collapse
You must be rooted to do that.
Help!!
El_Dark said:
You must be rooted to do that.
Click to expand...
Click to collapse
Hi, i'm a boy from Finland. I have the same problem as "manju_xda" but i have the root permissions in my device..
The question is.. .. I'm stucked with chainfire 3d and my adb shell tells that "adbd cannot run as root in production builds" .. What to do?
And sorry for my bad english
For those who found this thread on Google, I found my solution in here: http://forum.xda-developers.com/showthread.php?t=2362873

[SOLVED] "sh: applet not found" after BusyBox install

Background: On a rooted device, I installed busybox via the BusyBox Pro app, with the "symlinks" option checked. Afterwards, wifi stopped working, root stopped working, adb stopped working, and a lot of tasks started failing with "sh: applet not found".
The problem: BusyBox Pro 8.0 replaces /system/bin/ash with a symlink to busybox. This was problematic on my device, where /system/bin/sh was a symlink to ash, so now 'sh' is actually calling busybox, and this particular compilation of busybox didn't have 'sh' support compiled in, hence the "sh: applet not found" error everytime anything tried to call sh, which as it happens, is a lot! The bug was fixed quickly with a 8.1 release, but due to suspected caching policies on the Google Store, a lot of people still got the old release even after this was fixed!
Here's how I fixed this:
Prerequisite: You'll need a replacement sh binary. On another device, which was also an ARM device, sh was symlinked to 'mksh', and I just took this. You might want to verify that the binary works on your broken device before completing the final steps below.
Initial Wifi
It's only DHCP that is failing (on the "Obtaining IP address..." step), so go into your Wifi Settings, forget the network, add it again, and change DHCP to "static", manually fill in the appropriate IP info for your network, and you'll be good to go (encrypted network is fine).
Getting a Root terminal
Download KBOX from http://kevinboone.net/kbox.html
In KBox, menu -> more -> preferences, change shell -> "command line" to "/system/bin/ash"
su -s /system/bin/ash
Remounting /system as RW
In theory, all you should need to do is: busybox mount -o remount,rw /system
This didn't work for me, and I got a "permission denied (are you root)" error, I guess because the system was no longer booting properly. I had to redo some of the steps involved in rooting my device, in my case:
On phone:
mkdir /data/local/lib
echo ro.kernel.qemu=1 > /data/local.prop
reboot
(wait for reboot, and get into a root terminal again as per the above)
On PC (from previous files used for rooting my device):
adb push lsm_disabler.ko /data/local/lib/
Oh phone:
insmod /data/local/lib/lsm_disabler.ko
rm /data/local/lib/lsm_disabler.ko
cat > /data/local.prop
From this point, I was able to remount successfully:
mount -o remount,rw /system
Fixing sh
Now on your PC, push the replacement binary to /system/bin, in my case:
adb push mksh /system/bin
On phone:
cd /system/bin
busybox ln -sf sh mksh
Verify now that "./sh" gives you a working terminal.
If all is good:
mount -o remount,ro /system
reboot
All done! Wow, this saved me sending my device back to Japan, since it's still using the stock bootloader and there are now available update.zip's out there. Good luck everyone, feel free to ask questions :>
P.S. I'm going to contact BusyBox Pro's author now with some suggestions to prevent these kind of problems happening in the future.
Deleted.
Deleted.
I rant into the same problem on my Galaxy Tab. Thanks for this, it saved my day!
A little correction to this little thing:
Kinslayer81 said:
On phone:
cd /system/bin
busybox ln -sf sh mksh
Click to expand...
Click to collapse
This worked for me:
cd /system/bin
ln -sf mksh sh
chmod 755 sh
Thank you
Just want to say thanks.
Your Posting helped me out with the Problems on my htc flyer.
I installed BusyBox Pro by Stephen (Stericson) to fix a missing symlinks problem that I had after installing JRummy's Busy Box. I then encountered the applet not found problem and then just reinstalled JRummy's version and it fixed it without having to do anything else.
Kinslayer81 said:
Background: On a rooted device, I installed busybox via the BusyBox Pro app, with the "symlinks" option checked. Afterwards, wifi stopped working, root stopped working, adb stopped working, and a lot of tasks started failing with "sh: applet not found".
The problem: BusyBox Pro 8.0 replaces /system/bin/ash with a symlink to busybox. This was problematic on my device, where /system/bin/sh was a symlink to ash, so now 'sh' is actually calling busybox, and this particular compilation of busybox didn't have 'sh' support compiled in, hence the "sh: applet not found" error everytime anything tried to call sh, which as it happens, is a lot! The bug was fixed quickly with a 8.1 release, but due to suspected caching policies on the Google Store, a lot of people still got the old release even after this was fixed!
Here's how I fixed this:
Prerequisite: You'll need a replacement sh binary. On another device, which was also an ARM device, sh was symlinked to 'mksh', and I just took this. You might want to verify that the binary works on your broken device before completing the final steps below.
Initial Wifi
It's only DHCP that is failing (on the "Obtaining IP address..." step), so go into your Wifi Settings, forget the network, add it again, and change DHCP to "static", manually fill in the appropriate IP info for your network, and you'll be good to go (encrypted network is fine).
Getting a Root terminal
Download KBOX from http://kevinboone.net/kbox.html
In KBox, menu -> more -> preferences, change shell -> "command line" to "/system/bin/ash"
su -s /system/bin/ash
Remounting /system as RW
In theory, all you should need to do is: busybox mount -o remount,rw /system
This didn't work for me, and I got a "permission denied (are you root)" error, I guess because the system was no longer booting properly. I had to redo some of the steps involved in rooting my device, in my case:
On phone:
mkdir /data/local/lib
echo ro.kernel.qemu=1 > /data/local.prop
reboot
(wait for reboot, and get into a root terminal again as per the above)
On PC (from previous files used for rooting my device):
adb push lsm_disabler.ko /data/local/lib/
Oh phone:
insmod /data/local/lib/lsm_disabler.ko
rm /data/local/lib/lsm_disabler.ko
cat > /data/local.prop
From this point, I was able to remount successfully:
mount -o remount,rw /system
Fixing sh
Now on your PC, push the replacement binary to /system/bin, in my case:
adb push mksh /system/bin
On phone:
cd /system/bin
busybox ln -sf sh mksh
Verify now that "./sh" gives you a working terminal.
If all is good:
mount -o remount,ro /system
reboot
All done! Wow, this saved me sending my device back to Japan, since it's still using the stock bootloader and there are now available update.zip's out there. Good luck everyone, feel free to ask questions :>
P.S. I'm going to contact BusyBox Pro's author now with some suggestions to prevent these kind of problems happening in the future.
Click to expand...
Click to collapse
This helped get my wifi back after flashing a kernel.
Hey there,
I've got the same problem.
After reinstalling the ROM everything works fine,
but when I try to install busybox, I get the same failure everytimes.
How can I prevent it?
Do I have to follow the steps above?
And where do I get the sh binary from?
Sorry guys, I'm a little confused and hope you may help me..
Thanks!!
Kbox not open in my ics when I open it its automatically closed
And i want to ask the script su -s /system/bin/ash where i put this script

How to root an Android Virtual Device?

I want to root my Android 4.0.4 virtual device for developing.......... How to root it?
Here you go ... ;-)
Paresh Kalinani said:
I want to root my Android 4.0.4 virtual device for developing.......... How to root it?
Click to expand...
Click to collapse
The following method is actually for 2.2 virtual machine ... but should work fine for 4.0 too ... i'll confirm after i have tested it ... meanwhile you can try it ..
You'll require
'su' binary
and
'busybox binary'
SU BINARY : See post's end
BUSY BOX BINARY : see posts end
Then, we need to start the emulator by providing extra partition size to /system. This can be done only through command-line
Code:
emulator -avd MyAndroid -partition-size 128 -no-snapshot-load
Make sure the AVD “MyAndroid” is already created. The “-no-snapshot-load” option is used if we enabled the snapshot. As a result, we will start the emulator with extra disk space for /system. By this, we can adding extra files to /system later.
Then, we need to use “adb shell” to remount the /system so that we have write access to the /system.
Code:
adb shell mount -o rw,remount -t yaffs2 /dev/block/mtdblock0 /system
Then, we can push the su and busybox to the /system/xbin.
Code:
adb push su /system/xbin/
adb push busybox /system/xbin/
Now, to actually make the su work properly, we need to chmod it,
Code:
adb shell chmod 06755 /system/xbin/su
adb shell chmod 06755 /system/xbin/busybox
Now, we need to install Superuser.apk (which you can get together with “su”). We can install it with “adb install” command. It is required when the other apps request for “su”.
We can try our “su” with Root Checker Basic or Stericson Busy-box.
Now, that is rooting. You might feel happy with it. However, if we restart the emulator, without snapshot, all the “su” does not work any more. So, we are going to customise the ROM image.
Failures
Now, if we restart the emulator, everything will return to default. No more “su” and Android Market. Why? The reason is because whatever we done to the /system, it will not save to the ROM image.
The /system is actually from the system.img, installed with android-2.2 in my case. This file is mounted in emulator as yaffs2 file system format. In order to customise this ROM image, I have tried several ways.
Using unyaffs, it can only extract the image, but I cannot continue. I can simply pull the /system using adb command without it.
Using yaffs2utils, unyaffs2 produced nothing. And the image built by mkyaffs2 does not allow the emulator to boot.
Using mkyaffsimage, also not work as above.
Some resources mentioned that, we can get the mkyaffs2image utility when building the Android source. But the problem is, to get the source, it requires a lot of disk space and need a long time to download.
So, what is the best way to modify the system.img? I even tried the low level way using dd to extract the /dev/block/mtdblock0, but failed.
Solution
Finally, I tried to solve it with userdata-qemu.img. This is the /data folder that will always modified when we install apps in the emulator. Restarting the emulator does not reset /data. Therefore, we can simply create the ROM image from /data. We can done it simply clean all the /data.
Code:
adb shell busybox rm -R /data/*
This will remove everything is /data, except “lost+found” folder.
Code:
adb shell busybox ls /data
Check with ls command, make sure only “lost+found” left.
Now, since the /system contains the “su”, “busybox”, Market and Google Services Framework we have done earlier, we need to copy the whole /system to the /data.
Code:
adb shell busybox cp -a /system/* /data/
adb shell busybox ls /data
As a result, the /data is identical to the /system.
Now, we have the userdata-qemu.img file in the AVD folder, which is modified. Close the emulator. Then, we can use the userdata-qemu.img file as the system image. We can rename it to system.img, or calling it as the system with “-system” option from the emulator command-line.
Start the emulator with this customised system.img, now, we have busybox by default, and also Android Market. :good::highfive:
Tip
If you are doing this on windows make sure you CD to here for issuing the commands:
%profilename%\AppData\Local\Android\android-sdk\tools
Don't use the stuff in C:\Program Files\Android. That is the wrong location.
The below gets your GAPPS too. You can download Cyanogens GAPPS to get what you need. Just edit the necessary lines below.
cd %profilename%\AppData\Local\Android\android-sdk\
.\tools\emulator -avd MyAndroid -partition-size 2047 -no-snapshot-load -verbose
echo wait for boot
pause
.\platform-tools\adb shell mount -o rw,remount -t yaffs2 /dev/block/mtdblock0 /system
.\platform-tools\adb push %~dp0platform-tools\su /system/xbin/
.\platform-tools\adb push %~dp0platform-tools\busybox /system/xbin/
.\platform-tools\adb shell chmod 06755 /system/xbin/su
.\platform-tools\adb shell chmod 06755 /system/xbin/busybox
.\platform-tools\adb shell busybox rm -R /data/*
.\platform-tools\adb shell busybox ls /data
.\platform-tools\adb shell busybox ls /data
.\platform-tools\adb push %profilename%\Downloads\gapps-ics-20120317-signed\system /system
.\platform-tools\adb shell busybox cp -a /system/* /data/
Which busybox binary?
You don't say which of the various busybox files in the .7z archive is to be used on the AVD?
I try to push the su, I got this message:
C:\adb>adb push sources\root\su /system/xbin
failed to copy 'sources\root\su' to '/system/xbin/su': Directory not empty
Then try push the Superuser.apk
C:\adb>adb push sources\root\system\app\Superuser.apk /system/app/Superuser.apk
failed to copy 'sources\root\system\app\Superuser.apk' to '/system/app/Superuser
.apk': Out of memory
I think that's because of this:
View attachment 1617834
How to make the System ROM space more freely???
----------------------------------------------------------------------------
Sorry for my noob question. Now, I see.
I have done untill rename userdata-qemu.img to system.img
But while I run from AVD Manager, my AVD got bootloop.
That's because you haven't started your emulator with additional space. Use the -partition-size option as per niranjan94's post above.
I found an even better way to make a /system image, and adapted it for use on Windows hosts and using the x86 emulator images now available.
References:
http://blog.thecobraden.com/2012/06/making-persistent-changes-to-android.html
http://code.google.com/p/android-group-korea/downloads/detail?name=mkfs.yaffs2.x86
Place this batch file in the same folder as the mkfs.yaffs2.x86 binary and you'll get an emulator image updated to your liking and ready to run.
Code:
@echo off
adb -e remount
echo Pushing mkfs.yaffs2.x86 to device...
adb -e push mkfs.yaffs2.x86 /data/local/
echo Executing chmod 770 /data/local/mkfs.yaffs2.x86
adb -e shell chmod 770 /data/local/mkfs.yaffs2.x86
echo Setting /system partition to read-only (Just to be safe!)
adb -e shell mount -o ro,remount /dev/block/mtdblock0 /system
echo Creating YAFFS2 image of /system
adb -e shell /data/local/mkfs.yaffs2.x86 /system/ /mnt/sdcard/_system.img
echo Pulling image to local directory...
adb -e pull /mnt/sdcard/_system.img
echo Cleaning....
adb -e shell rm /data/local/mkfs.yaffs2.x86
adb -e shell rm /mnt/sdcard/_system.img
echo OK
pause
Don't work on 4.2.2 emulator
Ι mean I push it, give permissions, install su.apk ... still nothing...
On 4.2.2 emulator
Hi,
I got the same error on 4.2.2 emulator.
So I tried with size 256:
emulator -avd Andy2 -partition-size 256 -no-snapshot-load
and it worked fine.
Also, I'm using CPU ARM (armeabi-v7a). So for busybox I used the binary from this thread:
http://forum.xda-developers.com/showthread.php?t=1380278
Error while trying to permanent patch rooted android
Hi,
While trying to root my android emulator where I delete all the files in the /data/ folder and copy files from /system/ to /data/, I am getting the following error,
Code:
cp: write error: No space left on device
cp: write error: No space left on device
cp: write error: No space left on device
cp: write error: No space left on device
cp: write error: No space left on device
cp: write error: No space left on device
cp: write error: No space left on device
cp: write error: No space left on device
cp: write error: No space left on device
cp: write error: No space left on device
cp: write error: No space left on device
cp: write error: No space left on device
cp: write error: No space left on device
cp: write error: No space left on device
cp: write error: No space left on device
cp: write error: No space left on device
cp: write error: No space left on device
cp: write error: No space left on device
cp: write error: No space left on device
cp: write error: No space left on device
cp: write error: No space left on device
cp: write error: No space left on device
cp: write error: No space left on device
cp: write error: No space left on device
cp: write error: No space left on device
Could anyone help me how to overcome this issue?
Hi,
i've followed your instructions step by step and didn't encounter any problems while executing the commands, but the emulator is not getting rooted according to the Root Checker app (see also the screenshot attached). Could you help me please to solve this issue?
Here is an enumeration of the commands I've entered into the console:
emulator -avd Huawei -partition-size 256 -no-snapshot-load
adb shell mount -o rw,remount -t yaffs2 /dev/block/mtdblock0 /system
adb push "C:\Users\Admin\Desktop\Superuser-3.0.7-efghi-signed\system\bin\su" /system/xbin/
adb push "C:\Users\Admin\Desktop\busybox binary\busybox" /system/xbin/
adb shell chmod 06755 /system/xbin/su
adb shell chmod 06755 /system/xbin/busybox
adb install "C:\Users\Admin\Desktop\Superuser-3.0.7-efghi-signed\system\app\Superuser.apk"
adb install "C:\Users\Admin\Desktop\Root Checker App.apk"
Hi,
I have the device created in AVD, started, but for the life of me I cannot open ADB:
Code:
[email protected]:~$ sudo adb devices
[sudo] password for joel:
List of devices attached
[email protected]:~$
What to I have to do to trick the virtual device in advertising ADB? Developer is on, USB debugging is on. Using a virtual device as closely matching the LG Optimus F3Q as I can recall (so API 16 / Android 4.1.2 loaded).
Many thanks.
EDIT: Figured it out. Need to use the adb provided in the Android SDK (in the platform-tools directory), not any other version (I was using the Debian-provided one).
Unable to root nexus 4 avd
I tried to root Nexus_4_API_21.avd (lollipop) following commands from the post exactly.
I used latest versions of superuser, and busybox.
But at the end emulator is not rooted.
Could someone help with with this, if you have rooted avd please share it so that I can download.
Thank you.
Regards
I tried to root with Lollipop, Kitkat, and even Gingerbread, but it doesn't work.
Under Lollipop and Kitkat, it's not rooted, but under Gingerbread, I can't install any application afterwards.
When I try to, the emulator looks like it reboots, but it never goes to the end, and keeps showing the Android logo glowing.
For android 4, 5 and 6 I write manual in russian. Read it here: http://4pda.ru/forum/index.php?showtopic=318487&view=findpost&p=45421931
Worked for me with AVD Lollipop and Marshmallow.

ADB push alternative from Android device itself (non-rooted)

I have a non-rooted Android device with stock ROM 4.4.2 and I have the following test shell script:
Code:
adb push test.sh /data/local/tmp
adb shell "cd /data/local/tmp; chmod 755 test.sh"
adb.exe shell "sh /data/local/tmp/test.sh > /dev/null 2>&1 &"
If I run this over ADB from PC to my device, it simply works.
Now convert this to:
Code:
cp test.sh /data/local/tmp
cd /data/local/tmp; chmod 755 test.sh
/system/bin/sh /data/local/tmp/test.sh > /dev/null 2>&1 &"
and it doesn't work. It says permission denied on /data/local/tmp.
Is there any other EXT4 place on a non-rooted device that I can do this?
Well, I cd to /data/local/tmp and even submitting a 'ls' command inside Terminal Emulator doesn't work, it says permission denied, but when doing it from PC to Android using ADB it's fine. Is there any workaround for this? I want to be able to do this on the device itself.
Thanks
idoit said:
I have a non-rooted Android device with stock ROM 4.4.2 and I have the following test shell script:
Code:
adb push test.sh /data/local/tmp
adb shell "cd /data/local/tmp; chmod 755 test.sh"
adb.exe shell "sh /data/local/tmp/test.sh > /dev/null 2>&1 &"
If I run this over ADB from PC to my device, it simply works.
Now convert this to:
Code:
cp test.sh /data/local/tmp
cd /data/local/tmp; chmod 755 test.sh
/system/bin/sh /data/local/tmp/test.sh > /dev/null 2>&1 &"
and it doesn't work. It says permission denied on /data/local/tmp.
Is there any other EXT4 place on a non-rooted device that I can do this?
Well, I cd to /data/local/tmp and even submitting a 'ls' command inside Terminal Emulator doesn't work, it says permission denied, but when doing it from PC to Android using ADB it's fine. Is there any workaround for this? I want to be able to do this on the device itself.
Thanks
Click to expand...
Click to collapse
No there isnt, not if you try using /data partition. ADB can read this partition (and that too was added around android kitkat itself for purpose of adb backup
etc). So ADB can read this partition, but terminal emulator and such cannot.
Assuming that you have a great reason to simply not copy the sh file to user-usable internal memory, /system partition is the one place where you can copy things without actually having root (and even access them with terminal emulator, but not manipulate them), and this isn't that simple either. Rather, the method will be device dependent. For instance, if you have a phone like Nexus phones, simply download stock firmware, open/extract it depending on what format it is (img or tar), add your sh file and repack the firmware, then flash it into the phone. The firmware should be same as your current installed so your applications dont mess up. But this method is not only long (and messy if your device has integrity checks on firmware files), but also not possible on some phones (as far as I know).
You can also try copying the sh file with adb to /data/data/com.android.terminal. Then you should be able to access this with terminal emulator (since an app has permissions inside its own data folder). However I have not tested this method and I am not sure it will work.
Besides this, every app (including terminal emulator) runs in a sandbox and does not have access to anything except /system (read-only access), emulated user-storage and its own data inside /data/data/. So in phone itself, you cannot read the file unless you copy it to /system or user-memory. And this finally implies that except above two methods, there is no other way to copy file to some other place except user-memory and be able to read it using some app inside phone itself without rooting.
Thanks for your comprehensive reply. I resolved the problem. Yes, it's right, I can simply run the shell script without even moving it to /data/local/tmp... so now I can conveniently running it directly from my phone without having to turn a computer on and do it over ADB.
thankx

Huawei ascend p7 non rooted busybox linking read-only filesystem

Hello everyone,
I've updated my firmware to the latest version of my huawei ascend p7 making it impossible to root my phone. Now what I'm trying to do is get the non-rooted busybox working and replace the old links of commands with the ones in busybox. I'm using the following commands to do that:
First I export the path and such using:
Code:
export PATH=$PATH:/data/data/burrows.apps.busybox/app_busybox;
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/data/burrows.apps.busybox/app_bussybox
Now I'm able to use busybox in my terminal (only for that session, when I exit the terminal and restart it I would have to re-do the export path thing).
So... I wanted to replace all the links to those of busybox using the following command:
Code:
for c in `busybox --list`; do busybox ln -s busybox $c; done
This however outputs for each command for example cat:
Code:
ln: cat: Read-only file system
I've read somewhere that you can remount your system partition in order to make it writeable? Is this the way to do it? And if so what commands should I run? I have access through adb and a normal shell on the phone. Remember: it's non-rooted...
EDIT: seems like I can't remount /system without root priviledges...
Also I would like to be able to have a full colored bash shell with a bashrc (in which I can add the path to busybox aswell) if that's possible.
I'm using jackpal's android terminal emulator.
EDIT: I think I might've posted this on the wrong forum, if anyone is so kind as to move this to this forum: http://forum.xda-developers.com/ascend-p7/help I would greatly appreciate it. Altho I think this might be a general question rather then a model specific question.

Categories

Resources