simple question (adb) - Android Software/Hacking General [Developers Only]

If I want to copy and replace a file in system folder via adb, do I need to root my phone or does adb temporarily root my phone when connected?

i don't know. the only way it would work is if you mount system as read/write first. try that and see what it says. i assume you need to be rooted though since you need superuser permissions. check the adb website for proper commands cuz you might have to open up a shell and such first blah blah blah lol.

Thanks for reply, any else have an idea?

root is a MUST !

You must have root/superuser permissions to have read/write access to your phones system folder.
Sent from my Hero that never dies! ;D

Related

Having some permissions issues with my ADB and Terminal

Hello everyone. I have been working with android for a 6 months now and still cannot figure out what im doing wrong to get my permissions to work correctly. I have installed ADB and successfully rooted my MT3G Slide. I have been trying lately to figure out why i cannot manually configure A2SD. I have gone through both ADB Shell and Terminal under Su to try to mkdir /system/apps but it will give me a problem like my system is not allowing me to rewrite or its copy protected. I have tried to remount and it claims its successful. Another symptom i experience is not being able functionally use the rom manager or restart in clockwork recovery after i have flashed a rom. I always have to wipe the devices before i can loop hack back into clockwork mode. I have tried to fix permissions and restart in recovery through rom manager and it just brings up a question mark ontop of an image of a phone. I have been trying most recently to move a file through terminal to another name and replace the old with a new of the same name. It says the directory is not empty when i try to modify this file. So Anyone think they might know a solutions to these issues or hopefully all of them in one simple problem i cant seem to figure out.
download & install 'root explorer' for your phone from the android market (or your Pc, and put it on your phone) , grant it superuser permissions from superuser on your phone, open it up, and there's an option to make the phones memory R/W. (Its R/O as default which may be why your having permission issues)
Saying that Im yet to figure out adb's permissions fully..
Be careful with root explorer though, its a very intrusive programme which can screw up everything
Root explorer cost money... is there another program that allows me the same option. I have been using astro file manager, any way to do it on that one?

Motorola backflip detailed root tutorial

