The Custom Droid

Android Tutorials, Tips and Tricks

Moto G7 Power Guide: Unlock Bootloader, Install TWRP, and Root with Magisk

How to Unlock the Bootloader, Install TWRP Recovery and Root Moto G7 Power using Magisk

In this guide, I will show you how to unlock the bootloader, install TWRP recovery, and subsequently root the Moto G7 Power using Magisk. These instructions will work on any Moto G7 Power running Android 10 and Android 9 Pie.

Advertisement

While a decent performer at its price, the Motorola Moto G7 Power isn’t best known for its software. The manufacturer is long known for irregular and delayed support when it comes to software updates. Also, the stock firmware that comes pre-installed on the said phone isn’t a stronghold when it comes to customization. It is all but basically stock AOSP software with Motorola’s proprietary apps sitting atop.

And that’s where things like custom ROMs and rooting could help. If you’re not a fan of the stock software, you have a variety of custom ROMs to try that offer a lot of features, customization options, and also help you get the latest Android security patches well before Motorola rolls them out.

Advertisement

On the other hand, if you do wish to stick with the stock software, you could root your Moto G7 Power and have the benefits of applying modifications to the software systemless-ly with Magisk. Magisk can further help you hide root from certain applications that might stop working if root access is detected, along with other features.

But to flash ROMs or Magisk to gain root access, you must install a custom recovery such as TWRP on your Moto G7 Power. The good news is, TWRP v3.4 is officially available for the Moto G7 Power, courtesy of developer Andrew Hexen. It supports both Android 10 and Android 9 Pie. If you’re into development, you can view the code at the official Github repo.

Before everything, you must first unlock your Motorola device’s bootloader, which is quite easy. The instructions below will take you through the complete process in a comprehensive manner.

  • Note: If you happen to own the regular Moto G7 or Moto G7 Plus, then refer to this tutorial instead.

Requirements

Make sure that you fulfill all the requirements stated below before you start following the instructions.

1. Take a Backup First!

All the data stored on your phone will be erased while performing the instructions. So, make sure that you take a complete backup of all your important files and data before you begin. You could also refer to our guide for this purpose.

Installing TWRP and rooting will not wipe any data, however, we still strongly recommend taking a backup in case anything goes wrong.

2. Install Android SDK platform-tools

Download the latest version of the Android platform-tools for your computer:

Once downloaded, extract the contents of the ZIP package to get the “platform-tools” folder. This folder should contain the binary files of the required tools, such as ADB and Fastboot.

For easier access and for our demonstration as well, we suggest you move the “platform-tools” folder to the root of the C:\ drive if you’re using a Windows computer. If you’re using a macOS/Linux PC, move the “platform-tools” inside the “Documents” directory (Refer to the figure below).

3. Launch command-line inside the ‘platform-tools’ folder

Once you have the Platform-tools installed, you will need to launch the command-line window inside the ‘platform-tools’ folder. To do this:

  • On Windows: Go to C:\platform-tools. Hold the SHIFT key on the keyboard and right-click on any empty space inside the folder. Then select the “Open PowerShell window here” option.
    Open PowerShell inside 'platform-tools' folder on Windows
  • On Linux/Mac: Launch the Terminal and use the cd command to change its directory to the “platform-tools” folder. For example: If you moved the folder inside the “Documents” directory, then the command should be: cd Document/platform-tools
Note: When entering the commands while following the instructions, make sure to prepend them with a dot and backslash [.\] in Windows PowerShell or a dot and forward slash [./] on Mac/Linux Terminal.

Tip: If you’re experienced enough, you could also add these tools to your computer’s PATH.

4. Install USB Drivers on the computer

If you’re going to operate on a Windows computer, make sure that you download and install the latest Motorola USB drivers as well. Mac/Linux users should not need any additional drivers at all.

5. Charge your phone

Charge your Moto G7 Power to a sufficient battery level so that it doesn’t suddenly power off on you while performing the instructions. At least 50-60% of the battery level is recommended.

Downloads

Below, you will find the links to download all the files you’ll require while following the instructions.

Important Note: The bootloader on the regular Moto G7 (river) only comes installed to the active slot. So, DO NOT SWITCH SLOTS until you flash the “copy-partitions-AB.zip” file. This file will automatically install a copy of the bootloader from the active slot (say “a”) to the inactive slot (say “b”).

