yashsingh1/xdaforums huggingface dataset:
[Moto G5 Guides, News, & Discussion] TheFixItMan:
Is your bootloader unlocked?

You could unlock the bootloader but you may need adb debugging enabled so unless you have that already enabled or you have a custom recovery (twrp) then I don't think you can enable it

Did you try flashing the rest of the firmware - you don't need to flash gpt or bootloader but I suspect the issue here is the kernel boot.img

You could also just try going into recovery mode and performing a factory reset - probably won't work if you have changed files but its always an option

How to factory reset

Power the phone completely off.

Press and hold the “Volume Down” and the “Power” buttons simultaneously. Release both buttons when you see the menu appears.

Use the “Volume Down” button to toggle the selection on the menu to “Recovery mode“.

Press the “Power” button to choose the “Recovery mode” selection.

A screen should appear with the Android robot. While on this screen hold down the “Power” button while pressing and releasing the “Volume Up” button.

Continue to hold “Power” until you see the Android Recovery menu, characterized with an Android lying on its back.

Use the Volume Up/Down buttons to toggle the menu selection to “wipe data / factory reset“. Press the “Power” button the choose the option.

Use the Volume Up/Down buttons to toggle the menu selection to “Yes – erase all user data“. Press the “Power” button to select it.
[Moto G5 Guides, News, & Discussion] mimox:
No, the bootloader is locked, it has never been unlocked. I tried getting the unlock code yesterday but even that failed.

I tried flashing boot.img a number of times, it does not work. I cannot even get into recovery, it shows some error and then drops me back into fastboot...
[Moto G5 Guides, News, & Discussion] TheFixItMan:
Looks like your only option would be a motherboard replacement

Also you won't be able to unlock it because you need adb debugging enabled

