APC Australia

How to unroot your Android phone or tablet

Those custom ROMs look colourful and shiny, but things don’t always go to plan. Darren Yates investigat­es the process to revert your phone back to a stock operating system.

-

When you buy a phone and it’s weighed down with bloatware and locked to within an inch of its life, the lure of custom ROMs can be pretty hard to resist. That’s not necessaril­y a bad thing — there are some excellent community ROMs available. But that doesn’t mean they will suit everyone.

Some ROMs are early ‘alpha’ stage and not much more than ‘here’s what we hope to do’ previews (and usually come with warnings to that effect). Others are generally more complete but may still have bugs preventing that one feature you need above all others from working. Throw in the recent upheaval surroundin­g CyanogenMo­d ( tinyurl.com/j4rp9jx) and it’s not surprising there’s a tide drifting back towards official or ‘stock’ ROMs. So rather than flashing a custom ROM, this month, we’re looking at how — or if — you can go back to a stock ROM.

FINDING STOCK ROMS

How successful you’ll be depends on being able to find a stock ROM for your device. The chances are that, in your original rush to install a custom ROM, you didn’t take a backup of your original. This can be good, but more probably bad, depending on your phone.

Some phone brands, such as the Samsung Galaxy series, are incredibly well supported, thanks to sites like Sammobile ( tinyurl.com/hnu5lqt) that keep a store of every stock ROM update released for every Samsung device.

Some brands don’t keep a public cache of stock ROMs available, but instead, provide a special ‘ROM Update Utility’ (RUU) to update the phone automatica­lly. For example, Alcatel provides a Windows app called ‘Mobile Upgrade S’ that automatica­lly downloads the correct stock ROM for a range of Alcatel phones. Downloads using these app-based restore systems can be in excess of 1GB, but what’s impressive about this app, in particular, is its ability to recover phones that have been ‘soft-bricked’ or locked in a continuous boot-loop (yes, we know from experience). For most other phones, however, you’ll have to find a stock ROM yourself.

Now the one thing we cannot stress enough at this point is the importance of finding the right ROM. You can’t just wing it and hope that a ROM that seems vaguely right will work. If the ROM is not meant for your exact, specific

device model, don’t install it. If you do, the chances of bricking it are high.

DIFFERENT ROM TYPES

A complete Android smartphone firmware setup is actually made up of multiple ROMs — including boot, recovery, radio/modem and system.

The ‘ boot’ ROM contains the kernel and RAMdisk for normal booting of the device — the kernel is the base-level software-hardware translator engine, while the RAMdisk provides the associated file store. The ‘recovery’ ROM is another kernel/RAMdisk pairing but more like ‘system restore’ in Windows — it allows you to wipe the various caches, perform a factory reset, backup and restore, even flash new apps and new versions of Android. Custom recovery options like TeamWin Recovery Project (TWRP) and ClockworkM­od (CWM) add the ability to flash custom versions of Android.

Deciding which of these two ROMs boots up is the job of the ‘ bootloader’, the initial code that fires when the device is first switched on. Increasing­ly, phone makers are choosing to lock the bootloader from loading anything other than official ROM code (while the Android community works feverishly to unlock it again).

The ‘radio/modem’ ROM is software specifical­ly focused on the phone network transceive­r (TX/RX) function of your device and, finally, the ‘system’ ROM is the Android operating system that runs your apps and games.

Each of these ROMs is essentiall­y modular in form — you can install the Android OS system ROM separately to the recovery ROM, for example, although you’ll often find stock ROMs will replace multiple ROMs at once. Whichever way you go, each ROM you install must be designed for your specific device to handle its specific hardware, otherwise, bits of your device (or the whole thing) will just stop working.

GOOGLE SYSTEM TOOLS

While there are numerous third-party tools for modding Android devices, two of the most important are command-line utilities from Google called ‘adb’ (Android Debug Bridge) and ‘fastboot’.

We introduced these utilities in our Android masterclas­s last month (‘Hack your Android’, page 100). They’re tools included in the Android Software Developmen­t Kit (SDK) for app developers, but they’re also extremely capable in their own right — and perfect for much Android hackery.

Third-party installers for these utilities have been available for some time, but in a stroke of good timing, Google recently decided to release ADB and Fastboot as a separate download from the SDK, meaning instead of several hundred megabytes of SDK you don’t need, you can now download these tools for around 4MB from Google direct ( tinyurl.com/jhyy47m).

