Unlocking the bootloader of a Moto G3

Before we commence our journey into mysteries of the Android operating system – and making changes to the OS! – on the Motorola G 3rd Generation smartphone, just a final word of warning. Unlocking the bootloader will void the phone’s warranty and, according to Motorola, “…may cause damage to the device or result in injury to users.” So, let’s consider the steps involved, but their implementation will be only for those of you who, like me, have no problem with this aspect of the process.

Warning Bootloader Unlocked

In addition to downloading and installing some specific software, as described below, the unlocking process requires the availability of a mini-USB to full-size USB cable that can be used to connect the phone to your computer.

Unlocking the Moto G3 requires implementing the Developer Options on the phone, turning on the phone’s USB debugging option, installing the Android Debug Bridge (ADB) and Fastboot software on a PC that can be connected to the phone with a USB cable, obtaining an unlock code from Motorola’s web site, and running some commands on the PC with the phone connected in fastboot mode.

So, we are going to enable USB debugging on the phone and install ADB and Fastboot on our PC. Why are we doing this?

USB debugging mode is also known as “developer mode”. It’s the process by which Android programmers can communicate directly with the phone’s software from their computer, normally using Android Studio and the SDK (Software Development Kit). Android Studio is currently about a 2 GB download, with even more software being added after the initial installation. We don’t need anything like the power that all this stuff provides, so we will use ADB (Android Debug Bridge) as a kind of mini-SDK. The Fastboot program is what we will use to enter commands to install new software on the phone.

The actual steps needed to unlock the Moto G3’s bootloader are given below. Note that this is a long post, mainly because there are several important steps to be taken, but also because I consider that considerable detail is necessary for new “Android developers” – like me!

(1) Backup User Data

I had read on the Internet that rooting a smartphone would eliminate all the user settings and files. On my phone, the only items that I needed to retain were my list of contacts and the digital photographs stored on the micro-SDcard. I also made a set of (hand-drawn) “screen maps” showing the locations of the icons for the apps that I had installed. This was to facilitate re-installation of the apps after the phone had been rooted.

Saving my contacts to disk was straightforward. I ran the Contacts app and selected the Import/Export option from the menu. I chose to “Export to a .vcf file” since my plan was to import this same file into the rooted phone. I saved the file to the phone’s SDcard. My digital photos. were already stored on the SDcard.

Now, all I had to do was to copy the newly-created VCF file, and the digital photos. from the phone’s SDcard to a folder on my computer’s hard drive. While this can be done using a USB cable connection, I adopted my usual method for such file transfer which is to use Software Data Cable and the Filezilla FTP client (see: A100 to Ubuntu File Transfer) to transfer the files wirelessly.

So, by following something like the above-noted process, your files will now be safely backed up, and you are ready for the next challenge!

(2) Enable USB Debugging Mode

On the phone, navigate to Settings – About Phone – Build Number, and tap on the build number seven times. A toast (a pop-up message) will be displayed: “You are now a developer!”

A “Developer options” menu item is now displayed on the phone. Select this option and make sure that, at the top of the screen, the toggle marked “On” is enabled. We also need to enable the “OEM unlocking” toggle further down the list of options. (Note on some phones, the option that is required to be enabled may be labeled “USB debugging”.)

(3) Login to Motorola’s Web Site