The instructions for the same have been combined with the rooting instructions (Step #3) of this tutorial.

While we will try our best to keep the download links up-to-date with the latest TWRP builds, we suggest that you always make sure that you check for the latest version on the official TWRP releases page.

Instructions

To help you get a better understanding of the whole process, we have split the instructions into three major steps.

Step 1: Unlock Moto G7 Power Bootloader

Like most other Android devices, the bootloader on your Moto G7 Power is locked and will prevent flashing the device partitions. So, the first step is to unlock the bootloader on your Moto G7 Power using the official method provided by Motorola itself. To do this, follow the instructions as follows:

  1. Power off your phone first. Then hold the Volume Down and Power keys together to enter Bootloader Mode.
  2. Once in Bootloader Mode, connect your Moto G7 Power to the computer using the USB cable.
  3. Enter the following command in the command-line to retrieve your phone’s unique unlock data: fastboot oem get_unlock_data
  4. The command should return a string in a similar format as shown below:
    • On Windows:
      (bootloader) 0A40040192024205#4C4D3556313230
      (bootloader) 30373731363031303332323239#BD00
      (bootloader) 8A672BA4746C2CE02328A2AC0C39F95
      (bootloader) 1A3E5#1F53280002000000000000000
      (bootloader) 0000000
    • On macOS/Linux:
      INFO0A40040192024205#4C4D3556313230
      INFO30373731363031303332323239#BD00
      INFO8A672BA4746C2CE02328A2AC0C39F95
      INFO1A3E5#1F53280002000000000000000
      INFO0000000
  5. Copy the 5 lines of the string shown in the output to a text editor on your computer. Then remove all line breaks and whitespaces to convert it into a one-line string, like so:
    0A40040192024205#4C4D355631323030373731363031303332323239#BD008A672BA4746C2CE02328A2AC0C39F951A3E5#1F532800020000000000000000000000
  6. Now that you have the required unlock data, visit the official Motorola bootloader unlocking portal in your PC’s browser. It’s worth going through the information published on the page. Once you have gone through it, scroll down to the very bottom and click “NEXT”.
  7. The portal will now prompt you to login with your Motorola account. Once you have logged in, it should show you the next step as “GET YOUR DEVICE ID & UNLOCK CODE”.
  8. Scroll through the page and find pointer #6 where it asks you to enter the device unlock key. Copy your phone’s unlock key (retrieved in pointer #5 above), paste it in the input field, and click the blue-colored “Can my device be unlocked?” button.
    Get Bootloader Unlock Key for your Moto G7/G7 Plus
  9. After the key is validated, scroll down further through the page and select “I Agree” to agree to Motorola’s terms. Finally, click the blue “REQUEST UNLOCK KEY”.
  10. You should now receive your phone’s unique bootloader unlock key in your registered email address.
  11. Now, enter the following command to finally unlock the bootloader of your Moto G7 Power:
    fastboot oem unlock <bootloader-unlock-key>
  12. You will have to replace “<bootloader-unlock-key>” with the unique 20-character unlock key you received in your email.

That’s it! Your phone’s bootloader should now be fully unlocked. You should now boot the phone and set it up.

Step 2: Install TWRP Recovery

With the bootloader now unlocked, the second step is to install TWRP recovery on your Moto G7 Power.

Since the phone supports the new A/B partition scheme, installing TWRP on it is a two-step process. You will first need to temporarily boot the recovery image using Fastboot and then install the recovery image using the “Install recovery ramdisk” option.

  1. First, download the TWRP recovery image for your Moto G7 Power.
  2. Copy the recovery image and installer ZIP files inside the ‘platform-tools’ folder on your computer.
    Move TWRP recovery image and installer files inside 'platform-tools'
  3. Power off your phone and boot it into Bootloader Mode by holding the Volume Down and Power keys together.
  4. Connect the phone to the PC using the USB cable while it is in Bootloader Mode.
  5. Use the following command to format the /data partition. This is mandatory otherwise TWRP will not be able to decrypt the internal storage.
    fastboot -w
  6. Now, enter the command below to temporarily boot the TWRP recovery image on the Moto G7 Power:
    fastboot boot twrp-3.5.0_9-0-ocean.img

    Temporarily Boot TWRP Recovery Image on Moto G7 Power

  7. Your phone should now reboot and enter the TWRP recovery mode.
  8. Transfer the TWRP installer zip to your phone using the following ADB push command:
    adb push twrp-installer-3.5.0_9-0-ocean.zip /sdcard

    Tansfer TWRP Installer ZIP to Moto G7 Power using ADB Push

  9. Once the file has been copied, disconnect the phone and go back to the TWRP main screen.
  10. Press the “Install” button and select the TWRP installer ZIP file (twrp-installer-3.5.0_9-0-ocean.zip)
  11. Finally, swipe the button to flash the installer and permanently install TWRP recovery on your Moto G7 Power.
Do not reboot your phone into the system yet. Permanently installing TWRP modifies the boot partition and will trigger DM-Verity when the device boots. And thus cause a boot loop. To fix this, head to the next section to flash the Magisk installer zip, which will deal with DM-Verity on its own.

Step 3: Root Moto G7 Power using Magisk

With TWRP installed, the third and last step is to flash the Magisk installer zip and finally root your Moto G7 Power. Additionally, you will also need to flash the forced-encryption disabler zip package to make sure that /data partition stays unencrypted.

  1. First, download the latest Magisk installer and Forced-encryption Disabler ZIP files on your computer.
  2. Copy both the downloaded files inside the ‘platform-tools’ folder.
    Move Magisk and Forced-encryption Disabler ZIP files inside 'platform-tools' folder
  3. Then connect your phone to the computer using the USB cable.
  4. Use the following commands to transfer both the files to your phone’s internal storage:
    adb push Magisk-v21.2.zip /sdcard
    adb push Disable_Dm-Verity_ForceEncrypt_11.02.2020.zip /sdcard

    Tansfer Magisk and Encryption-Disabler ZIP to Moto G7 Power using ADB Push

  5. Once the files have been transferred, disconnect the phone from the PC.
  6. Go to the TWRP main screen and press the “Install” button.
  7. Navigate to the storage and select the “Magisk-v21.2.zip” file.
  8. Tap on the “Add more Zips” button and select the “Disable_Dm-Verity_ForceEncrypt_11.02.2020.zip” file to add it to the flashing queue.
  9. Finally, swipe the button on the bottom of the screen to flash the ZIP files and root your Moto G7 Power.

Once the flashing process finishes, hit the “Reboot System” button.

Wrapping Up

Your Moto G7 Power should now be rooted using Magisk. To verify, you can launch the Magisk Manager app on your phone and check the installation status. You can also use the app to manage superuser permissions for apps that require root and install Magisk Modules for additional features. With root access, you can further install mods like the EdXposed Framework, Dolby Atmos, and ViPER4Android.

Magisk also gives you the ability to hide root on a per-app basis. This should help you run banking & security apps, along with games like Pokemon Go on your rooted phone. You could also verify the SafetyNet status to see if it passes the CTS Profile and BasicIntegrity checks. It’s worth noting that Google has rolled out hardware-based SafetyNet attestation, so passing SafetyNet could be extremely tricky now.

There you go! By now, you have learned how to unlock the bootloader, install TWRP custom recovery, and simultaneously root the Moto G7 Power using Magisk. If you face any issues while performing the instructions or have any questions regarding the topic, let us know.

About the Author

Founder and Editor-in-Chief

Dhananjay has more than 11 years of experience in Android software customization and development, and has spent the past 10 years writing about it. He spends most of his prime time reading, learning and writing about Android and other open-source projects. He is also a community-taught web developer. Apart from that, he loves mountain biking and playing video games on his PlayStation.

Comments 9 Comments

  1. Hi,

    Abit late to the party but I was wondering if you could help. I get the following error when typing the following command fastboot -w:

    Erasing ‘userdata’ OKAY [ 0.234s] Erase successful, but not automatically formatting. File system type raw not supported.
    Erasing ‘metadata’ (bootloader) Permission denied FAILED (remote: ”) fastboot: error: Command failed

    Do you know what causes this and how I can get this sorted?

    1. Joe, you do not need to worry about the logged message. It’s completely normal, you can ignore it and proceed further with the instructions.

      Also, there have been quite a few developments since this guide was published. Do you need TWRP for flashing ROMs or are you just trying to root the phone with Magisk?

      I am asking so because its possible to root the G7 Power without installing TWRP at all.

    2. Thank you for your reply Dhananjay.

      I have tried proceeding and after the final step of “Once the flashing process finishes, hit the “Reboot System” button.” My phone just resets like its been factory reset.

      I am just trying to root my phone with Magisk. Is there another guide you could point me to?

      Thanks in advance

    3. Yes, that is because the fastboot -w command wipes the /data partition.

      If you’re just trying to root, you can do so by following the recommended method that involves patching the stock boot image through Magisk and then flashing the resultant patched boot image back to the phone.

      The guide I wrote is a bit out of date, so I would suggest following the instructions provided by the developer. If you need any help, just connect with me through our Facebook page. I will walk you through the process.

  2. I followed this exactly as outlined and everything worked out perfectly. I really appreciate the guidance because I am just a beginner at these things.
    Thank you very much for this.
    Bobby Eli

    1. Yes, as long as the bootloader unlock is supported by the official method, this tutorial will work.

Leave a Reply

Comments are moderated, and published only if they are relevant to the topic and add value in a constructive way. If you disagree with something, please be polite and respectful. We suggest you read our comment policy before commenting.