Added security features on some phones, such as Samsung’s Knox, blow a software fuse if you ever flash a custom recovery ROM on your device, so there’s no certainty you can truly return it to pristine ‘as new’ condition. Still, these Google tools, combined with your stock ROM, should provide your best chance of flashing devices back to stock. In fact, the method we’ll show you is reported to work with Google’s Nexus/Pixel range, along with many HTC, Motorola, Oppo and Huawei phones. However, it won’t work for all phones — in fact, Samsung Galaxy users should avoid this method (use Samsung’s Odin tool instead). That said, here’s how this method works:

STEP 0: BACKUP

Before you do anything to your phone, back it up. In most circumstan­ces, flashing a system ROM is equivalent to a ‘factory reset’, erasing your personal files, so make sure you back up everything — apps are optional if you have access to them elsewhere, but personal files, including contacts and SMSes, need to be backed up ‘off-phone’ (not on the phone’s internal or SD card storage). There are many methods for this — if you have root access, Titanium Backup on Google Play is a popular option.

STEP 1: INSTALL ADB/FASTBOOT

Make sure you download the Android SDK Platform Tools from tinyurl.com/ jhyy47m. There are zip files for Windows, Linux and MacOS X. It doesn’t include the Google USB device driver, which you may need if you don’t have it installed already.

If so, the 15-second ADB installer on XDA-Developers ( tinyurl.com/jbg88re) is available as an alternativ­e for Windows users that includes driver installati­on (the usual software security caveats apply).

STEP 2: DOWNLOAD THE ROM

This is the most important step — get this wrong and you could possibly kiss your device good-bye. As we said before, you must download the ROM designed for your specific device. Where do you find ROMs? We’ve collected a few brands (see box on the next page, bottom right), but for the latest ROMs from other brands, we’d start with XDA Developers ( xda-developers.com) and hunt around. Just make sure the ROM is meant for your specific device — not just your model, but down to your phone network provider. We can’t stress this enough. Once you’ve downloaded the ROM, unzip the IMG (.img) image file(s) to a known location — grab 7-Zip if you don’t already have it ( www.7-zip.org/ download.html).

To use Fastboot, your ROM must exist as an IMG file. If it’s a zipped folder, it’s unlikely to work with this method.

SECURITY

The tricky part with downloadin­g a ROM is that, unless it comes direct from your device manufactur­er or a reputable community-based site, you can’t really guarantee the ROM’s security and that it isn’t loaded with malware. While we’ve not come across an infected ROM (yet), we can’t discount that malwared ROMs exist.

The most practical way to check the quality of ROMs is to watch the forums for any signs of issues appearing with any ROM you intend to use. But ultimately, if security is a key concern for you, the safest thing is to not root and flash your device in the first place.

STEP 3: CONNECT UP

Next, plug your phone into your PC’s USB port. If you haven’t already, set your device into Developer mode. Launch ‘Settings > About phone’ and scroll down to the ‘Build number’ entry. Tap it seven times until you see ‘you’re now a developer’.

Back out to the Settings menu, tap the new ‘Developer options’ entry, tap the ‘On’ button and likewise for ‘USB debugging’. This will allow your PC to initiate actions on your device via adb/fastboot. When you see the RSA key fingerprin­t message on your phone, tap ‘OK’.

Next, open up a command prompt on your PC, type: adb devices

...and press Enter. This will show if the Google USB driver has made its way onto your PC or not. If it has, you should see an Android serial code appear and ‘device’ to the right.

STEP 4: LAST CHANCE TO BACK UP

No joke, this really is the last chance to back up anything you’ve got stored on this device. The next step will perform an effective ‘factory reset’ and wipe all your personal data. If you have a microSD card on-board, rip it out and copy everything off first, just to be safe.

STEP 5: FLASH IT

Now for the big moment. With the image file in the same folder as your fastboot and adb tools, you can now boot your device into fastboot mode with the adb command: adb reboot-bootloader

After a second or two, ‘fastboot mode’ should take over. Now to flash the system image file, type in the following command: fastboot flash system <system_image_ name>.img

“You can’t just wing it and hope that a ROM that seems vaguely right will work.”

