Upgrade Android on a Rooted Device

When Android says “System update available”, we all gleefully run it. Those of us with rooted phones get a way through it and come to an android lying on its back, and a sinking feeling in the pit of our stomach. “Did I just brick my phone?” No, but we did break some of the assumptions the Android updater makes. It presumes we’re running the stock bootloader, which we aren’t. Here’s instructions for getting the bootloader back to stock, getting Android updated using the normal means, and getting re-rooted. This guide assumes your phone is unlocked. (Unlocking your phone will wipe it. Backup before unlocking. Yes, really.)

I. Get ready

  1. Charge the phone. If the phone dies while you’re flashing, you’ve bricked the phone. It’s not permanent, but it’s harder.
  2. Install android sdk. I downloaded “adb-tools_treiber.zip” some time ago from a source I don’t remember. Minimal ADB and fastboot is sufficient. The goal is that you have adb and fastboot command-line commands available.
  3. Get phone drivers. You need drivers both for the regular boot mode and for the recovery console. Universal ADB Driver worked nicely for me.
  4. Turn on developer mode: Go to Settings > About phone and hit the build number 7 times.
  5. Turn on USB Debugging on the phone: Go to Settings > Developer Options > USB Debugging
  6. Ensure you have drivers installed. With your phone plugged into the PC via USB, open a command prompt, and run these commands:
    • adb devices: make sure your device is listed as device (not offline). Click “yes allow USB debugging” on the phone, and run it again until it says device. If it doesn’t, check Device Manager, try a different driver, or check the USB connection.
    • adb reboot bootloader: reboot the phone into bootloader so you can check the fastboot driver.
    • fastboot devices: ensure your phone is listed as fastboot.
  7. Backup everything. Double-check everything. What if your phone never booted again? What would you lose? It’s your foot…

II. Put bootloader back to stock

Source

  1. Download factory image for current version of Android: https://developers.google.com/android/nexus/images?hl=en. Settings > About Phone shows you your phone’s current version.
  2. Unzip recovery.img, boot.img, and system.img.
  3. Run these commands from a console / terminal in the directory with the unzipped content and adb/fasboot commands. (Run the lines that start with > without actually typing the >):
  4. Run these:

      # Make sure the device is recognized
      > adb devices
    
      # Boot into bootloader mode
      > adb reboot bootloader
    
      # In bootloader mode, make again sure the device is recognized
      > fastboot devices
    
      # Flash stock LRX21O recovery image
      > fastboot flash recovery recovery.img
    
      # Flash stock LRX21O system image
      > fastboot flash system system.img
    
      # Flash stock LRX21O boot image
      > fastboot flash boot boot.img
    
    1. (4?) Reboot your phone, and you’re back to the stock bootloader. A few things of note: You’ve lost root. All the things that depend on root are now going haywire. That’s ok. We’re not done.

    III. Run Android Update

    1. Incessantly check for updates until Android notices. Settings > About Phone > System updates. Sadly, it caches the answer for a good long time, so this may be a “go to bed, try again tomorrow” kinda thing. Especially if you just tried to update and got the android lying on its back.
    2. Run the update. Reboot.
    3. Reboot a few times. Run a few apps. Check for more Android updates (Settings > About Phone > System updates). Run these updates too. Make sure the new Android version settled in.

    IV. Root it again

    Source

    1. Download and unzip CF Auto Root from https://autoroot.chainfire.eu/
    2. Re-enable USB Debugging if it got turned off during the update.
    3. Get into fastboot mode: adb reboot bootloader
    4. Run root-windows.bat (or the appropriate root for your OS). That gets you root again.
    5. Reboot. It will take a long time to boot. No, it didn’t freeze (unless it’s been hours). Feel free to panic, but don’t hard-boot it. If you do brick the phone, start over with II: Put bootloader back to stock above. No, you didn’t break it.
    6. Once your phone is booted again, update and run SuperSU, Titanium Backup, Android Firewall, BusyBox, and all your other rooted tools. You’re done. Welcome to the next version of Android.