If the device doesn't boot and you haven't got a custom recovery installed (which you won't because that requires an unlocked bootloader) to manually change the build.prop flag for adb debugging you won't be able to complete the steps required

The problem with boot.img is the ones in firmware posted online are almost never signed by Motorola and so you can't flash unsigned images unless you have an unlocked bootloader

This is also the reason why people hard brick their device - even though they have flashed back to stock rom the boot.img is unsigned so when they flash otas it rejects the boot.img as its not signed & will brick the phone
[Moto G5 Guides, News, & Discussion] riyan65:
Can you post the logs of the device.
[Moto G5 Guides, News, & Discussion] antonioveneroso:
Try to bring it back to life

Last week I bricked my moto G5 , now, thanks to this post, I am in bootloader. When I try this command

fastboot flash partition gpt.bin

I get the next error:

G:\moto\MOTO\platform-tools>fastboot flash partition gpt.bin
(bootloader) has-slot:partition: not found
(bootloader) is-logical:partition: not found
Sending 'partition' (45 KB) OKAY [ 0.172s]
Writing 'partition' (bootloader) Validating 'gpt.default.xml'
(bootloader) Security version downgrade
(bootloader) Image primary_gpt failed validation
(bootloader) Preflash validation failed
(bootloader) Cancelling 'gpt.default.xml'
FAILED (remote: '')
fastboot: error: Command failed

It says something about security version downgrade, but I am pretty sure I downloaded the last rom version available at mirrors lolinet dot com (at least that's what I think), can you help me what else I can do? I really want my phone back...

Thank you for all your help!

Edit:

The first time I used the microSD, when I selected start, the phone started fine. Then shutted it down, enter to bootloader and copy /paste all the commands. Now it doesn't start the android, it just stays in bootloader, and in bootloader logs says Fastboot reason: reboot mode set to fastboot :(
[Moto G5 Guides, News, & Discussion] TheFixItMan:
You will only be able to start the phone normally if gpt and bootloader flash successfully and you have removed the mmcblk0 sd card from the device

You should be able to start the phone if you flash the rest of the firmware without gpt and bootloader if you boot to fastboot via the mmcblk0 sd card and selecting the boot normally option (I can't remember exact wording)

You can also try pulling the battery and trying the above or try

fastboot reboot

While the phone is in bootloader mode from your terminal window

As stated on first post you will get a security downgrade error and gpt and bootloader will not flash if the firmware you are to flash is too old
[Moto G5 Guides, News, & Discussion] antonioveneroso:
I understand all you say.

Is it possible that, when I tried to re flash the phone, the update was done in the microSD instead the phone? Or that the reflash process messed with the microSD? As I wrote, the first time I could start the phone (on bootloader I selected "Start" and then it started). Then I restarted the phone, and again in bootloader I copied / pasted all the commands (at the same time) in the command window. It started to do all the job, and when it finished and checked "the log" (scrolled up the command window) I realized the error posted in my previous post.

Since then, the phone doesn't start android, no matter if it is connected to pc, or if i select "Start" in the bootloader, or if I write "fastboot reboot": it just restart and go into the bootloader, and in the bootloader log, it only says: "Fastboot reason: reboot mode set to fastboot"

I read that writing "fastboot oem fb_mode_clear" should solve the situation, but already tried and still stuck in bootloader.

Thank you for your patience and all your help
[Moto G5 Guides, News, & Discussion] TheFixItMan:
Things you can try

When in fastboot mode hold the power button down until the device restarts

Pull the battery - wait a few mins - put battery back in and turn on phone

Try the tool in the attachment to exit fastboot mode and boot normally (I presume option 9 then 6)

Perform a factory reset in recovery mode (see a few posts above for instructions)

This is all assuming you have successfully flashed gpt & bootloader - It may work if you haven't

All firmware is flashed to the phone

The sdcard is purely to boot into fastboot mode to allow you to flash gpt and bootloader to allow normal phone booting
[Moto G5 Guides, News, & Discussion] antonioveneroso:
Well, I'm not sure what happen. Today I plugged the phone to charge it, and it started in bootloader automatically, so I removed the microSD. Then I plugged it again and in the display showed the charging logo!!! Left it fully charge and turned it on, it's working again!!!

Thank you for your help, TheFixItMan!
[Moto G5 Guides, News, & Discussion] Sucal21:
hello I have the moto g5 cedric xt1672 but this half seems not to bore for me.
[Moto G5 Guides, News, & Discussion] TheFixItMan:
If you want want help you have to

1- write in understandable English

2 - give full details

3 - following on from 2 provide logs/output of what you are doing including errors etc

Comments like yours will get zero help from me as it's impossible to give any useful support
[Moto G5 Guides, News, & Discussion] hellomotog5:
Hi! I am being able to enter the AP Fastboot Flash Mode (secure), I accidentally formatted the internal storage so my partition table is all gone now however I cant flash the gpt.bin to get the partition table back, validation error i have tried around 6 different firmwares, I am using moto g5 16 gb storage and 2gb internal ram bought in Europe I am quite positive the model number is XT6176 which i could previously verify in the fastboot mode now it just shows product/variant cedric 00000000000000000000 16 gb P5 can you please help me with the firmware or I am doing something wrong
[Moto G5 Guides, News, & Discussion] TheFixItMan:
If you formatted internal storage in twrp this does not touch the partition table - it's the same as doing

fastboot erase userdata

However if you did

fastboot erase all

You will need a new motherboard

If you can still get into fastboot mode (without the use of the sd card image) there's nothing wrong with your partition table

Just flash the rest of the firmware that's of the same android version eg android 7 or 8 (the date of the firmware doesn't matter)

You usually get validation errors if you have a locked bootloader but I assume your bootloader is unlocked - if it's locked you may need a new motherboard unless you can find a correctly signed bootloader and gpt firmware
[Moto G5 Guides, News, & Discussion] hellomotog5:
Hey iFixitman thanks for the reply I had given up hope on moto g5 but saw your post and my hope is still alive. Actually I had install postmarketOs and was working perfectly, but I was really dumb to try to setup-alpine and erase the device by using mkfs.ext4 i thought it would install the os on my system because everytime i rebooted i had to flash the OS again and then i just had this white blinking led. I have copied the mmcblk0.img in my sd and thanks to that i can get into fastboot. Now I am stuck even the first step fastboot oem fb_mode_set dont work and I have tried recent firmwares the current one I am using is XT1676_CEDRIC_RETEU_DS_8.1.0_OPPS28.85-13-6_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml and when I try flashing twrp recovery I get bootloader permission denied
[Moto G5 Guides, News, & Discussion] TheFixItMan:
Can you post a screenshot of the first three lines of flashing the firmware

fastboot oem fb_mode_set

fastboot flash partition gpt.bin

fastboot flash bootloader bootloader.img

And can you use the following platform-tools (assuming Windows)

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

Also are you able to flash the rest of the firmware from

fastboot flash logo logo.bin

If you can your device will boot if you select start normally from the bootloader menu

If you have added fastboot to the environmental variables change it to the new version but don't worry if you haven't - just navigate manually to the directory via cmd/terminal (also place firmware in same folder as fastboot.exe)
[Moto G5 Guides, News, & Discussion] hellomotog5:
fastboot oem fb_mode_set

FAILED (remote: '')

fastboot: error: Command failed

fastboot flash partition gpt.bin 1 ↵

(bootloader) has-slot:partition: not found

(bootloader) is-logical:partition: not found

Sending 'partition' (45 KB) OKAY [ 0.177s]

Writing 'partition' (bootloader) Validating 'gpt.default.xml'

(bootloader) Image primary_gpt failed validation

(bootloader) Preflash validation failed

(bootloader) Cancelling 'gpt.default.xml'

FAILED (remote: '')

fastboot: error: Command failed

fastboot flash bootloader bootloader.img 1 ↵

(bootloader) has-slot:bootloader: not found

(bootloader) is-logical:bootloader: not found

Sending 'bootloader' (5179 KB) OKAY [ 0.344s]

Writing 'bootloader' (bootloader) Validating 'bootloader.default.xml'

(bootloader) Invalid partition name aboot

(bootloader) Invalid partition name rpm

(bootloader) Invalid partition name tz

(bootloader) Invalid partition name devcfg

(bootloader) Invalid partition name cmnlib

(bootloader) Invalid partition name cmnlib64

(bootloader) Invalid partition name keymaster

(bootloader) Invalid partition name prov

(bootloader) Invalid partition name sbl1

(bootloader) Cancelling 'bootloader.default.xml'

FAILED (remote: '')

fastboot: error: Command failed

I am using linux I don't have a windows machine so.
[Moto G5 Guides, News, & Discussion] TheFixItMan:
Is your bootloader unlocked?

I've only generally seen these errors with a locked bootloader due to firmware signing issues or flashing incorrect firmware

Make sure your platform tools is the latest version too

This is the Linux version

https://dl.google.com/android/repository/platform-tools-latest-linux.zip

I would also try with this firmware

https://mirrors.lolinet.com/firmwar...ubsidy-DEFAULT_regulatory-DEFAULT_CFC.xml.zip

Are you able to flash the rest of the firmware after bootloader? If you can the device will boot by selecting start normally from the bootloader menu although the sdcard image will need to remain in the device to boot it

Are you able to get into recovery mode from bootloader menu?

Stock recovery shows an android with its stomach open - you can then use key presses (power Vol up I think) to show menu and do a factory reset and then try flashing firmware again
[Moto G5 Guides, News, & Discussion] uachito:
ayudame

que tal amigo, te escribo porque veo que pudiste revivir tu celular, espero que sea el mismo modelo que el mio MOTO G5 xt1671, me podras ayudar a revivir el mio, diciendome donde conseguiste el software necesario, y si no es mucha molestia, los pasos para lograrlo.

de antemano muchas gracias

saludos desde mexico
[Moto G5 Guides, News, & Discussion] TheFixItMan:
As this is your first post and you have just joined you will be well aware of the rules of xda you just signed up to

https://xdaforums.com/announcement.php?a=81

Let me point out number 4

And everything you need - method etc is on the first post

I'm sure a little Google search can get you Linux & how to put it on a USB and one would assume you already have fastboot setup to flash firmware
[Moto G5 Guides, News, & Discussion] hellomotog5:
https://imgur.com/a/NgyFrlG here is a link to the image of my device

Hi I can't get into recovery mode, and there is no option for factory reset i tried with this firmware I am getting the same error with GPT validation.
[Moto G5 Guides, News, & Discussion] TheFixItMan:
Sounds like you may need a motherboard replacement or take your phone to a repair shop and the they may be able to use a JTAG to flash the firmware back
[Moto G5 Guides, News, & Discussion] Markfa:
Wrong firmware messed up G5 XT1676

Hi there,

this is my first post and I need to apologize for starting with a question concering me having trouble with my unlocked Moto G5. Thanks for the great source of information which enabled me to have LOS 14 on my phone. Eventually I was about to switch to LOS 16 and although I have tried hard to follow the excellent guide on xda-forum I unfortunately messed it up somehow.

This is what I did - as far as I can recollect:

Phone was unlocked and ran flawlessly on LOS 14.1

Updating to TWRP 64bit

Installing Nougat via TWRP

Installing Oreo via TWRP

This led to a boot loop and I could not access my phone via fastboot anymore. I expected to have it bricked and tried to get it back by mmcblk0.img and installing firmware.

As I later found out, the phones ID had changed in some point of this procedure and therefore could not be recognized anymore via fastboot due to a wrong ID in my udev rules. When I had corrected this, the phone was not listed as a device in adb but it accepted fastboot commands.

As far as I understand I have made the first big mistake when installing the firmware via fastboot. "getvar all" gives me a CID32 but all XT1676 firmwares I found were CID50 and such I tried to install.

Now I got stuck. I have successfully reinstalled TWRP. Installing Nougat via TWRP says that there is no Cache partition. Installing firmware via fastboot says (bootloader) is-logical:bootloader: not found. The phone seems to be still unlocked (bootloader: flashing_unlocked)

I am sorry to ask for your help at this point when everything seems to be fairly messed up. I would appreciate any good advice. Thanks very much!

Markus
[Moto G5 Guides, News, & Discussion] Morricorne:
Why i cant flash Stock 8.1 Rom. And relock bootloader?

Always i have this device isnt trusted when i try flash stock and relock. Any help with this?

I only want fully back to Stock.
[Moto G5 Guides, News, & Discussion] TheFixItMan:
If you have twrp installed have you tried wiping cache partition (and system & data)

You will have to post the full fastboot output of trying to flash gpt and bootloader as what you have posted is normal output behaviour
[Moto G5 Guides, News, & Discussion] TheFixItMan:
This has nothing to do with a hard bricked device so please do not reply as I won't respond further to off top posts

And you should never try and re-lock the bootloader - it is possible but only if everything is officially signed

The problem is if you brick your device again you won't be able to flash firmware as you will get permission denied errors

Note process of commands to lock bootloader are slightly different from the process just to flash firmware as per first post

If you want to just remove the unlock bootloader warning just flash a modded logo.bin

https://xdaforums.com/g5-plus/how-to/logo-fix-g5-logo-bin-t3610456

(above will also work on moto g5)
[Moto G5 Guides, News, & Discussion] Markfa:
Thanks a lot for your quick and helpful reply. This time the phone booted! As for avoiding to step into trouble again could you maybe confirm that further steps to LOS 16 should be a TWRP flash of Nougat -> Oreo and then LOS or is it okay to directly flash LOS after now having Oreo Firmware? Apologies for this ignorant question!

Anyway, this is the fastboot output for bootloader and gpt flash - wipe was done before:

[markus@W520 fw]$ fastboot flash partition gpt.bin

(bootloader) is-logical:partition: not found

Sending 'partition' (45 KB) OKAY [ 0.172s]

Writing 'partition' (bootloader) Validating 'gpt.default.xml'

(bootloader) Committing 'gpt.default.xml'

(bootloader) - flashing 'gpt_main0.bin' to 'partition:0'

(bootloader) Flashing primary GPT image...

(bootloader) Flashing backup GPT image...

OKAY [ 0.082s]

Finished. Total time: 0.260s

[markus@W520 fw]$ fastboot flash bootloader bootloader.img

(bootloader) is-logical:bootloader: not found

Sending 'bootloader' (5179 KB) OKAY [ 0.341s]

Writing 'bootloader' (bootloader) Validating 'bootloader.default.xml'

(bootloader) Committing 'bootloader.default.xml'

(bootloader) - flashing 'emmc_appsboot.mbn' to 'aboot'

(bootloader) - flashing 'rpm.mbn' to 'rpm'

(bootloader) - flashing 'tz.mbn' to 'tz'

(bootloader) - flashing 'devcfg.mbn' to 'devcfg'

(bootloader) - flashing 'cmnlib.mbn' to 'cmnlib'

(bootloader) - flashing 'cmnlib64.mbn' to 'cmnlib64'

(bootloader) - flashing 'keymaster.mbn' to 'keymaster'

(bootloader) - flashing 'prov.mbn' to 'prov'

(bootloader) - flashing 'sbl1.mbn' to 'sbl1'

OKAY [ 0.754s]

Finished. Total time: 1.100s
[Moto G5 Guides, News, & Discussion] TheFixItMan:
Your fastboot output is all normal

Latest LOS 16 for this device (and newer custom roms) is based on oero vendor blobs

You need to be on oero firmware (no need to flash nougat as you don't want to downgrade & you shouldn't downgrade firmware without good reason)

Once you are on oero firmware just flash a 64bit twrp eg

https://drive.google.com/open?id=1MLlljM7BzMj9Da57LeyBHyg81cHdW1cB

Then wipe system cache & format data & flash rom zip gapps magisk etc
[Moto G5 Guides, News, & Discussion] Cloudane:
Managed to download the file from Mega with some persistence, thanks to work having two IP addresses. Mega itself is ridiculous, it says wait 30 minutes then the time is up and it says wait 2 hours, then the 2 hours is up and it says wait 7 hours... absolute BS. Got around it by using the Mega Sync application then when it got to the 5GB limit, quit, switch gateway to the other IP address, relaunch Mega Sync and resume.

Is there anywhere worth re-uploading it to that doesn't have a silly limit or is likely to lead to a ban / legal problems?
[Moto G5 Guides, News, & Discussion] TheFixItMan:
No issue with mega here - just tried downloading it and it took me 20mins which is very good for a file sharing service

It's a large file 5.3gb so you need a fast and stable connection

I suggest creating a mega account and then importing the file into your own account - you can then easily download your own files

Might re-upload to android file host as it looks like it's no longer on their server (they are always having issues) but their speeds are much slower

Google drive/drop box with large files they become unavailable if many people download the file plus they don't offer much free storage

So the answer in short is no
[Moto G5 Guides, News, & Discussion] Cloudane:
You must have a premium account then? On the free one it stops at 5.0GB and says please either cough up some money or wait a seemingly indefinite $shifting_goalposts length of time.

Solutions it seems are using the app and quit/relaunch when you get a new IP address (reconnect your modem or if they give you a fixed IP maybe finish it off via tethering to a mobile phone that isn't currently broken) or just sucking it up and paying for a month. Or possibly waiting out a full 24 hours, assuming it doesn't just say "now wait another 48 hours"
[Moto G5 Guides, News, & Discussion] TheFixItMan:
I don't have a premium account

Just import it into your own account then sync it or download it via the app after you have imported it (note that sdcard card if downloading via phone needs to be exfat or ntfs as fat32 has a 4gb file limit)
[Moto G5 Guides, News, & Discussion] Cloudane:
Ah didn't know about that workaround. Still, my workaround of downloading it at work with 2 IP addresses did the trick

Anyway, it lives! Thought it was dead forever. Problem was last night I wanted to get back to stock and re-lock. lolinet was offline so I couldn't get the latest ROM and tried to flash the stock 7.1 from another thread, and made the error of overwriting the bootloader with the older 7.1 version which hard bricked it...

I can confirm the rescue SD card works on the UK Moto G5 which is an XT1675. Once the SD card got me into the bootloader I was able to follow the rest of the commands from the OP because YAY, lolinet is back, and I downloaded the latest RETGB firmware which is specific for my model.

Getting back to a locked state involved repeatedly issuing 'fastboot oem lock' and re-sending various partition images until it was satisfied everything was signed and then it locked, a few partitions had to be re-sent and now all is like new again.

Many thanks for the image and instructions!
[Moto G5 Guides, News, & Discussion] TheFixItMan:
For those who struggle with Mega or have unstable internet connections I have uploaded the image file in three parts to Android File Host

Follow extract instructions on first post
[Moto G5 Guides, News, & Discussion] manhazao:
I created an account just to say THANK YOU!

Thank you all that united to create this method, specially TheFixItMan for starting the post/guide.

After an unsuccessful attempt to downgrade from 8.1 to 7.0 my phone hard bricked. So I purchased a SanDisk Ultra 64gb microsd card and did all the steps exactly as it is described, except for the "if your sdcard is seen like /dev/sdb1 or /dev/mmcblk0p1", mine was /dev/sdd1, so i changed the code to: sudo dd bs=4M if=mmcblk0.img of=/dev/sdd status=progress oflag=sync and it worked flawlessly. (XT1672 from Brazil)
[Moto G5 Guides, News, & Discussion] riyan65:
[MENTION=4728903]TheFixItMan[/MENTION]

I am getting this error and not able to flash the bootloader an gpt. My device is locked to
[Moto G5 Guides, News, & Discussion] TheFixItMan:
Gpt has to flash first else bootloader will not flash - I don't know what your error is for gpt

Also if your bootloader is locked it probably won't work as you will probably get permission denied when trying to flash gpt

Did you unlock the bootloader and the try to lock it again? I would never do that as if you brick it you may never be able to unbrick it with this method but see link below

Also I see you are flashing files for potter which is moto G5 plus

This guide (although it will probably be exactly the same) is for Cedric which is Moto G5

If you have a Moto G5 make sure you are flashing Cedric firmware & if you have a Moto G5 plus please goto the the Moto G5 plus forum

Try reading this if you have a moto g5 plus potter

https://xdaforums.com/showpost.php?p=73268905