...where <system_image_ name> is the name of your system image file and press Enter. It’ll take anywhere up to several minutes depending on the size of the ROM, at which point, your device should drop back to its fastboot prompt again.

If it fails, the bootloader may be locked. To check, run the fastboot command: fastboot getvar unlocked If it comes back with ‘no’, you’ll need to unlock it and to do that, you run: fastboot <code> unlock

...where <code> is replaced with ‘oem’ for Android 5.x/Lollipop or older devices, and ‘flashing’ for Android 6.x/ Marshmallo­w and newer devices.

NOTE: For security reasons, this wipes your device, but since you’ve already backed up, that won’t matter. Once completed, try the previous ‘fastboot flash system’ command again.

STEP 6: REBOOT

With that done, the ROM should have installed and you’re ready for your device to reboot. To do that, type on your PC’s command prompt: fastboot reboot

...and press Enter. Now for the nervous wait — the first boot after any reset always takes forever and, depending on the device, can be up to five minutes with the splash screen staring at you.

Worse is when you get the splash screen for a few seconds and the phone reboots, shows the splash screen again, reboots again and gets stuck in an interminab­le ‘ boot loop’. All things being as they should be, your device should eventually boot and ask you to select your language. If so, success.

WHAT IF IT FAILED?

We said it could fail, and even though it shouldn’t fail, don’t be surprised if it does. If the device won’t boot normally, the ROM likely hasn’t taken — and without a working ROM, you can’t use this method. However, it’s possible you may just need to wipe the Dalvik/ ART cache — do this in your device’s recovery mode and reboot.

Failing that, copy the ROM onto external storage (microSD), plug it in and reboot the device into recovery mode (power + volume-up buttons) and try using the recovery mode to flash the ROM instead.

Again, as every device is different, ensure you know how to use your device’s recovery mode before you start.

MIND THE GAP

Any time you flash a ROM to your smartphone, you’re taking a calculated risk. That said, the flash process, these days, is as smooth as it’s ever been, although we’d still triple-check everything before pressing the ‘Go’ button. The most important thing is ensuring the stock ROM you flash is designed for your device and that you’ve backed up everything before you flash. A combinatio­n of Nandroid backup via your recovery mode, Titanium Backup and your Google account should cover just about everything.

These Google SDK System Tools are extremely powerful and are more than capable of bricking your device if you don’t show them the proper respect. But whether you use these tools or a dedicated app, there’s no need to face a ROM that doesn’t work for you.

 ??  ?? HTC is one of the few phone makers to offer official ROM downloads.
HTC is one of the few phone makers to offer official ROM downloads.
 ??  ?? The budget Alcatel Pixi 3 (4.5) can be ‘un-bricked’ with Mobile Upgrade S.
The budget Alcatel Pixi 3 (4.5) can be ‘un-bricked’ with Mobile Upgrade S.
 ??  ?? Alcatel’s Mobile Upgrade S tool can rescue softbricke­d Alcatel phones.
Alcatel’s Mobile Upgrade S tool can rescue softbricke­d Alcatel phones.
 ??  ?? Google’s adb and fastboot utilities are ideal for ROM flashing on many devices.
Google’s adb and fastboot utilities are ideal for ROM flashing on many devices.
 ??  ?? You can use a combinatio­n of adb and fastboot to flash stock ROMs.
You can use a combinatio­n of adb and fastboot to flash stock ROMs.
 ??  ?? Tap ‘build number’ seven times on ‘About phone’ to enable developer mode.
Tap ‘build number’ seven times on ‘About phone’ to enable developer mode.
 ??  ?? Ensure your phone is set to allow USB debugging.
Ensure your phone is set to allow USB debugging.
 ??  ?? Google’s Pixel phones reportedly can use fastboot ROM flashing.
Google’s Pixel phones reportedly can use fastboot ROM flashing.
 ??  ?? Download adb and fastboot from the new Google SDK Platform Tools page.
Download adb and fastboot from the new Google SDK Platform Tools page.
 ??  ?? Sammobile is a great source for all Samsung ROMs.
Sammobile is a great source for all Samsung ROMs.
 ??  ?? Accept the RSA fingerprin­t from your PC to enable USB debugging.
Accept the RSA fingerprin­t from your PC to enable USB debugging.

Newspapers in English

Newspapers from Australia