Next, on your computer, connect to Motorola’s web site for unlocking phones (http://tinyurl.com/j7dmzl7). The first page basically repeats the warning that the phone’s warranty will be invalidated by unlocking the bootloader. If, like me, you are happy to continue, click on the “Proceed Anyway” button, in order to login to Motorola’s site.

Rather than setting up a specific account with Motorola, I used an existing G-mail account for this purpose (i.e. the “Sign in with Google” button at the bottom of the page). I was careful to locate the userid and password necessary to access this G-mail account. Motorola sends the unlock code in an E-mail message to this address and I had to be able to retrieve it.

(4) Install the USB Drivers on the PC

The next page on Motorola’s site indicates “First, we’ll need to get your device ready to get the device ID and unlock key.”

Ignore Step 1 (Install the Android SDK). As noted above, this will install Android Studio which is a huge download. Later, we will install ADB and Fastboot instead of their more powerful cousin.

But, we do need to implement Step 2 – Install the latest Motorola USB Drivers. However, at the time of writing, the link on Motorola’s web page is broken and produces a 404 error. Use the following link instead:

https://mobilesupport.lenovo.com/ca/en/solution/MS88481

This allows downloading the installation file for the Motorola Device Manager (MotorolaDeviceManager_2.5.4.exe at the time of writing) that “…contains USB drivers and software to connect your Motorola phone or tablet to your computer using a USB cable.”

Run this EXE file in order to install the software on your PC. There is no need to do anything further with the device manager at this point. The program will load automatically when the phone is plugged into a USB port on the computer.

(5) Prepare to obtain the unlock code

Go back to the web page from Motorola’s web site that should still be displayed in your browser. We will now use this page – in a series of bizarre operations – to obtain the required unlock code.

Rather than simply being able to download it from Motorola’s site directly, we have to use ADB and Fastboot to issue commands to the PC, and a really strange process involving deciphering a code (the Device ID) to obtain another code (the unlock code)!

So, leave this page open in a tab in your browser. We will come back to it several times before we obtain the actual unlock code.

This may sound complex – or scary! – but, don’t despair, a detailed description of the steps involved is given below.

(6) Install ADB and Fastboot on the PC

First, we need to download the Minimal ADB and Fastboot software. Shrimp208, a user on the xdadevelopers web site, maintains a current installation package for this software. Visit his web page at http://forum.xda-developers.com/showthread.php?t=2317790 but, be careful about clicking download links. The page contains at least one advertisement featuring a large, green, Start Download button. This is NOT the software package you want. Scroll down to around the middle of the page and find the section labeled Downloads – For 32-bit and 64-bit Windows Operating Systems. Download Minimal ADB and Fastboot using the link labeled “Download Version 1.4.2 Here”.

Note that an alternative approach is to download and install the version of ADB and Fastboot that has been released by Google: Platform tools: Windows

Run the downloaded installation file (e.g. minimal_adb_fastboot_v1.4.2_setup.exe). This creates a folder at C:\Program Files (x86)\Minimal ADB and Fastboot.

Navigate to this folder and press Shift – Right-Click (i.e. hold down the Shift key and press the right mouse button). This brings up the context menu where you can select “Open command window here”. Note that, by default, in the Creators Update of Windows 10 this option is changed to “Open PowerShell window here”. Both of these shells will allow us to enter commands using the fastboot program. However, note that PowerShell requires a slightly-different variant of the normal DOS-type commands.

In Windows, the “normal” DOS-type command window takes commands in the form:
     fastboot devices

In a PowerShell window, commands are issued in the form:
     .\fastboot devices

Note that a “.\” prefix is required for PowerShell.

But first, we need to power down our phone, and then use the mini-USB to USB cable to connect the phone to the PC. (Windows will pop up a notification that the USB device isn’t recognized but, don’t worry, we are about to change this state of affairs!).

Now, we need to boot the Moto G3 into fastboot mode. Hold down the volume-down key and the power button at the same time for several seconds. Note that this can be tricky, especially if the phone is in a case that limits access to these buttons. The phone will reboot. Release the two buttons. The phone will display the “AP Fastboot Flash Mode (Secure)” screen.

Now, we go back to the command window on the PC. If you have a PowerShell window open, type:

.\fastboot devices

Fastboot will respond with a string of alpha-numeric characters (e.g. ZY2234QGLB     fastboot) which confirms that the connection has been made.

Next, for a PowerShell command window, type:

.\fastboot oem get_unlock_data

This time, fastboot responds with a number of lines of text, including lines similar to the following:

(bootloader) 3A55840886780068#5A593232333451
(bootloader) 474C42004D6F746F4733000000#8482
(bootloader) AA403C7B9BBC375978A9DE77EF180B9
(bootloader) 41259#822EC71600000000000000000
(bootloader) 0000000

This is the infamous “Device ID”. But, for some bizarre reason, it’s split across the five lines of text, and with spurious characters added [i.e. “(bootloader) “] . In order to use the Device ID on Motorola’s web page, we need to eliminate the redundant characters and consolidate the ID into a single string of 131 characters.

This is easy to do in a text editor, but take care to do it right. You need to eliminate all instances of (bootloader), all spaces, and the carriage return/line feeds at the end of each line, while leaving the hash (#) characters in place.

Alternatively, you can use Motorola’s on-line Unlock Data Scrub Tool. Copy the five text strings that were displayed from the get_unlock_data command and paste these into the box labelled “Unlock Data Scrub”. Include the entire text from all five lines. The scrub tool will take care of the extraneous characters. Click on the button labeled “Format my data”. The on-line tool will consolidate the text into a continuous string of characters.

Having used one of the above procedures, you now have a Device ID consisting of a single string of 131 characters. Copy this string and paste it into the text box on Motorola’s web page immediately above the blue button labeled “Can my device be unlocked?” Now, click on this button.

If everything went well, a “Request Unlock Key” button is now being displayed on the Motorola web page, immediately below the text describing the legal agreement for unlocking the bootloader.


If, instead, you receive a message indicating that “Your device does not qualify for bootloader unlocking”, try two things:

(1) try entering the code on the next day (it makes no sense, but this worked for me!, or

(2) follow the instructions for assistance at
Need Bootloader Unlock Help? Please post here! [ Edited ]

To obtain the unlock code, you must select the “I Agree” radio button immediately below the text that reads: “I agree to be bound by the terms of the legal agreement”. Now click on the “Request Unlock Key” and Motorola will, finally (!), send the unlock code to the E-mail address that you used to login to their site.

(7) Retrieve the unlock code

Login to your E-mail account and open Motorola’s message. The text will say something like:

   Here is the unique code to unlock the bootloader of your Motorola phone.

   Unlock Code: U6LLR4MDUC2EVZ5Q5DIY

   Please follow the instructions here to unlock your bootloader.

   Good Luck!

Now the “Good Luck!” bit doesn’t inspire major confidence, but the chances are that if you have got this far, the rest of the process for unlocking and rooting the phone will be a breeze.

(6) Unlock the bootloader

We are one command away! Copy the Unlock Code from the E-mail message. In the PowerShell window, enter the command:

.\fastboot oem unlock {paste your specific unlock code}

(i.e. in our example, enter:  .\fastboot oem unlock U6LLR4MDUC2EVZ5Q5DIY

Fastboot will respond with the message “Phone is successfully unlocked”. Congratulations, your Moto G3 now has an unlocked bootloader.

You can confirm this by unplugging the phone from the computer and the USB cable, and powering it down (use the volume keys to navigate to “POWER OFF” and select this menu option with the power key). Reboot the phone (note that the initial boot after unlocking the bootloader may take a little time) – and observe the shiny, red-and-white, “Warning Bootloader Unlocked” message. Success!

Now, we are ready to root the phone. But, after struggling through all of the above steps, let’s take a quick break to catch our breath!

References:

How to unlock Motorola Moto G 2015 3rd Gen Bootloader,Moto X 2015 & all other motorola devices
http://goo.gl/fnpbGk

USB Debugging Mode
https://www.kingoapp.com/help/usb-debugging-mode.htm

What is USB debugging?
https://www.androidpit.com/how-to-enable-usb-debugging-on-any-android-device

READY TO UNLOCK YOUR DEVICE’S BOOTLOADER?
https://motorola-global-portal-en-ca.custhelp.com/app/standalone/bootloader/unlock-your-device-a

Where can I download the USB drivers for my device?
https://mobilesupport.lenovo.com/ca/en/solution/MS88481
A100 to Ubuntu File Transfer
https://linuxnorth.wordpress.com/2012/04/23/a100-to-ubuntu-file-transfer/

Software Data Cable (Addendum)
https://linuxnorth.wordpress.com/2012/04/24/software-data-cable-addendum/

FileZilla – The free FTP solution
https://filezilla-project.org/

[TOOL]Minimal ADB and Fastboot [1-6-17]
http://forum.xda-developers.com/showthread.php?t=2317790

Google makes ADB and fastboot available without Android Studio or SDK
http://www.androidauthority.com/google-adb-fastboot-platform-tools-standalone-download-741582/

Platform tools: Windows
https://dl.google.com/android/repository/platform-tools-latest-windows.zip

Need Bootloader Unlock Help? Please post here! [ Edited ]
https://forums.lenovo.com/t5/MOTO-G-MOTO-G-4G-LTE-1st-Gen/Need-Bootloader-Unlock-Help-Please-post-here/m-p/3024663

Advertisements
This entry was posted in Android, Moto G3 and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s