Rooting Best Practices

Thread Status:
Not open for further replies.

Last Updated:

  1. scary alien

    scary alien not really so scary Moderator

    If you are new to rooting, you might want to be aware of some general guidelines for various root-related activities that might help you avoid some trouble along the way.

    - Have a fall-back / recovery plan before taking any "scary" (risky) action. In other words, know what steps you'll need to follow if you encounter a problem.

    - Be aware that modifying your device may very well impact your ability to successfully install a future over-the-air (OTA) update. There are cross-checks present in OTA updates that verify that the files on your system match what was present before so that they can be patched (i.e., to prevent patching the wrong file). So, before you begin modifying your system, know that it may be very difficult to get your device back to its unmodified state without having the benefit of restoring a Nandroid backup or flashing a stock ROM.

    - Make a backup before you alter or remove any system-related apps or settings. If you can't make a full, restorable (i.e., a Nandroid) backup, then don't make any changes--doing so without a backup is asking for bootloops or soft-brickings.

    - Save your backups off your device. Its prudent to copy your backups off of your device for safe-keeping in the event that your on-device storage becomes compromised. Save a copy off to a PC, thumb/flash drive, or the cloud (Dropbox, Google Drive, etc.).

    For example, it might be a good idea to create folder on your PC called "Android-backups" and sub-folders "sdcard", "nandroid", etc. to hold their respective backups (in folders named with date/time, etc.). For example:

    • c:\my documents\android-backups\sdcard\2012-06-12-1402

    • c:\my documents\android-backups\nandroid\2012-06-12-1533
    Also, saving your backups off to two different targets (i.e., PC and external SD card, or PC and cloud, or cloud and SD card, etc.) is a good idea for added redundancy and safefy (you can never be too safe, eh? :)).

    - Verify your Nandroid backups. If you are so inclined, you can verify the Nandroid backup's integrity by performing an "md5sum -c" type of operation against it. This is exactly what the Nandroid restore operation does when you would attempt to restore a backup, so its a great peace-of-mind to double-check this after you've done your backup.
    Here's how to do it via an adb shell session (and presumes that you have a busybox installed that supports the md5sum command):
    Microsoft Windows [Version 6.1.7601]
    Copyright (c) 2009 Microsoft Corporation. All rights reserved.

    C:\Users\Scary Alien>adb shell
    * daemon not running. starting it now on port 5037 *
    * daemon started successfully *
    uid=0 gid=0@android:/ # cd /sdcard
    uid=0 gid=0@android:/sdcard # cd clockworkmod
    uid=0 gid=0@android:/sdcard/clockworkmod # ls -a -l
    ls -a -l
    total 20
    drwxrwxr-x 4 0 1015 4096 Mar 11 17:26 .
    drwxrwxr-x 30 0 1015 4096 Jun 13 03:22 ..
    -rw-rw-r-- 1 0 1015 410 Mar 31 21:31 .settings
    drwxrwxr-x 11 0 1015 4096 May 11 15:47 backup
    drwxrwxr-x 2 0 1015 4096 Mar 31 21:31 download
    uid=0 gid=0@android:/sdcard/clockworkmod # cd backup
    cd backup
    uid=0 gid=0@android:/sdcard/clockworkmod/backup # ls -a -l
    ls -a -l
    total 44
    drwxrwxr-x 11 0 1015 4096 May 11 15:47 .
    drwxrwxr-x 4 0 1015 4096 Mar 11 17:26 ..
    drwxrwxr-x 2 0 1015 4096 Mar 28 01:51 2012-03-
    drwxrwxr-x 2 0 1015 4096 Mar 31 19:14 2012-03-
    drwxrwxr-x 2 0 1015 4096 Jan 1 2000 2012-04-08-00.00.01
    drwxrwxr-x 2 0 1015 4096 Jan 1 2000 2012-04-
    drwxrwxr-x 2 0 1015 4096 Apr 8 05:06 2012-04-
    drwxrwxr-x 2 0 1015 4096 Apr 9 01:10 2012-04-
    drwxrwxr-x 2 0 1015 4096 May 11 15:57 2012-05-
    drwxrwxr-x 2 0 1015 4096 Mar 3 06:47 stock-rooted-402
    drwxrwxr-x 2 0 1015 4096 Mar 3 06:48 stock-unrooted-404
    uid=0 gid=0@android:/sdcard/clockworkmod/backup # cd 2012-05-
    uid=0 gid=0@android:/sdcard/clockworkmod/backup/2012-05- # ls -a -l
    total 702688
    -rw-rw-r-- 1 0 1015 8388608 May 11 15:47 boot.img
    -rw-rw-r-- 1 0 1015 12800 May 11 15:56 cache.ext4.tar
    -rw-rw-r-- 1 0 1015 463217152 May 11 15:55 data.ext4.tar
    -rw-rw-r-- 1 0 1015 237 May 11 15:57 nandroid.md5
    -rw-rw-r-- 1 0 1015 12517376 May 11 15:47 recovery.img
    -rw-rw-r-- 1 0 1015 235394560 May 11 15:48 system.ext4.tar
    uid=0 gid=0@android:/sdcard/clockworkmod/backup/2012-05- # md5sum -c nandroid.md5
    boot.img: OK
    cache.ext4.tar: OK
    data.ext4.tar: OK
    recovery.img: OK
    system.ext4.tar: OK

    uid=0 gid=0@android:/sdcard/clockworkmod/backup/2012-05- #
    Additionally, you can do this directly on your phone via an app like AFV (Android File Verifier) [free in the Market]. It has a "Verify Nandroid Backup" function that operates identically to the "md5sum -c" command (although it does not use the busybox's md5sum utility--it calculates the MD5 digests itself).

    Install the app, navigate to your Nandroid's backup directory and long-press the backup directory name (i.e., the one that's date/time stamped and contains the nandroid.md5 file) [note: you can also navigate into the directory and long-press the nandroid.md5 file]. You'll be presented with a list of functions--select "Verify Nandroid Backup".

    Its not a bad idea to additionally verify the backups on the system to which you've copied them to. I know, it sounds like overkill, but this is exactly when
    data transfer errors/issues occur--especially for very large file for which you have no means to manually verify their contents.

    The process is verify similar for a PC (Windows/Linux/Mac) to what I outlined above for the "adb shell". You need an MD5 checksum utility (see this thread and follow these basic steps:

    - If your Android device does not support a custom recovery or the ability to make a full device backup (i.e., a Nandroid backup), then you should avoid making any system-related changes that could affect the ability of your device to boot (i.e., modifying or removing system apps, etc.).
    - Verify the integrity of any files you might flash. This means checking the file size and (MD5) checksum on the platform from which the file is being flashed. If you are flashing from your device, you should check its integrity there there's no guarantee that it matches it original source unless you verify that. If you are are flashing from a PC, you should also check the file's integrity from there, too.

    Visit this thread for more information:

    - Be sure to carefully follow the ROM (or theme) dev's installation instructions. If wipes are required, be sure to not miss those steps. The sequences of steps is often very precise and following them correctly will help ensure a successful installation.

    - When/if you overclock, be sure to not enable the "set on boot" option until you are sure your device is stable at the selected speed. Also, don't forget to to set a failsafe temperature profile/setting to keep your device from over-heating.

    - Also, take care when first using a tool like ROM Manager. It makes doing some root operations very simple, but you might want to become with conversant with how to operate and navigate directly in ClockworkMod custom recovery. This way, you will be prepared for the possible eventuality when you really need to manually operate in ClockworkMod custom recovery. So, your first forays with flashing ROMs might be best done manually.

    Let me know if you have any other things to add or expand on in the above.


Thread Status:
Not open for further replies.

Share This Page