Rooting the Droid X - Simple Steps, With Notes
There
are a few good reasons to root your android phone: remove bloatware,
install special apps, if you are like me and are working on developing
apps and want to see what you are doing,or all of the above and then
some. I will not cover the pros and cons of rooting here, only
the process of doing so.
There are a lot of guides out there that will tell you how to root your Droid X, like this one, this one, this one and this one.
Unfortunately, not all situations are the same, and as these things go,
this process is not for the those who are unprepared for the
unexpected.
My guide here will attempt to outline
the steps to a successful root in a very simple fashion, pointing out
the areas where I made mistakes and combining the information I've
gathered from dozens of forum posts into one.
I don’t wish to take credit for the
work of others, so take a look at those forum posts above as
well. Those are all for slightly different situations: Android
2.1 - Which worked great for me the first time, One click – which I
never tried, fixing a broken root after update, and finally, for the
Droid 2 – which also works with Droid X on 2.2. The particular
method described here can be traced back to this guy as far as I can tell.
The
process is fairly similar in all of these and for other Android-based
phones as well, so even if the posts don’t specifically apply to you,
they are still good information in troubleshooting.
For our purposes here, we will assume
that you have access to a PC with XP or later, rooting the X and that
you are already running Android 2.2. If you are not already
running 2.2, get that update on your phone first (On the phone:
Settings –> About Phone –> System Updates.) I had to root
my phone twice, first when I got it, and then again after updating to
2.2, so you might want to save yourself the trouble.
If
you follow the steps below, be prepared to void your warranty and do so
at your own risk. Know what you are getting into and don't blame
me or anyone else if you screw something up. Remember rules #29
(Take responsibility for yourself) and #7 (Read the directions, even if
you don't follow them)
The Steps (Actual commands to type or menus to navigate are the pink bits):
1. On the Phone Update to Android 2.2. (Settings –> About Phone –> System Updates)
2. Do not connect your phone to the computer just yet. If you’ve already connected it, unplug it.
3. Download and install the Android SDK
Starter Kit. You actually don’t need the whole package, just one
tool called ADB.exe (and its support files) so when installing, unless
you are going to use them for your own developing, you can reject
installation all of the packages except
the Android SDK Tools. It might be worthwhile to install the USB
Drivers package as well, just in case. If you don’t reject the
packages you won’t use (There are lot of them, and they are large),
installation can take a VERY long time, so be aware. Install the
packages somewhere you can get at them with a command line, the default
is C:\AndroidSDK and should work fine.
4. Download and install the Motorola USB drivers.
You want the USB drivers, not the charging drivers. Do not
connect your phone to the computer until after the driver installation
is complete.
5. Download DoRoot for Windows
These are the real magic files, so take a moment for the folks that put
it together. Then, extract the zip file somewhere you can get at
it with the command line. For our purposes here, we will assume
C:\DoRoot
6. Connect
your phone to the computer. Make sure the phone is in PC mode,
rather than USB or charging mode. You can do this on the phone by
opening the USB Connection notification and choosing PC mode from the
menu.
7. Wait for
Windows to do its thing, connect the device and install the
drivers. If it doesn’t happen, try a different USB port. If
it still doesn’t happen, make sure USB debugging is OFF (See next
step).
8. On the Phone
after Windows has recognized the device, turn USB debugging ON.
If you came to this step because Windows wasn’t recognizing the phone,
then turn debugging off, unplug the phone, plug the phone back in, wait
for the drivers to install and then turn debugging back on. USB
Debugging can be found on the phone at: Settings –> Applications –> Development –> USB Debugging
9. On the Computer open
a command prompt. Navigate to where you saved the DoRoot
files. If you used the example in step 5, this is as simple as
the command: cd\DoRoot
10. Command Prompt By
default, the Android SDK isn’t integrated with Windows. You need
to tell your command prompt where to find the magic command ADB.
If you used the default C:\AndroidSDK, then the simplest way to do this
is to add the tools directory to your path with this command: PATH=%PATH%;C:\AndroidSDK\Tools
11. Command Prompt Verify that everything is working so far by issuing the following command: adb devices If
you have the right drivers, if your phone is properly connected, if adb
is working, and so on, you will see a message that says “List of
Devices Attached” and your phone’s serial number. If not, start
over. The good news is that you haven’t actually modified
anything on the phone yet, so nothing lost.
12. Now You Have a CHOICE: Choice 1. The
folks that put together that DoRoot package made a batch file that
finishes the process. In theory, you should now just be able to
issue the command doroot at
the command prompt, follow the on-screen instructions and you will be
done, then you can skip down to step 18 and/or the NOW WHAT?
section here. Choice 2. Unfortunately,
this batch did not work for me, so if you want to do it the long way in
order to be sure, proceed with the next step.
13. Windows Explorer The next step is to get the rooting files on the phone. The four files that need to go are all in the C:\DoRoot folder: su, busybox, Superuser.apk, rageagainstthecage-arm5.bin
Your phone should show up as a “Portable Device” under “Other” in My
Computer. Clicking that will show you a folder called “Removable
Storage,” which is the SD card in your phone. There are fancy
ways using ADB to copy the files to the phone, but since you should be
able to view your phone as a portable device, just copy (don’t cut) and
paste the whole C:\DoRoot folder to your SD card. If you insist
upon doing it the long way, from the command prompt issue the
following: adb push {file} /sdcard/DoRoot/{file} where {file} is each of the four files (Yes, you need to do it four times) listed above.
14. Command Prompt Enter the following command: adb shell This will put you, interestingly enough, in the ADB Shell. Your C:\DoRoot> Prompt will change to a $ prompt.
15. ADB Shell
The next few steps are putting the root files where they need to go
(temporarily) on the phone and setting the proper permissions.
Enter the commands below at the $ prompt. Each Command is
its own separate line.
cp /sdcard/DoRoot/su /data/local/tmp/su
cp /sdcard/DoRoot/busybox /data/local/tmp/busybox
cp /sdcard/DoRoot/Superuser.apk /data/local/tmp/Superuser.apk
cp /sdcard/DoRoot/rageagainstthecage-arm5.bin /data/local/tmp/rageagainstthecage-arm5.bin
chmod 0755 /data/local/tmp/rageagainstthecage-arm5.bin
16. Skip this Step If
you were smart enough to realize that you could adb push the files
using the command in step 13 to the locations specified in step 15
directly, good for you. Never hurts to have a backup, or do
things the long way to make sure, though. And you still need to
execute that chmod from step 15, or it won't work.
17. ADB Shell Now it's time for the big show. Execute the following command: ./data/local/tmp/rageagainstthecage-arm5.bin
This will apply the actual root process from DoRoot to your
phone. You will be presented with a screen that tells you to be
patient and wait.
18. Be Patient and Wait
When the rooting process is finished, adb will shut itself down.
You will be dumped from your $ prompt in adb shell back to your
c:\DoRoot> prompt. This is expected. WAIT for this to happen
by itself, don't type anything, don't close the window, don't do
anything else, except maybe keep an eye on your phone screen for any
messages that pop up. It may take a little while - up to 5
minutes according to the DoRoot folk. It finished for me in about
a minute (but that was on the second try.). It has been reported
to take even longer. Go take a shower. Have dinner. Come
back later.
19. Command Prompt (Optional) Issue the command adb kill-server
Some people say that this step is not necessary. It won't
hurt anything though, so best to follow through, you've come this far.
If you took the short route in step 15, you get another shortcut,
go to the NOW WHAT? section. Otherwise, trudge on.
20. Command Prompt adb shell if you are lucky, instead of the $ prompt you will get a # prompt. This confirms that you have rooted the phone.
If not, do not fret, just go back to step 17 and do it again.
If you have to go back, whichever option you chose in step 19,
try the other one this time.
21. ADB Shell (With #) The
next few steps are to put the root files in their final locations.
You can't just do this in the first place, it's sort of a
situation where you need root access in order to get root access. Sort
of. Enter
the commands below at the # prompt. Trying to do so at the $
prompt will fail. Each Command is its own separate line. Only the pink parts are commands, the rest are explanation.
mount -o rw,remount -t ext3 /dev/block/mmcblk1p21 /system This makes your phone system read-write.
cp /data/local/tmp/su /system/bin/su Move the superuser command into the system bin.
chmod 4755 /system/bin/su Make it executable.
cp /data/local/tmp/busybox /system/bin/busybox Put busybox into the system bin.
chmod 4755 /system/bin/busybox Make it executable.
cp /data/local/tmp/Superuser.apk /system/app/Superuser.apk Install the Superuser App on the phone.
mount -o ro,remount -t ext3 /dev/block/mmcblk1p21 /system Put the phone system back to read-only.
22. Unlock your phone. Keep an eye on the screen.
23. ADB Shell (With #) exit This will drop you out of superuser mode.
24. ADB Shell (With $) exit This will drop you back to the C:\DoRoot prompt.
25. Command Prompt adb shell Head back into shell.
26. ADB Shell (With $) ./system/bin/su If all goes well, you should be put back at
the # prompt. You now have shell superuser access. This is
also the part where you should have been paying attention to you phone
screen from step 22. A ninja might pop up on the screen
(Literally, a ninja.) asking if you want to give superuser access to
the shell. Click yes. There is more on the ninja below.
27. ADB Shell
A little bit of cleanup. Get rid of all the files in the
./data/local/tmp directory on the phone. You'll want to do this
for security purposes. Issue the following commands at either the
$ or the # prompt:
rm /data/local/tmp/su
rm /data/local/tmp/busybox
rm /data/local/tmp/Superuser.apk
rm /data/local/tmp/rageagainstthecage-arm5.bin
You
can also delete the same files from the /sdcard/DoRoot folder created
in step 13, just subsitute /sdcard/DoRoot for /data/local/tmp in the
previous four commands. You can also delete them the same way you
got them on, from Windows Explorer. Or you can leave them in case
you need to root again for whatever reason. I like backups.
Backups are important.
28. ADB Shell Keep entering the command exit
until you get back out the the C:\DoRoot> prompt. Depending on
which adb prompt you were at ($ or #) you may have to do this once or
twice. A third time will close your Windows command prompt
window, which is fine, because you are all done.
Important bits to remember:
- Do
not plug in your phone until after you install device drivers (and
possibly reboot). The hardest part I had with rooting my phone
(twice) was connecting the damn thing to the computer.
- At the command prompt at any time, issue the command adb devices
If you get a response with a serial number, your phone is
connected. This is useful for troubleshooting connection issues.
- ADB Shell uses unix-style commands for most operations. CP is copy, RM is remove (delete), CD
to change directory, LS to list directory, REN to rename a file and
CHMOD for file permissions. If you are familiar with Unix/Linux
commands, you can get around on your phone's filesystem no problem.
Remember it's a /, not a \.
- In your C:\ prompt on the Windows machine, The command adb push {source}{destination} will copy the file on the windows machine to the filesystem on the phone. The command adb pull {source} {destination}
will do the opposite. Depending on which way you are going, you
need to specify dos paths ( \ ) or unix paths ( / ) - you'll have one
of each in either a push or pull. If you leave adb on your
Windows machine, you can use these commands to script backup operations.
NOW WHAT?
- Keep
an eye out for the ninja. This is the program Superuser.apk which
we installed as part of this process. When he appears on your
phone screen, an application is asking for root access. Certain
programs will require it. You can give or take root access from
any application at any time by opening up Superuser from the App menu
tray. If you save the options, you don't have to talk to the
ninja every time (Just once for each program), but unchecking that
remember allows you to prevent unknown apps fromgetting away with too much, because they have to ask for root every time.
- Your user-installed programs live in a directory called /data/app on the phone. Your preinstalled factory
apps live in /system/app on the phone. If you want to uninstall
an app, you can simply move or delete from these directories. Though
you may need to turn off/on your phone to get the apps to show up in
menu. This is useful for eliminating the preinstalled crap from
Verizon and such, however:
- Certain
preinstalled apps are checked by the updater to make sure that they are
installed before updating. If these apps are missing, the updater
will fail. In my case, my first attempt to upgrade from 2.1 to
2.2 failed because I had uninstalled two preinstalled system apps
(Amazon MP3 and CityID of all things). The truth is that the APK
files don't take up much space, so I would say not to bother deleting
them. A pretty popular option, however, is to rename the APK file
to something else, like OLD or BAK. This will effectively prevent
the application from loading on your phone, eating up memory or showing
up in your app tray. Then, when it's time to update, rename the
BAK files back to APK, and update should go smoothly. For
example, I could have disabled CityID on my phone by doing this in adb
shell #: ren /system/app/CityID.apk /system/app/CityID.bak and the oposite to re-enable come update time.
- I highly reccommend the app Titanium Backup.
This app requires root access. You will want to get the paid version,
but it's only $ 5 or so. The app allows you to back up and
restore all of your apps (even the system apps), set regular backups,
uninstall old applications, uninstall system apps, reinstall from
backups and just generally keep your phonebacked up and tidy. It also - and this is important
- has an option to "Freeze" and "Unfreeze" apps. This is
essentially the same as the APK -> BAK trick above, but with a
pretty GUI interface - effectively preventing certain apps from eating
up memory or showing up in the system tray. It's a nice
alternative to deleting the preinstalled stuff and risk losing
something important or preventing updates, and without having to mess
around at a command prompt.
That is about all I have to say on that. Comments on my guide can be emailed to [ programs (at) majo.me
] If you have suggestions or corrections for this guide, please let me
know. I will update it as necessary to keep up with changes to
android. For toher things, I won't answer every email, nor
respond to the bulk of technical support questions, but if I have a
quick answer and the time, you might get lucky. Remember, you do
all of this at your own risk.
v - 2010-09-24 0954