What is Rooting?
Rooting was a big deal around seven to eight years back. Majority of the android guides used to give just one advice for every problem you looked up online — getting your device rooted. And there was a craze to crack and patch things.
Times have changed since then. You probably haven’t even heard of “rooting” if you started using Android phones around the year 2016 or so. So, why not start with the definition first ;)
“Rooting is the process of gaining privileged access to your phone’s system”
What does it mean?
Android actually houses a modified Linux Kernel. So, like most other UNIX-like systems, you should be able to access and modify any system component as you wish.
However, to keep you from bricking your phone and compromising the security, hardware manufacturers impose restrictions on your level of system access and the apps you run. Which is all good if you are not tech-savvy and use your phone as a daily-driver. The power users though do not like restrictions. This is where rooting comes in.
Upsides of Rooting
- You can clean your device of all the resource-hogging bloatware. And customize it the way you want.
- You can increase device’s performance by doing things like over-clocking your CPU, since rooting gives you control over your hardware.
- You get the ability to test out the latest bleeding-edge technology as soon as it comes out.
- You can lead a more private, ad-free, and secure life.
Downsides of Rooting
- You leave your phone even more vulnerable than before if you don’t know what you are doing.
- You always risk bricking your device in the process of rooting and flashing ROMs.
- Your warranty is void as soon as you root your device.
The actual process
The rooting process is fairly same for every android device. Flash a custom recovery, then a root binary, and then any other device specific mods necessary. If everything goes well, you should have root access on your phone within 15 minutes.
One could bypass custom recovery and also receive OTA updates with Magisk. Magisk is now the recommended method to gain root access anyways.
What is a custom recovery?
A recovery environment is a minimal standalone system that helps you reset your phone to factory defaults, flash official OTA updates and perform other basic diagnostic tasks.
A custom recovery replaces the stock recovery shipped with your phone, and unlocks the ability to install custom ROMs, full system backups and much more.
TWRP is one of the most popular open-source recovery projects.
What kind of mods do you need?
Manufacturers put several security measures in place to prevent unauthorized system modifications, remember? DM-Verity, FRP locks, DEFEX security; all come under it. If not taken care of, they cause boot loops, and data corruption. That is why you need specific mods to bypass these barriers.
But before you use a random patch lying around in a forum, check if one was already merged into your preferred rooting method like Magisk.
For example, to root a J7 you would need Odin (Samsung specific) executable, the OrangeFox recovery image (project based on TWRP), a mod to disable DM-Verity and encryption, and the Magisk binary.
Lessons from My Experience with Rooting
I have rooted 5 devices until now. Two of them in the year 2014, one in 2018, a J7 in 2021 and most recently a Lenovo tablet in 2022. And while the Lenovo tablet was the most easy one to root — just unlock the bootloader and flash the patched boot image — there are a few things I wish I had considered my first time.
Do not use one-click root solutions
A fundamental mistake is to use some kind of a one-click root solution. These tools are exploiting Android vulnerabilities to give you the root access and there’s no telling what files they modify or replace in the process.
My first time, I used one such app which then filled my device with hundreds of trojans and adware. The situation only kept worsening each time I connected my device to the internet.
At that point, only a clean reinstall can save you.
Maintain a copy of the stock firmware and a system-backup
This should be your very first move before making any changes to your device. Having the stock firmware at hand will help you resuscitate your phone from all sorts of problems. Just make sure you find and download the exact firmware that is installed on your device before making any changes. Some manufacturers prevent flashing of older ROMs if a new one is already installed.
You should also consider creating a Nandroid backup with custom recovery, just in case.
Do not mess up the partition table on your device
This generally happens when you try to install a GSI based Treble ROM on a non-treble device. This modifies your device’s default partition table and creates a new partition to support those ROMs. However, you then also lose the ability to install back your stock firmware or any other non-treble ROM for that matter.
To return to the default state, you will need a special PIT file (at least for Samsung devices) to restore the partition structure. So, keep this file handy too.
Only use trusted resources
This is the most obvious advice. And yet the most neglected one. Do not flash files, mods and ROMs form random websites. Cracked apps and mods more often than not contain malicious code that, with root privileges, can give the hacker access to your entire life. Remember — With great power, comes great responsibility.
I have not studied how Android OS works under the hood or about Android’s security model in as much detail as I have with Linux in general.