[Q] Root Problem - adb Shell and Permisson Denied - Android Q&A, Help & Troubleshooting

Hi all,
I tried all root applications and scripts to make my rk30sdk device rooted. They were not working.
So i decided to make it with adb, istalled Android SDK and make platform-tools as a system variable.
So i can see my device with adb,
Code:
C:\android_sdk\sdk\platform-tools>adb devices
List of devices attached
LZXOJ5SDTF device
Aftet adb shell, i can took list of directories from device.
Code:
C:\Windows\System32>adb shell
[email protected]:/ $ ls
ls
acct
bcm4329_cybertan.hcd
bcm4329_samsung.hcd
bcm4329_usi.hcd
cache
charger
config
d
data
default.prop
dev
etc
init
init.goldfish.rc
init.rc
init.rk30board.rc
init.rk30board.usb.rc
init.trace.rc
init.usb.rc
initlogo19.rle
initlogo20.rle
mnt
proc
readahead_list.txt
res
rk30xxnand_ko.ko.3.0.36+
rk30xxnand_ko.ko.3.0.8+
root
sbin
storage
sys
system
ueventd.goldfish.rc
ueventd.rc
ueventd.rk30board.rc
vendor
But i can not copy su, pwd and other tools to correct folders. It gives me that Permission Denied. I know this means that the rk30sdk not rooted.
I can put su, pwd, Superuser.apk, busybox to an +rw directory in SD card, but i can not install Superuser.apk successfully, it says it can not find su file.
Could you please share your comments and ideas. I am using Win7 OS. But i tried it is same on MAC OS X.
Thanks.

Related

Marketplace installed Apps location? Can not find

Hi All,
I've been looking for the install location where MarketPlace installs apps?
Can someone help?
I can not find any apps I have installed in:
/system/app
/data
I have rooted my X10
Please help if you can
/data/app
/data/app-private
Well this may be "odd"..
In both of those locations.. They're empty.
I have installed about 12 marketplace apps.
Is this normal? :S
You're sure you're rooted then?
Code:
# cd /data/app
cd /data/app
# ls -l
ls -l
-rw-r--r-- system system 637063 2010-06-28 22:14 stericson.busybox.apk
-rw-r--r-- system system 4201344 2010-06-28 22:14 com.google.android.apps.maps.apk
-rw-r--r-- system system 823161 2010-06-28 22:14 com.dropbox.android.apk
...
I have root.
I am actually redoing all root steps again.
Is there a GUI file explorer that will let me see what is in /data/apps?
The basic one's show nothing.
..obviously you need a file explorer capable of escalating to root privileges first...

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

Using shell before mounting system partition

Hi, I'd like to ask a general question about device boot. I've made some changes in init.rc and I packed again boot.img. In particular, I've added a .sh script to ramdisk root directory.
The script is named mount_partitions.sh and it does just this task. However, boot.img needs a shell to execute it, but /system is not mounted yet, at that point. So, I need to add a shell to to ramdisk root directory so that init executable can run the .sh script.
Exactly, how I could add shell support in boot.img without mounting the system partition? Any ideas?
Solved
I've found a way to use a shell before mounting system partition. Essentially, it's possible to place a busybox binary (i.e. taken from /system/xbin directory located in another android phone with installed busybox) into ramdisk root directory of boot.img, giving it execute permission in init.rc by chmod command, after remounted ramdisk root directory in read-write mode (by mount command put always in init.rc). It could be also be needed to give execute permission to the shell script (always by chmod command).
Then, it's needed run the shell script by busybox ash command, putting it into init.rc. The line looks like as following:
Code:
exec /busybox ash /myscript.sh
Don't forget to put also a line for remounting ramdisk root directory in read-only mode, after ash shell finished to execute the script (always using mount command in init.rc).
Remember to use the following shebang at the beginning of the shell script:
Code:
#!/busybox sh
shouldn't the shebang end with "ash" instead of just "sh"?
it's just a sh script but it could be true.

Checking file permissions in ramdisk during device boot

Hi, I'd like to ask a general question about device boot. I've made some changes in init.rc and I packed again boot.img. While debugging, I would need to check permissions of some files in ramdisk root directory in order to see if they are accessible for reading and/or execution.
How could I get this info by adb during device boot before that /system partition is mounted? Any ideas?
Solved
I've found a way to perform this task. It's possible to use busybox ls command inside a shell script (placing busybox binary and shell script into ramdisk root directory of boot.img) and run the script by busybox ash command from init.rc, redirecting the output to a logfile. The command inside shell script should look like as the following:
Code:
/busybox ls -l / >> /path/to/my/logfile.txt 2>&1
(That way, stderr and stdout will be redirected to a log file, that can be pulled down by adb pull command)