I AM POSTING THIS BECAUSE I HAD A VERY HARD TIME ROOTING MY BACKFLIP BECAUSE OF SO MANY DIFFERENT POSTS AND DOWNLOADS THAT EITHER DONT WORK OR JUST WRONG TRYING TO USE WAYS FROM OTHER ANDROIDS SO AS I WENT THROUGH WITH FINDING THINGS THAT WORKED I PUT IN A LOG SO I ALWAYS HAD IT AND NOW IM SHARING IT NOTE I HAVE 2.1 ON MY BACKFLIP AND THATS IT WHAT THIS TUTORIAL IS FOR! IF YOU DONT KNOW WHAT THAT IS YOU PROBABLY SHOULDNT BE TRYING THIS! <~YOUR FAIR WARNING~ BUT CLICK THE BOTTOM LEFT BUTTON ON THE TOUCHPAD (windows looking button) THEN SETTINGS / ABOUT PHONE AND YOU SHOULD SHE FIRMWARE VERSION. IT SHOULD SAY 2.1-update1....... GOT ALL THAT? GOOD! LETS DO THIS!
1st
We'll start with some downloading!(from PC) I assume you have the drivers to connect your phone to the computer. If not no worries you can get them from several hosts FREE including motorola's website. I have XP and the phone installed them automatically.. i tried on vista.. not so much they needed to be downloaded.
Anyway what i have done is compiled EVERYTHING YOU NEED TO ROOT in one zip file includes MY OWN PERSONAL SDK which in the tools folder are su.apk , superuser.apk , rageinthecage_arm5.bin , and install_root.sh (ALSO some apps Including the premium ROM Manager! but well get into that later!) HERE~>http://forum.xda-developers.com/showthread.php?p=9753200#post9753200 MUST ROOT 1ST!!
SO.. the drivers and this one zip file and the drivers are the only thing you need to download on your PC (UNLESS YOU DONT HAVE WINZIP OR SOMETHING OF SORT!)
zip file is here ~~> http://www.uploading.com/files/31fa2c2f/android.zipx/ ( just copy and paste to your preferred browser! as a new user to this forum i cant post outside links!) (if you use another SDK than one i have provided this tutorial you will not have everything you need... there will be 4 files and the command prompt missing in the tools folder!)
2nd
Now with the folder unzipped and the drivers installed open the folder that says Android SDK or somthing like that! inside you will see a folder that says tools. OPEN IT!
There will be a icon that is black and says CMD open it and run it. (it's system32 but its already directed to your sdk tools to save you the hassle (your welcome )
Meanwhile connect your phone to PC via USB and before doing anything go to settings/applications/development/ and check usb debugging and make sure its is on. (you should see the triangle with ! inside it on your notifications bar)
(THIS IS VERY IMPORTANT!)
Now in your notifications bar select USB connected and select CHARGE ONLY! (also VERY important)
Back to the System32 on your PC.
type in the command "adb devices" (NO QUOTES DUH!)
it will probably say daemon not running starting daemon then a serial # should show up under connected devices. Weather it says all that or not the serial number MUST be listed or you are not connected to the adb
If you have had no problems with this so far then this should all flow together very nicely from here out!
3rd
Now that we are connected via adb you will need to rum some commands listed here IN THIS ORDER!!! (just copy them from here one at a time, right click the cmd box and select paste, and press enter... ctrl v does not work in system32!(atleast not mine!) you should get very little feedback with each command! should just repeat what you typed.... if you got 2 pages of feedback thats an error! but if u copy and paste like suggested im sure this will be as smooth as butter!
commands =
adb push Superuser.apk /sdcard/Superuser.apk
adb push su /sdcard/su
adb push rageagainstthecage-arm5.bin /data/local/tmp/rageagainstthecage-arm5.bin
adb push install-root.sh /data/local/tmp/install-root.sh
now with proper feedback move to these commands (in order)
adb shell <~ this should change your command prompt from the tools location to a money sign "$"
cd /data/local/tmp
chmod 0755 rageagainstthecage-arm5.bin
chmod 0755 install-root.sh
NOW AS LONG AS YOU HAVE NOT GOT ANY DENIALS OR ERRORS IN THIS PROCESS WERE GOOD TO GO!!
4th BACK TO THE PHONE!
What we need to do now is go to android market and search for /download connectbot. ITS FREE!!
Once installed on phone open it and and where it asks for host click where you see SSH and change it to Local. put what ever host name your heart desires (i used my 1st name "Josh", IT DOESNT MATTER!) now hit enter!
This should've taken you to a cmd prompt similar to system32
5th AND FINAL STEP!
more commands YAY!!! now OBVIOUSLY we can't copy from PC and Paste to ConnectBot (WHAT A SHAME!) you must type these correctly or it WILL NOT WORK!! SOOOO LETS MAKE SURE WE PAY ATTENTION AND GET OUR SPACES, FORWARD, AND BACK SLASHES CORRECT!!!! THIS IS WHAT GAVE ME THE MOST TROUBLE AND NOW THAT I HAVE MADE THIS CLEAR I DONT EXPECT ANY HATE MAIL OR ANY ONE KNOCKING MY SKILLS BECAUSE YOU, YOU, AND YOU, OH AND DID I MENTION YOU!!! TYPED IT WRONG
READY?? OK! LETS DO THIS!
cd /data/local/tmp
./rageagainstthecage-arm5.bin
your phone will go into a prompt and you MUST wait until you see
"forked **** childs" (this could take a moment) the **** will be a number once this happens close the terminal
Now reopen the terminal and it should force close the 1st time and boot just fine the 2nd! now type
/data/local/tmp/install-root.sh
and if no errors occur, like magic! YOU ROOTED! now power off the phone and back on return to connectbot and type
su the $ should become a # and it along with other apps that require root will ask for superuser permissions. just grant permission and GO!
I HOPE THIS WAS HELPFUL TO YOU AND ENJOY YOUR NEW ROOTED PHONE!
help
I cannot get this line load:
adb push rageagainstthecage-arm5.bin /data/local/tmp/rageagainstthecage-arm5.bin
cannot stat 'rageagainstthecage-arm5.bin' : No such file or directory
well heres a few things i can think of...
if you are manually typing the codes maybe you missed the space before the first backslash,if copy and pasting try typing manually, if this does not work, double check that the rageagainstthecage-arm5.bin is showing in your tools directory and is also showing that its 6kb in size if its not there maybe re download the sdk or just search for the BIN file elsewhere MEANWHILE i will download the sdk i provided and make sure its not something i did and if so ill correct it. Please let me know if this helps or not
yea i just redownloaded it myself and it worked just fine, i honestly think its a typo. (no offense. i did it bout 1000 times myself on the SAME file and was ready to throw my phone computer and everything in a lake lol) just try alternate ways of typing it, some also dont know that you cant use ctrl-v to paste in system32, just right click and select paste. if no dice im very sorry... just try to redownload the sdk or locate rageagainstthecage-arm5.bin elsewhere and just copy and paste it to your sdk's tools directory replacing the old or abscent, the successful pushes however will remain where they were pushed to, no need to do that again.
I have 2.1 update 1. I rooted it no problem with z4root... Not sure why you have to go through all that trouble with yours.
xdunlapx said:
I have 2.1 update 1. I rooted it no problem with z4root... Not sure why you have to go through all that trouble with yours.
Click to expand...
Click to collapse
i personally knew nothing about rooting phones just got the idea from a friend who mentioned jailbreaking his iphone and i searched for hacks and all i found was a few tutorials like this which were all somewhat different and i tryed super1click and it failed so i just bounced back n forth until i put them together and got root successfully... never heard of or seen z4root in my searches but ill look into that next time i root. Thanx!
file is missing
How can I root my motorola backflip 1.5 to 2.1 on my iMac. I've been looking around but can't see to find a tutorial and when I do ask somewhere no one answers. Please Help thanks.
install windows on it and follow the instructions :3
So I everything went smooth until install-root.sh at the very end and I get a string of errors super long most ending with read only file system. I went through the tutorial twice to check for typos (still could of messed up but Im pretty sure I didnt). Also at the beginning for some reason install-root.sh was missing from your zip so I downloaded it else where. Could that of effected this process?
wait. My phone is apparently up to date but is only at firmware version 1.5. How do I go about that upgrade?
did the upgrade to 2.1 and still get read only errors at the very end.
same problem
nkemm2 said:
So I everything went smooth until install-root.sh at the very end and I get a string of errors super long most ending with read only file system. I went through the tutorial twice to check for typos (still could of messed up but Im pretty sure I didnt). Also at the beginning for some reason install-root.sh was missing from your zip so I downloaded it else where. Could that of effected this process?
Click to expand...
Click to collapse
I'm having the same problem.
Unable to locate su
Hello, I need some guidance as to what to do next. I'm at the step where I have to type in 'su' and receiving error: reloc_library[1244]: 707 cannot locate '_ZNK7android6Parcel15setDataPositionEj'...CANNOT LINK EXECUTABLE
I have going through the steps of rooting twice and unable to add su rights. Thank you in advance for any assistance.
sithlorddevious said:
Hello, I need some guidance as to what to do next. I'm at the step where I have to type in 'su' and receiving error: reloc_library[1244]: 707 cannot locate '_ZNK7android6Parcel15setDataPositionEj'...CANNOT LINK EXECUTABLE
I have going through the steps of rooting twice and unable to add su rights. Thank you in advance for any assistance.
Click to expand...
Click to collapse
Also having this same issue, has someone resolved this yet?
Problem
i don't know if the package was damaged when i downloaded it or if it is my computer but the folder with the files that you gave us to use for the rooting doesn't work,it marks a lot of errors when you extract the files and the only thing that it extracts are the folders only,non of the files are extracted. i was hoping to know if you have an undated link for the download or if you can give me a trick to extract it correctly.
I'm sorry I haven't been on for quite some time. At this point superoneclick should do it. I no longer have a backflip or the computer with the files I was using. I honestly believe the cheapo free up/download site I used may have corrupted the file. But at one time I completely deleted my adb and downloaded the one I posted and did a friends backflip in no time at all. I'm not sure why some are having problems and others aren't. I will see what I can find and maybe just find the original links to the files needed in the adb.
Sent from my LG-P925 using XDA App
I used 7 zip to extract. No clue if it makes a difference. And as far as downloading the missing files elsewhere as Long as they are the correct files for your operating system it should make no difference and I would suggest looking through xda and other forums as well for anything that's missing in my adb. Or anything missing from the tutorial
Sent from my LG-P925 using XDA App
cant get root
Ok I tried this method and the one on thetechguy.com and on both everything goes fine until the part were you have to type on the phones terminal cd /data/local/tmp ./rageagainstthecage-arm5.bin
Then I get an error message " can't cd /data/local/tmp ./rageagainstthecage-arm5.bin "
Only got to
I was only able to get to the rageagainstthecage-arm5.bin step. My computer will not let me download this and i have no idea how to let it slip through my security. All in all, I was getting to where I needed to be so I can update to gingerbread and I've come to a standstill again. Any other ways around this little snag? Please and Thank-you!
---------- Post added at 07:17 AM ---------- Previous post was at 07:12 AM ----------
nkemm2 said:
wait. My phone is apparently up to date but is only at firmware version 1.5. How do I go about that upgrade?
Click to expand...
Click to collapse
Manually. You can find it at the motorola site. I did it last year and now i'm trying to root mine so I can update to Gingerbread.

[Q] How to copy a /data file from unrooted Nexus S [I9020XXKD1]?

Hi there,
Is there a way to temporary root my Nexus S [I9020XXKD1] or alternatively a non-root way to access /data so that I can copy a file in and out? Essentially I want to be able to backup and restore some game saves
Most posts I've read basically have folks saying "Just root it", which is good advice to most but isn't right for me - I really don't want to have to wipe my phone and I'd also like to be able to dip my toe into rooting before taking a full leap. That, and aside from needing this one file in /data my phone works exactly as I'd like it to
I only need "su" access for a brief moment to copy off a file to and from /data. I set up the android sdk but ADB didn't work because of the protection of "production builds".
VISIONary seemed like the right kind of thing, but I don't believe it works for the Nexus S or recent firmware, so while temp rooting would be nice so would any solution that allows me to backup and restore some files in /data.
At the moment I am wondering if writing an apk of my own that copies/replaces this one file is the way to go - but that seems perversely long way around!
So any help/suggestions most appreciated
There is no temporary root for the Nexus S. You're either rooted, or you're not. However, if, perchance, you are on Android 2.3.2 or earlier, you might be able to root without wiping.
Without root, you cannot see the files in /data, but you can read/write the files directly if they have the proper permissions and you know the exact path/filenames. After poking around a bit, it seems that read & write permissions vary among apps. Most apps have full permissions reserved for the parent app. Some allow other apps/user to read some files, and read+write others. (The permissions being app-specific, if it can't be done by command line, I doubt it could be done by creating an app, either.)
So, what is the game? Perhaps I can do some exploring.
If you have the old bootloader (2.3.2 i think) you can boot a recovery without flashing. From you computer use "adb boot recovery.img" and boot clockwork recovery. From there you can mount and access the filysystems.
Sent from my Nexus S using XDA App
Maximilian Mary said:
There is no temporary root for the Nexus S. You're either rooted, or you're not. However, if, perchance, you are on Android 2.3.2 or earlier, you might be able to root without wiping.
Without root, you cannot see the files in /data, but you can read/write the files directly if they have the proper permissions and you know the exact path/filenames. After poking around a bit, it seems that read & write permissions vary among apps. Most apps have full permissions reserved for the parent app. Some allow other apps/user to read some files, and read+write others. (The permissions being app-specific, if it can't be done by command line, I doubt it could be done by creating an app, either.)
So, what is the game? Perhaps I can do some exploring.
Click to expand...
Click to collapse
Thanks I figured as much. The game is Dungeon Hunter 2 and essentially I am trying to implement a simple fix to make my save game work again (the fix is here: http://forum.xda-developers.com/showthread.php?t=1042675 a few posts down) but it requires root. So I do know the exact paths and filename.
Thank you for your helpful answer
Ok, I'm not having any luck here, and it's pissing me off. FYI, I don't have that game, so I'm testing it with Angry Birds. I can read and copy the file just fine, but I can't modify it without using root. The data file itself has read/write access, but the containing folder (files/) is read-only, so I can't overwrite the file after I've modified it. Since the file itself has r/w access, I wonder if it would work to modify the file directly, instead of using an outside program to modify it then overwriting it. (I'm a bit ignorant of the finer points of linux permissions.) This would require an app that would allow you to open and modify a file by typing the full path & filename, instead of just browsing the directory tree. You could also try < adb pull /data/data/com.gameloft.android.TBFV.GloftD2HP.ML/files/dh2_000.savegame dh2_000.savegame > (using the correct path, if that's not it). Then see if < adb push dh2_000.savegame /data/data/com.gameloft.android.TBFV.GloftD2HP.ML/files/dh2_000.savegame > works. The fact that you can copy the file out is promising, anyway. So even if you had to root, you could backup the file before rooting wipes everything, then fix it & back it up after you had root.
Btw, what version of Android are you on?
Edit: I think I'm getting somewhere. While you can't modify the file itself, you can modify the file contents. So something like this might work: < adb shell >
< more /sdcard/dh2_000.savegame > /data/data/com.gameloft.android.TBFV.GloftD2HP.ML/files/dh2_000.savegame >
So the next step is to get some help from someone who has the game and is rooted as to the exact path to the savegame file. Once we have that, I think we're golden. (Or, let me know if adb pull works with the path I guessed at.)
wow! Thank you for your help
In answer to your questions: my Nexus s is running 2.3.4 and you are correct about the file path (many other kind xda users died to bring us those paths ) is /data/data/com.gameloft.android.TB with the filename being dh2_000.savegame
I don't want to drive you to distraction! If I could back it up I probably would go ahead then and root the phone given how complexplaying with a non-rooted phone is!
I will try the adb pull method and let you know how I get on.
Thank you again for your help and for showing me why I probably do want to root!

[Q]Deleting preinstalled apps

I am trying to get rid of lots of bloatware that I don't want in my new unlocked Motorola Atrix hd phone. I have rooted the phone and got terminal emulator and su working. When I read around on the internet, there are posts describing to remount the /system/app for read/write, delete the apk and odex files and the remount again for read only.
My understanding is that root should be able to "rm" those files in "su" mode if you can see them. So why do we have to remount them before deleting and after? What does it do? What happens if I simply "rm" the apk and odex files in /system/app without remounting before or after, I mean if I am able to "rm"?
Thank you.
I believe the logic is that for security reasons the system/app partition is mounted in read-only mode by default. With root privileges, you can mount it as read/write and make changes such as removing apk files. When you're done editing, you should remount the /system/app partition as read-only, restoring it to its default state. If you don't, any process could theoretically make changes to the files in that partition which could damage your OS or apps.
So we remount the partition because we cannot delete them otherwise. That means if we are able to delete them without remounting, it is OK to do so. Correct?
I believe so. But just to be sure, I would strongly advice to make a nandroid backup before you delete any files.
skipperx said:
I am trying to get rid of lots of bloatware that I don't want in my new unlocked Motorola Atrix hd phone. I have rooted the phone and got terminal emulator and su working. When I read around on the internet, there are posts describing to remount the /system/app for read/write, delete the apk and odex files and the remount again for read only.
My understanding is that root should be able to "rm" those files in "su" mode if you can see them. So why do we have to remount them before deleting and after? What does it do? What happens if I simply "rm" the apk and odex files in /system/app without remounting before or after, I mean if I am able to "rm"?
Thank you.
Click to expand...
Click to collapse
Just use this app free from the Play Store: https://play.google.com/store/apps/details?id=com.jumobile.manager.systemapp
No messing around with Terminal and any commands.
I found out. I could not delete even as su and got a msg that it was read only. That's why we need to remount.
Or you can use Titanium Backup. TB has option to backup system app&data and then remove.
It's safer...
You can also freeze apps with TB. If something goes wrong, you can unfreeze it or do factory reset.

[Q] ADB Copy Fails - Help Please!

I am trying to get Chrome to come up in desktop mode permanently on my non-rooted Xperia Tablet Z. Multiple sources tell me that on an un-rooted device I need to use ADB to copy a file containing the line:
chrome --user-agent="Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1"
to the /data/local directory.
So I dropped that line into a file (called chrome-command-line) on the root of my c: drive and run ADB like so:
c:\Android-SDK\sdk\platform-tools>adb push /chrome-command-line /data/local/chrome-command-line
It immediately fails with the following message:
failed to copy '/chrome-command-line' to '/data/local/chrome-command-line': Permission denied
Any idea how I can perform this ADB copy operation without rooting?
Thanks! (bump)
Bump
Anyone, anyone, Bueller?
maypo said:
Anyone, anyone, Bueller?
Click to expand...
Click to collapse
anyone??? i need answer to this too!!
@maypo @doggmeister
You're getting the Permission Denied error because, very simply, you're not rooted. ADB can't access the /data/local directory without root, and will therefore give an error instead.
I don't know who told you that you can ADB push files to that directory without root, but they are mistaken.
NOOK!E said:
@maypo @doggmeister
You're getting the Permission Denied error because, very simply, you're not rooted. ADB can't access the /data/local directory without root, and will therefore give an error instead.
I don't know who told you that you can ADB push files to that directory without root, but they are mistaken.
Click to expand...
Click to collapse
Several guides online mentions it as a way to get permanent desktop mode in chrome on a non-rooted phone. And I just thinks its bloody mindnumbingly stupid why WE as the users can't decide what a browser should identify as....

Categories

Resources