Rooting using Ubuntu - LG Optimus G Pro

This is a how-to to get ATT LG Optimus Pro rooted USING THE FILES PROVIDED BY FIDDY619 AS IN HIS POST FOR THE REGULAR OPTIMUS G here http://forum.xda-developers.com/showthread.php?t=2181103.
So the files are not mine, but the how to is !!!!!!!!!!!!!! Since some people complained about how to use these files on Linux here it is.
I am reproducing my post here:
Thanks to fiddy619 (OP) for the script and files !!
After some failures, I got my ATT LG Optimus G Pro E980 - got today - on Ubuntu. Here is what I had to change to get the linux script Root.sh to work.
YOU MUST HAVE ADB INSTALLED AND WORKING. Your 'adb devices' command in terminal must return a device number or you will get device not found. In Ubuntu, adb is as easy as just downloading and extracting the files and adding the prprper path: see here
http://ubuntuforums.org/showthread.php?t=1918512.
When editing your path dont forget to
$ sudo gedit ~/.bashrc
Then add to the end of the file...after last line:
export PATH=${PATH}:${HOME}/android-sdk-linux/tools:${HOME}/android-sdk-linux/platform-tools
CHANGE the 'tools' and 'platform-tools' folder path to what your file location is. You MAY not need to do the android rules bit if your phone mounts.
FOR UBUNTU:
1. Download and extract files to your favorite location. You need to remember and know the path to the location.
2. The Root.sh uses adb to push the files 'busybox', 'su' and 'superuser.apk' to the phone. HOWEVER, the location of these files depends n where you saved them on the computer.
3. Open Root.sh.
4. Find "$ADB push busybox /data/local/tmp/busybox" and change the first 'busybox' (underlined) to proper location of your file on your Ubuntu. Thus, for me I changed the line as follows:
$ADB push /home/MyUserName/Downloads/Root-Universal-linux/busybox /data/local/tmp/busybox
5. Do this for the followng lines also, changing location of 'su' and 'Superuser.apk' based on where it is on you compu.
$ADB push su /system/xbin/su
$ADB push Superuser.apk /system/app/Superuser.apk
6. Click save to save script file.
7. Put phone in 'Charge Mode' and connect to computer.
8. To run the script open terminal and
$ sudo sh '''drag and drop Root.sh file here"
Hit Enter.
9. Adb will start and it MUST say device found for you to proceed.
10. The next four lines -after 'device found' that show are INSTRUCTIONS FOR YOU. So disconnect phone >>> Disable Usb debugging >>> Enable USB debugging>>> Plug phone back in. ESSENTIALLY DISCONNECT PHONE AND ENABLE DEBUGGING AND THEN RECONNECT.
11. It will do some stuff and show:
uid=0(root), gid=0(root)
"If uid=0(root), gid=0(root) is displayed"
"Press Enter to Continue once phone is running"
"If uid=0(root), gid=0(root) is NOT displayed"
"Press Ctrl+c to quit"
The stuff in quotes again are INSTRUCTIONS. The line before it is what you should see to follow instructions: So if "uid=0(root), gid=0(root)" shows before the instruction set, you are good to go and can press 'enter'.
12. It will push the require busybox/su/etc files and change permissions and reboot. IF YOU GET ANY ERROR HERE ABOUT 'su' file not found, or 'busybox' file not found, then check Root.sh for that you entere the location of the files properly in step 4.
13. After rebooting you should see supersu installed.
Bravo!!!!
HIT THE THANKS BUTTON !!!!

Related

Rooting the TF300T *without* downgrading (from .29) - the Mac instructions

These instructions are not solely my own and are adapted from miloj’s Windows based instructions found here:
http://developer.android.com/sdk/installing.html
Thank you miloj for the instructions!
This guide is intended to help noobs with rooting their TF300T device with a Mac. I am probably a half step above noob, so please don’t expect perfection.
Read this these instructions straight through, maybe even a couple of times before you begin to make sure you fully understand what you are doing.
I am not responsible for any bricked devices, malfunctions, etc. and most likely will not be able to problem solve much for you. Hopefully, the real geniuses here on XDA will jump in should you need extra help.
First off, make sure you have Android SDK and ADB installed. Follow these instructions skipping the Eclipse installation step (unless you plan on developing apps and such):
http://developer.android.com/sdk/installing.html
Save these files wherever makes sense to you and once done open up the folder containing adb in file explorer and leave open. This should be in the SDK>platform-tools folder.
Now for miloj’s instructions with some Mac specific extras and for sake of ease:
Download the debugfs and su binary files provided by miloj first from here:
http://db.tt/FBUNeVmo
Again, save these files where it makes sense to you and then open up the containing folder in file explorer and leave open.
Make sure “usb debugging” is turned on on your Asus TF300T by going to Settings>Developer options and check the USB debugging options.
Make sure you device is plugged into your Mac via usb cable. Now find out if our Mac recognizes your device.
Open up terminal from your utilities.
Organize your Terminal and folder containing adb on your workspace so you can easily access both. Click, hold, and drag the adp icon and drop it into the Terminal window. This will allow you to you immediately move into the adb command without having to type in the complete destination. Your line should end with “…/adb” now type in the command devices and hit return/enter.
NOTE – from here on out assume after every command you hit “return” or “enter”
It will look something like this:
Code:
…adb devices
the response should read:
List of devices attached
{serial number} devices
If nothing is listed, then you either didn’t activate USB debugging or your adb isn’t up to date, start again from the top.
If it showed your device, then lets move forward.
Now we have to push over the debugfs file and the su file (superuser). Make sure you can see Terminal and both open file explorer windows listed above all visible on your workspace.
Again, click, hold, drag the adb into Terminal and then complete the following commands by typing the command (in this case “push”) in between adb and the proper file and then typing in the location you want it pushed to on the device: (*note: dragging and dropping the “debugfs”file where it says “debugfs” – your file destination path name will be shown, not just debugfs)
Code:
adb push debugfs /data/local/
In the command above you would drag into Terminal the adb file then type push, drag in the debugfs file then type in “/data/local/” all with spaces in between. Every time you read in a “Code” section “adb” you are going to follow this procedure with the adb icon/file. Now, rinse and repeat moving forward.
Then this command (dragging and dropping the “su”file where it says “su” – your file destination path name will be shown, not just su)
Code:
adb push su /data/local/
now you have debugfs and su on your device.
You now have to have Terminal take control and run commands in your device by using this command:
Code:
adb shell
once in you will have a line starting with a “$” and you type in the following commands to gain root access: (type them exactly as written)
Code:
cd /data/local/
mv tmp tmp.back
ln -s /dev/block/mmcblk0p1 tmp
exit
The “exit” takes you back into your Mac, now reboot your device through adb:
Code:
adb reboot
WAIT UNTIL THE TF300T HAS BOOTED UP AGAIN!
Now get back into the device:
Code:
adb shell
Continue with the following commands after the “$” symbol:
Code:
cd /data/local
toolbox chmod 755 /data/local/debugfs
/data/local/debugfs -w /data/local/tmp
Now you’re going to run the debugfs files. Make sure you are writing these all in EXACTLY as written. All lines preceeded by “debugfs:” you will type in the following:
Code:
cd xbin
rm su
write /data/local/su su
set_inode_field su mode 0106755
set_inode_field su uid 0
set_inode_field su gid 0
quit
Now, back in to lines starting with “$” and run these:
Code:
rm /data/local/tmp
mv /data/local/tmp.back /data/local/tmp
exit
Now reboot:
Code:
adb reboot
WAIT UNTIL THE TF300T HAS BOOTED UP AGAIN
You are rooted! Congratulations!
Let’s double check and do some clean up:
Code:
adb shell
From the line “$” type these commands for double check:
Code:
/system/xbin/su
Now the line is a hash tag “#” and type
Code:
id
The Terminal response should read something like this:
id=0 (root) gid=0 (root) … and so forth
Clean up:
Code:
rm /data/local/su
rm /data/local/debugfs
Done with Terminal.
Now, open up the Play store and download the Superuser app immediately. Once it is installed, open the app and go into the settings. Under the heading “GENERAL” Tap the “Su binary v…” to check for updates and update the app.
You are now rooted, you have Superuser control.
Let me know how this works for you!!!
Credits: wolf849 for exploit, and miloj for commands.
Good stuf, just wait firsts feedbacks about this process :good:
Inserted in the Index for TF 300t
Guess i'm the only person who either owns a Mac here or has tried this but...
First time Terminal user and first time ASUS owner. Was a bit iffy doing it. Read through the TF300 board for weeks and was scared as sh#t to mess with this but...
it works!! Thank you so much. :good:
ngocdao said:
Guess i'm the only person who either owns a Mac here or has tried this but...
First time Terminal user and first time ASUS owner. Was a bit iffy doing it. Read through the TF300 board for weeks and was scared as sh#t to mess with this but...
it works!! Thank you so much. :good:
Click to expand...
Click to collapse
I'm glad it was easy for you! I am not a pro Terminal user by any stretch of the imagination! I am a first time ASUS owner as well, and have only rooted 2 phones and worked on rooting another (the phone ended up being software updated via Verizon to the point of unrootable that I could find or figure out). I am a Mac user and do not have easy access to a Windows PC and figured there were plenty of other Mac users noob to rooting. Apparently, that lists is you and me!!!
Thanks for the feedback, though! Congrats on your root!!
...too dificult for me,
Thanks.
Enviado desde mi ASUS Transformer Pad TF300T usando Tapatalk 2
dirator said:
...too dificult for me,
Thanks.
Enviado desde mi ASUS Transformer Pad TF300T usando Tapatalk 2
Click to expand...
Click to collapse
It sounds intimidating, I know, trust me when I say this is rather easy! The first time I rooted my phone I was quite worried! I read the instructions a few times and took my time though and it was really quite easy! Read the instructions a few times and you'll be alright. If you start to have trouble come back here or to this thread http://forum.xda-developers.com/showthread.php?t=1704209 and ask for answers.
not working as expected
Sorry to bother you with noob's problems.
I think I unlocked my TF300T ww Jelly Bean 4.2.1 allright.
I moved debugfs and su and other files to /data/local/ through bluetooth 'cause I wasn't able to do it in any other way.
The process worked fine up to here:
mv tmp tmp.back
Then I got this message:
[email protected]:/data/local $ mv tmp tmp.back
failed on 'tmp' - Permission denied
also, when pressing Power + Vol Down and then Vol Up to choose RCK it just dies (lying android with red triangle)

can not mount system in read-write mode using adb without recovery mode

I wanted to change my device model, so I copied build.prop from another mobile to my mobile. I am already rooted. But unfortunately I did not change the o.s. from gingerbread to froyo in build.prop ( I have android 2.2 FROYO) When I rebooted, there were many errors. It is now showing no sim card. Mobile network search gives error. Effectively, I can not use the mobile. Terminal emulator, X-plore etc. stopped working. Only Rom toolkit free version works and astro file manager works. Other programs are forcefully closed. Needles to say, I must replace new build.prop with new one.
Using adb I can only pull files but can not write as it is in read only mode.
adb root and adb remount works only if you are in recovery mode ? Y mobile does not have any custom recovery so when I boot in recovery mode it hangs.
Superuser has installed su in system\bin directory. But from adb shell I can use su also. It gives permission denied error. Hence I can not remount the system.
I have read similar threads and found that on some mobiles adb root or adb shell su works but on some not.
I am using Vista 32 bit with admin rights, still can not use root in adb.
Please tell me, how can I mount system read-write. I can not install root explore as google play and even internet is not working.
Please help.
maheshchavan said:
Using adb I can only pull files but can not write as it is in read only mode.
Click to expand...
Click to collapse
activate USB debugging then in console
Code:
adb shell
su
mount -o rw,remount /dev/block/mmcblk0p1 /system
adb push build.prop /system/build.prop
check where is your build.prop
ruscan.calin said:
activate USB debugging then in console
Code:
adb shell
su
mount -o rw,remount /dev/block/mmcblk0p1 /system
adb push build.prop /system/build.prop
check where is your build.prop
Click to expand...
Click to collapse
OMG ruscan.calin i COULD KISS YOU! I had tried to change my OG EVO 4G's buildprop file to another phone so that I could purchase & download an incompatible Google Play app. However after I restarted the phone wouldn't start! It would boot into my rooted HTC EVO 4G Android 2.3.3 and HTC Sense 2.1 but it would get stuck on the wallpaper with just the notification bar at the top and all buttons would be frozen. However I noticed when I plugged in my phone to my computer via usb the computer recognized it. I always keep my phone with USB debugging enabled so I thought I should be good right? I have spent the last 4 hours trying to install and setup adb with no real previous experience with it. I am familiar with dos from years ago and that helped me as it's basic procedure, commands, etc. Then I found out how to install the HTC drivers which I needed and then download the Android SDK with adb that's included which many guides show easily. I started the command prompt (cmd), typed my adb devices command and hurray it showed my phone! I connected and quickly navigated to the build.prop system folder! Luckily when I changed the file I made a bak backup and left it in the same folder. Now the main issue was figuring out how to change the naming of the files which I did via usual adb commands (mv build.prop.bak build.prop). But then to no avail I couldn't get it to write due to it being a system read only folder! Arg! Then I found your post on here, above, and typed it in simply leaving out the adb push portion and replacing that with the mv file command instead and first changing the name of the bad file and then replacing the bak file as the good copy! I exited back to the adb main and unplugged my phone. Moment of truth and man was everything flashing through my head at once! I booted up and YESSSSSSSSSSSSSS, it worked! I went back into root explorer and got rid of the offending leftovers and I've learned my lesson! I just don't want to think about what would have happened if I hadn't found this post. Thank you and if anyone else makes this hug mistake let me know and maybe I can help. Moral of the story don't mess with the build.prop or any system folder unless you know what you're doing! Thanks again!
Quick Guide to Fix Android "build.prop" Issues:
1. Find and download USB drivers for your phone by model or type (HTC EVO 4G's HTC Fastboot drivers): http://downloads.unrevoked.com/HTCDriver3.0.0.007.exe
2. Download and install Android SDK and choose adb: http://developer.android.com/sdk/index.html
Guide: http://htcevohacks.com/htc-evo-hacks/how-to-install-android-sdk-and-adb-drivers-for-htc-evo-4g/
3. Run a command prompt from the "c:/program files/android/android-sdk/platform-tools/" directory. I had to copy the command prompt to get it to open there but sometimes a right-click action will do it. The guide below will help just navigate down to "Using ADB" and skip the rest.
Guide: http://www.howtogeek.com/114667/how...y-default-move-almost-any-app-to-the-sd-card/
4. Once you open the command prompt and you're in the "c:/program files/android/android-sdk/platform-tools/" foler type "adb devices" and your device should appear. If it does move on to next step.
5. Then type adb shell and use the ls command to see directories. Then you'll need to navigate to the system folder by typing "cd system" and then type "ls" to look around in the directory (similar to "dir" in DOS). You should now see the bad build.prop file.
6. You'll need to rename the file or push a correct version. First you need to use the "adb shell" command again and then "su" and finally "mount -o rw,remount /dev/block/mmcblk0p1 /system" to make the directory writable (see ruscan.calin post above for additional info).
Note: I only had to rename my build.prop as I already had my old one in the same system folder. You may have to copy the bad build.prop to your computer, edit it and then push it back to the same system directory. These directions are only for renaming files in the same folder. For the info on how to copy the file to your computer and push it back to your phone go to step *10 below or use the guide below it.
7. I already had the bad build.prop in the system directory with my old one which I had named build.prop.bak. If you have this too simply rename by changing the name first of the bad file to anything by typing "mv build.prop build.prop.bad" or similar.
8. Next rename the build.prop.bak to build.prop by typing "mv build.prop.bak build.prop". Everything should go smoothly and move onto the next step.
9. Finally, If no error messages are found, simply type "adb reboot" or "adb shell reboot" (Depending which version of ADB you have). You should be done, your phone will reboot like normal (working, lol) and everything should be working again! YAY!
*10. To copy the build.prop to your phone type "adb pull /system/build.prop c:\" and the file should be placed in the main c:/ directory on your computer. Navigate to the root (c:/) directory and then right click and "open with" the "build.prop" file using a notepad or other file editor. Then use the text editor (Notepad, etc) to change back what you originally changed to mess everything up. There is tons of stuff on the net to let you know what to fill back in depending on your phone model/type. Or it's possible to get a previous version from an old Nandroid backup or similar. Save the changed text file and make sure its named the same "build.prop" and make sure it's still in the root directory (If you're having issues on this step or just want more insight check out the guides and threads below for more help).
Guide 1: http://androidforums.com/admire-all...p-computer-not-phone-using-root-explorer.html
Guide 2: http://www.modaco.com/topic/328943-quick-guide-to-modifying-buildprop-with-adb/
Guide 3: http://forums.androidcentral.com/sp...-replaced-build-prop-phone-wont-start-up.html
*11. We've already made the directory writable in step 6 so we simply need to push the file back to the phone. If any error message appear re-do step 6 to make writable again. Otherwise push the modified file back to the phone by typing "adb push c:\build.prop /system/". Back to step 9 above! Yay!
If anyone wants to help cleanup this quick guide or make any changes feel free. I just wanted something so that if anyone else has this issue they won't have to worry or search forever to find a solution. OMG it's 2:30AM, to bed... I ride! LOL
Enjoy,
5th :highfive:
THANK YOU!!! Totally saved me today.
One thing that I noticed. After pushing the correct build.prop, I had to fully power down, then turn back on my Razr for it to load up the fixed build.prop.
error message,Help please
Hello, when i am going to mount and change the permission i am getting constant error od device not found or sh:not found.
What to do?Help me please?
jigarpattani said:
Hello, when i am going to mount and change the permission i am getting constant error od device not found or sh:not found.
What to do?Help me please?
Click to expand...
Click to collapse
What step are you on? What phone do you have? More info please?
i am have problem whit my pantech flex i need to use the build.prop.bak but when i type the su it stay in blank do nothing any ideas pls help
ehy there hope someone can help me...i have an archos 97b platinum, messed up with build.prop. So i pulled out and restored but can't push in any way. I have a cwm installed, tablet rooted but i alwais got "permission denied" at push command. Other error is operation not permitted" if i try remount command from adb. i can do mount -o rw,remount /dev/block/mtdblock7 /system but after that push still give me permission denied.
any suggestion?
http://imgur.com/FDLp4fl
i open a 2nd cmd, give the mount -o rw,remount /dev/block/mtdblock7 /system , and system is now rw, but from the first cmd when i give "push build.prop /system (or /system/build.prop) it will always return me permission denied
help
dev.block
i want to view to dev/block using adb shell #
eg . what block is boot.img
what block is recovery.img
what block is system.img
what block is cache.ing
adb shell getprop mtd is not work . Pls Help Me & sent to mail [email protected]

(Guide) How to logcat, ADB, shell, etc

ADB:-
Android Debug Bridge
Very useful program made itself by Google for Programmers and developers. Its based on command line and basically communicates with your Android to respond to certain commands. There is vast amount of knowledge about adb but its most useful commands limit to getting:-
Logcat:-
A real time log of what is happening in background of our devices. It is really useful for developers to see which component has malfunctioned and helps to narrow down their search for what failed and what needs to be fixed. Several times users are asked to give logcats of their devices which are giving errors. We will go in detail that how to get logcats in every and easiest way possible.
App Installation and Management:-
adb proves really handy if you want to install apks directly from your PC or want to batch install or delete them.
Shell Execution:-
You must have heard of Terminal Emulator. It is an app for android to execute shell commands(linux commands) which are basically present as applets in /system/bin, /system/sbin or /system/xbin(in our case) folders. A very imporant applet called busybox is installed there mainly used for execution of basic commands during root browsing or ROM installation. Many times updater script of ROMs use busybox commands to install it. Well, these commands can be initiated from your device too but they can be initiated from adb also making it easy for programmers.
Pushing and Pulling:-
Most used commands of adb. adb makes it a piece of cake for new device developers to get an ideo of structure and basic knowledge of devices by pulling command. We can pull out i.e copy any files or folders from our devices to our PC, even the root directories without rooting the devices. It help rooters and ROM chefs of new devices to get an idea and implement their mods on them. Pushing is also very useful command. It copies your files and folders from PC to your device. Very useful in pushing some /system apps and other things
Remounting and setting permissions
Basic commands:-
Of-course basic commands such as reooting and rebooting in recovery ode and download mode are supported.
Others:-
There are several other features of adb such as fastboot, aapt, etc
Setting up ADB
Pre Requirements:-
A little amount of brain
PC(This is a windows guide, if asked I will add linux and mac guide later)
Java Runtime environment or Java Developing kit
Your Device Drivers
An Android Device
Assuming you all these ready and working properly, we continue
If you are having trouble completing Pre-Requisites, there are several guides featuring them too
Start
1. First Download Android SDK. Roughly about 70 MB
2. There may be any compressed zip file or exe file
If zip file, then extract it to C:\android-sdk
If exe file then double click on it and install it in C:\ Drive(or any other drive you want)
3. Now to get adb and other tools, you need to download 'Platform Tools'
To download them, go to the android-sdk folder and double click on SDK Manager
It will ask you which package to download? However, it is your choice which package to Download, but here, we will only talk about platform
Tools. So, simply tick on Platform Tools and click on install. Once you have done it. Go to the platform-tools folder in the directory where you installed android-sdk. You will find several files there like adb, fastboot, aapt, etc
4. Now, you can backup the whole folder of android-sdk to any external storage that will make you not download package
again if you want to. You can have it placed in any computer and run it as it does not require registry to work
5. Now, you are just one step away from using adb. Next step is SKIPPING SETTING ENVIRONMENT VARIABLE
Many guides on internet say that it is to be done for making it easy for users and if you have some basic knowledge of Command Prompt,
you will know that to execute any application with command prompt, you first need to change the directory to the one where application is
placed. And to skip changing the directories every time you open CMD, you need to put that application is environment variable. Howeve, we will not do so.
6. Type cmd in the search bar. Copy cmd.exe from there. Go to the directory where you have installed android-sdk. Go to platform-tools folder. Paste cmd there, right click on it and in the settings, select Run as Administrator.
7. You are done. Now what to do in it?
ADB Commands
Type adb in command prompt. And several commands will show up on your screen. It is very difficult to analyse these all commands, so we will only talk about most used and important commands
Connect your device via USB cable
And open the CMD in platform-tools folder(Make a shortcut of it on desktop). And type the suitable commands
Code:
adb devices
Will show the list of devices attached to the PC andtheir serial numbers. If this shows up correctly on your PC, then it means that everything is fine for continuing.
Logcat
Code:
adb logcat
It will display the real time log of your device
Best time to do it is when your device boots up
Now, many users ask me how to copy the logcat and upload it from CMD
There are several methods:-
1. Right click on the Title Bar of Command Prompt. Hover the cursor over edit and select mark. Select all the things you want to copy and then click enter. All the things will be copied to clipboard.
2. This is the correct way of getting logcat saved.
Code:
adb logcat > logcat.txt
This command will create a logcat.txt document in platform-tools folder with the complete logcat of the device. Ofcourse you can type any name instead of logcat.txt
3. I prefer taking logcat this way as it neatly compiles logs of different time
Code:
adb logcat -v long > logcat.txt
This is a very nice way to get logcat.
Installing Apps
Code:
adb install %PATH OF APK%
This will install an app on your Android
For example, if my app AreeB.apk is in G:\ drive (G:\AreeB.apk)
Then I will type
Code:
adb install G:\AreeB.apk
Be sure your apk is not in a folder that has space in its name, else the command will break at space bar.
For eg:-
G:\Program Files\AreeB.apk
Mounting
However, I never found any problem in tweaking with system files with adb, but some users said that they couldn't do it, so the problem was that their system partition was mounted as Read Only(R/O)
So, it is necessary now to tell how to mount system partition as Read Write(R/W)
Code:
adb remount
It is easiest way to do so, if it does not work then
There is another method that we will discuss in ADB Shell commands section
Pushing and Pulling
For pushing,
Type
Code:
adb push %PATH TO BE PUSHED% %PATH WHERE TO BE PUSHED%
Suppose I have an app named SystemUI.apk(PATH = G:\SystemUI.apk) which I want to push in /system/app/ on my android(or in other words, install an app as a system app). Then I would type
Code:
adb push G:\SystemUI.apk /system/app/
More examples
G:\Dance.txt file to be pushed in Dance folder in sdcard
Code:
adb push G:\Dance.txt /sdcard/Dance/
OR
Code:
adb push G:\Dance.txt /mnt/sdcard/Dance/
G:\Movies folder to be transferred in SDCARD in Videos Folder
Code:
adb push G:\Movies /sdcard/Videos/
G:\system\framework\framework-res.apk to be pushed in /system/framework/
Code:
adb push G:\system\framework\framework-res.apk /system/framework/
For pulling,
push command replaces with pull and paths are swapped
Code:
adb pull %PATH TO BE PULLED FROM% %PATH TO PLACE PULLED FILE%
Example,
All system apps are to be pulled to G:\ROM\system\app
Code:
adb pull /system/app G:\ROM\system\app\
build.prop to be extracted to desktop
Code:
adb pull /system/build.prop C:\Users\Areeb\Desktop\
However, if a folder is in platform-tools folder, you don't need to type full path
Suppose if I type
Code:
adb pull /system/ system
Then a folder named system will be created inside platform-tools with all the files in system in it
If a file is in platform-tools folder, then also no need to type full path
For example,
There is an app name DeskClock.apk in this folder then, to push it to /system/app, type
Code:
adb push DeskClock.apk /system/app/
ADB Shell Commands
This mode of adb allows you to execute linux shell commands from your PC
These commands can aldo be executed through the mobile using Terminal Emulator
To initiate shell mode
Type
Code:
adb shell
You will get an prompt like this
sh-3.2#
Now you are in shell mode
adb commands won't work here and a new set of commands will work here. But we will only go in a little detail here.
Assuming you are in adb shell mode, I will only type commands that will work on shell. Note:- These commands won't work if you type them alone on cmd. But, these command will directly work on your mobile's Terminal Emulator
As these commands can also work on mobile, I am going to tell you a way of taking logcat on mobile
Type
Code:
logcat
You will see log of your device
To save this
Type
Code:
logcat > /sdcard/log.txt
A file named log.txt will be generated in sdcard
Uninstalling Applications
Code:
cd /data/app
This will change the directory to /data/app
Code:
ls
This will show the list of files in there
Suppose, there is an app named com.opera.browser (Opera Mobile) you want to uninstall it
Type
Code:
rm -r com.opera.browser
This will uninstall the app
Mounting Command:-
Code:
mount -o rw,remount system /system/
Miscellanous commands:-
su: Initiates root request
du: Shows files, folders and size
date: Shows todays date
surfaceflinger: Shows your bootanimation (Tested on GB)
grep: Used to search through text files
chmod: Sets permission to files
sh: Initiates shell mode
echo: Displays the text you wrote with the command. Analogous to PRINT command on QBasic
Forgot next ones, will write later
Credits
Google: For Android and several searchings
Samsung: For Galaxy Ace s5830I
Broadcom: For their Open Sourceness
XDA Forums : For the precious knowledge
My Uncle: For gifting me this Phone
My Teachers: For teaching me English(I would not be here without them)
You: For future Thanks
Till now, thats it, will add some more things later
If any problem, I will add it too
Suggestion? They are welcome
Nice thread , every thing is very clearly stated.
Thx, Nice guide.
I suggest to change the 'remount' command in:
mount -o remount,rw /system
As the effect is the same and it works universally (at least, should)
Sent from my GT-5660 using xda app-developers app
ItachiSama said:
I suggest to change the 'remount' command in:
mount -o remount,rw /system
As the effect is the same and it works universally (at least, should)
Sent from my GT-5660 using xda app-developers app
Click to expand...
Click to collapse
I use the command you mentioned every time. Thanks for reminding. I can't remember why I wrote that command there!

[ADB GUIDE] How to use ADB. (Noob edition)

ADB
Android Debug Bridge
Very useful program made itself by Google for Programmers and developers. Its based on command line and basically communicates with your Android to respond to certain commands. There is vast amount of knowledge about adb but its most useful commands limit to getting:-
Logcat:-
A real time log of what is happening in background of our devices. It is really useful for developers to see which component has malfunctioned and helps to narrow down their search for what failed and what needs to be fixed. Several times users are asked to give logcats of their devices which are giving errors. We will go in detail that how to get logcats in every and easiest way possible.
App Installation and Management:-
adb proves really handy if you want to install apks directly from your PC or want to batch install or delete them.
Shell Execution:-
You must have heard of Terminal Emulator. It is an app for android to execute shell commands(linux commands) which are basically present as applets in /system/bin, /system/sbin or /system/xbin(in our case) folders. A very imporant applet called busybox is installed there mainly used for execution of basic commands during root browsing or ROM installation. Many times updater script of ROMs use busybox commands to install it. Well, these commands can be initiated from your device too but they can be initiated from adb also making it easy for programmers.
Pushing and Pulling:-
Most used commands of adb. adb makes it a piece of cake for new device developers to get an ideo of structure and basic knowledge of devices by pulling command. We can pull out i.e copy any files or folders from our devices to our PC, even the root directories without rooting the devices. It help rooters and ROM chefs of new devices to get an idea and implement their mods on them. Pushing is also very useful command. It copies your files and folders from PC to your device. Very useful in pushing some /system apps and other things
Remounting and setting permissions
Basic commands:-
Of-course basic commands such as reooting and rebooting in recovery ode and download mode are supported.
Others:-
There are several other features of adb such as fastboot, aapt, etc
Setting up ADB
Pre Requirements:-
A little amount of brain
PC(This is a windows guide, if asked I will add linux and mac guide later)
Java Runtime environment or Java Developing kit
Your Device Drivers
An Android Device
USB Debugging MUST be turned ON in the device for ADB to see it & Developer options is hidden in Android 4.2 and
above, Hitting Build number 10 times in
About Phone/Tablet reveals the menu (Thanks lilHermit for reminding me to add it)
Assuming you all these ready and working properly, we continue
If you are having trouble completing Pre-Requisites, there are several guides featuring them too
Start
1. First Download Android SDK. Roughly about 70 MB
2. There may be any compressed zip file or exe file
If zip file, then extract it to C:\android-sdk
If exe file then double click on it and install it in C:\ Drive(or any other drive you want)
3. Now to get adb and other tools, you need to download 'Platform Tools'
To download them, go to the android-sdk folder and double click on SDK Manager
It will ask you which package to download? However, it is your choice which package to Download, but here, we will only talk about platform
Tools. So, simply tick on Platform Tools and click on install. Once you have done it. Go to the platform-tools folder in the directory where you installed android-sdk. You will find several files there like adb, fastboot, aapt, etc
4. Now, you can backup the whole folder of android-sdk to any external storage that will make you not download package
again if you want to. You can have it placed in any computer and run it as it does not require registry to work
5. Now, you are just one step away from using adb. Next step is SKIPPING SETTING ENVIRONMENT VARIABLE (If you however want to set environment variables.)
We can easily append the sdk platform-tools and tools folder to your systems environmental path variable directly from command line(cmd) by simply issuing one command and performing a system reboot:
Code:
SETX PATH "%PATH%;SDK_Install_Path\platform-tools;SDK_Install_Path\android-sdk-windows\tools" -m
Just replace the "SDK_Install_Path" in the above with the proper path of your SDK installation. Example: C:\android-sdk-windows
Many guides on internet say that it is to be done for making it easy for users and if you have some basic knowledge of Command Prompt,
you will know that to execute any application with command prompt, you first need to change the directory to the one where application is
placed. And to skip changing the directories every time you open CMD, you need to put that application is environment variable. Howeve, we will not do so.
6. Type cmd in the search bar. Copy cmd.exe from there. Go to the directory where you have installed android-sdk. Go to platform-tools folder. Paste cmd there, right click on it and in the settings, select Run as Administrator.
7. You are done. Now what to do in it?
ADB Commands
Type adb in command prompt. And several commands will show up on your screen. It is very difficult to analyse these all commands, so we will only talk about most used and important commands
Connect your device via USB cable
And open the CMD in platform-tools folder(Make a shortcut of it on desktop). And type the suitable commands
Code:
adb devices
Will show the list of devices attached to the PC andtheir serial numbers. If this shows up correctly on your PC, then it means that everything is fine for continuing.
Logcat
Code:
adb logcat
It will display the real time log of your device
Best time to do it is when your device boots up
Now, many users ask me how to copy the logcat and upload it from CMD
There are several methods:-
1. Right click on the Title Bar of Command Prompt. Hover the cursor over edit and select mark. Select all the things you want to copy and then click enter. All the things will be copied to clipboard.
2. This is the correct way of getting logcat saved.
Code:
adb logcat > logcat.txt
This command will create a logcat.txt document in platform-tools folder with the complete logcat of the device. Ofcourse you can type any name instead of logcat.txt
3. I prefer taking logcat this way as it neatly compiles logs of different time
Code:
adb logcat -v long > logcat.txt
This is a very nice way to get logcat.
Installing Apps
Code:
adb install %PATH OF APK%
This will install an app on your Android
For example, if my app AreeB.apk is in G:\ drive (G:\AreeB.apk)
Then I will type
Code:
adb install G:\AreeB.apk
Be sure your apk is not in a folder that has space in its name, else the command will break at space bar.
For eg:-
G:\Program Files\AreeB.apk
Note:
If you have spaces in path of apk, you can execute the command without breakage if you include the path inside quotes. (Thanks to etcman)
Eg:-
Code:
adb install "G:\Program Files\AreeB.apk"
Mounting
However, I never found any problem in tweaking with system files with adb, but some users said that they couldn't do it, so the problem was that their system partition was mounted as Read Only(R/O)
So, it is necessary now to tell how to mount system partition as Read Write(R/W)
Code:
adb remount
It is easiest way to do so, if it does not work then
There is another method that we will discuss in ADB Shell commands section
Pushing and Pulling
For pushing,
Type
Code:
adb push %PATH TO BE PUSHED% %PATH WHERE TO BE PUSHED%
Suppose I have an app named SystemUI.apk(PATH = G:\SystemUI.apk) which I want to push in /system/app/ on my android(or in other words, install an app as a system app). Then I would type
Code:
adb push G:\SystemUI.apk /system/app/
More examples
G:\Dance.txt file to be pushed in Dance folder in sdcard
Code:
adb push G:\Dance.txt /sdcard/Dance/
OR
Code:
adb push G:\Dance.txt /mnt/sdcard/Dance/
G:\Movies folder to be transferred in SDCARD in Videos Folder
Code:
adb push G:\Movies /sdcard/Videos/
G:\system\framework\framework-res.apk to be pushed in /system/framework/
Code:
adb push G:\system\framework\framework-res.apk /system/framework/
For pulling,
push command replaces with pull and paths are swapped
Code:
adb pull %PATH TO BE PULLED FROM% %PATH TO PLACE PULLED FILE%
Example,
All system apps are to be pulled to G:\ROM\system\app
Code:
adb pull /system/app G:\ROM\system\app\
build.prop to be extracted to desktop
Code:
adb pull /system/build.prop C:\Users\Areeb\Desktop\
However, if a folder is in platform-tools folder, you don't need to type full path
Suppose if I type
Code:
adb pull /system/ system
Then a folder named system will be created inside platform-tools with all the files in system in it
If a file is in platform-tools folder, then also no need to type full path
For example,
There is an app name DeskClock.apk in this folder then, to push it to /system/app, type
Code:
adb push DeskClock.apk /system/app/
ADB Shell Commands
This mode of adb allows you to execute linux shell commands from your PC
These commands can aldo be executed through the mobile using Terminal Emulator
To initiate shell mode
Type
Code:
adb shell
You will get an prompt like this
sh-3.2#
Now you are in shell mode
adb commands won't work here and a new set of commands will work here. But we will only go in a little detail here.
Assuming you are in adb shell mode, I will only type commands that will work on shell. Note:- These commands won't work if you type them alone on cmd. But, these command will directly work on your mobile's Terminal Emulator
As these commands can also work on mobile, I am going to tell you a way of taking logcat on mobile
Type
Code:
logcat
You will see log of your device
To save this
Type
Code:
logcat > /sdcard/log.txt
A file named log.txt will be generated in sdcard
Uninstalling Applications
Code:
cd /data/app
This will change the directory to /data/app
Code:
ls
This will show the list of files in there
Suppose, there is an app named com.opera.browser (Opera Mobile) you want to uninstall it
Type
Code:
rm -r com.opera.browser
This will uninstall the app
Mounting Command:-
Code:
mount -o rw,remount /dev/block/mtdblock3 /system
Miscellanous commands:-
su: Initiates root request
du: Shows file foldrs and size
date: Shows todays date
ls: Shows list of directory
cd: Changes working directory
rm: Removes the file
logcat: Displays logcat
mount: Mounts the partition
busybox: Busybox Applets
Forgot next ones, will write later
All credits go to
iamareebjamal
For writing this up.

after OSX Sierra upgrade - no ADB and Android File Xfer

in updating my OS to Sierra I had issues with both adb/fastboot (Terminal) and AFT working ....... at all. AirDroid worked fine.
When I plugged my G4 into my MBA, the G4 responded (ding) like it saw the Mac, but the Mac was listless.
I did the usual toggling of Dev mode and USB debug. Restarting the MBA and/or the G4. Nada.
I uninstalled Mac (PC) drivers, that I guess came over with Migration asst, using the uninstall side of LGMobileMacDriver_v5.2.
That woke up AFT, but adb was still command not found.
This is what I did to wake adb/fastboot.
1. In Terminal, go to your home folder.
cd ~/
2. Open and edit .bash_profile file
$ open -e .bash_profile
2a. If you don’t have .bash_profile file in your computer path, then create one. That should leave you ready to edit .bash_profile file
But if not, enter below command to create a new file. Once created follow Step-2.
touch .bash_profile
3. Save the below line)
export PATH=${PATH}:/ (d&d your adb/fastboot folder)
4. Refresh the file using below command
$ source .bash_profile
If that fails
$ echo $PATH
Then
adb devices
test: adb reboot bootloader
and
adb reboot recovery if you have installed on on your G4.

Categories

Resources