extract-files.sh won't extract proprietaries from /system/bin

Ok so I'm trying to extract propritaries from my phone script starts and extract files but it won't extract files from /system/bin and /xbin while files from /system/lib are extracted without any problems, I checked permissions and they are same for those folders (755).
I checked for files and they are there, they exist on phone while adb states otherwise.
Note that I don't have root and don't have a good way to do that.
here is extract-files.sh and proprietary-files-mtk.txt
What I am understanding from this post is that you have a script to extract files from your /system/bin directory for your phone? Since you have adb, go to adb shell and type in whoami. If it says shell, then you're not root and can't proceed further. If it says root, then do mount | grep system. If it shows system is ro, then you need to remount system by using mount -o rw,remount /system and make sure doing mount | grep system shows rw. It should work then.
mohhaxs said:
What I am understanding from this post is that you have a script to extract files from your /system/bin directory for your phone? Since you have adb, go to adb shell and type in whoami. If it says shell, then you're not root and can't proceed further. If it says root, then do mount | grep system. If it shows system is ro, then you need to remount system by using mount -o rw,remount /system and make sure doing mount | grep system shows rw. It should work then.
Click to expand...
Click to collapse
Why would I need rw permission on /system/ when I just want to pull files from it, not to push, and also why then it works with /system/lib/ folder, both have 755 permisons, and pull from /lib/ folder works but not for /bin/ and /xbin/ ?
It doesn't say permission denied it says file does not exist which is false because file does exist.
Professor Woland said:
Why would I need rw permission on /system/ when I just want to pull files from it, not to push, and also why then it works with /system/lib/ folder, both have 755 permisons, and pull from /lib/ folder works but not for /bin/ and /xbin/ ?
It doesn't say permission denied it says file does not exist which is false because file does exist.
Click to expand...
Click to collapse
It's because of your phones security. Look at the following files from my phones /system/lib. You can see, they're root group and only root user can modify them or even take them off device. Which means, you need to be root user to make any modifications to them.
drwxr-xr-x 2 root root 4096 2008-12-31 10:00 soundfx
drwxr-xr-x 3 root root 4096 2008-12-31 10:00 ssl
lv7:/system/lib #
Going to /system/bin ...
lrwxr-xr-x 1 root shell 6 2008-12-31 10:00 xxd -> toybox
lrwxr-xr-x 1 root shell 6 2008-12-31 10:00 yes -> toybox
lv7:/system/bin #
The following files are part of root group but shell user. So if you do the command "whoami" and are shell user, you can change these files and extract them off your phone.
The permissions don't matter here, you need to be root user and have rw permission on system. If you can give me the code of your script, I can tell you what it is doing. If I were you, try using the command prompt and use the adb pull command and it will give you the permission denied error.
mohhaxs said:
It's because of your phones security. Look at the following files from my phones /system/lib. You can see, they're root group and only root user can modify them or even take them off device. Which means, you need to be root user to make any modifications to them.
drwxr-xr-x 2 root root 4096 2008-12-31 10:00 soundfx
drwxr-xr-x 3 root root 4096 2008-12-31 10:00 ssl
lv7:/system/lib #
Going to /system/bin ...
lrwxr-xr-x 1 root shell 6 2008-12-31 10:00 xxd -> toybox
lrwxr-xr-x 1 root shell 6 2008-12-31 10:00 yes -> toybox
lv7:/system/bin #
The following files are part of root group but shell user. So if you do the command "whoami" and are shell user, you can change these files and extract them off your phone.
The permissions don't matter here, you need to be root user and have rw permission on system. If you can give me the code of your script, I can tell you what it is doing. If I were you, try using the command prompt and use the adb pull command and it will give you the permission denied error.
Click to expand...
Click to collapse
I used adb pull and it gave me same error, "file does not exist".
Why would I need rw permission when I only want to read file not modify it.
I pulled whole bin folder and when pulled it has missing about 100 files every one I have needed was in that 100 files. However I give up and just copy files to sd card from total commander and transfered them via USB to PC

Categories

Resources