Fix for "bad key" on G7 Play - Moto G7 Play Questions & Answers

Hi Everyone,
Those of you who have unlocked the OEM with a key, realize the 'bad key' error that shows up afterwards.
If you are trying to restore your phone back to factory image, the default images can be downloaded here:
Link to Factory Images
lexiyuri has a post on restoring the G7 to stock images as described here.
However, for me the bad key error didn't go away and finally ended up with additional steps in between to lock the oem. The commands below in that sequence worked for me. I don't see the 'bad key' error any more. If you're also struggling with the 'bad key' display on your g7 play, and would like to restore to stock properly, here's the code.
Code:
fastboot oem fb_mode_set
fastboot flash partition gpt.bin
fastboot flash bootloader bootloader.img
fastboot flash modem NON-HLOS.bin
fastboot flash fsg fsg.mbn
fastboot erase modemst1
fastboot erase modemst2
fastboot flash dsp adspso.bin
fastboot oem lock begin
fastboot oem lock begin
fastboot oem lock
fastboot oem lock
fastboot oem lock
fastboot flash boot boot.img
fastboot oem lock
fastboot flash logo logo.bin
fastboot flash dtbo dtbo.img
fastboot flash system system.img_sparsechunk.0
fastboot flash system system.img_sparsechunk.1
fastboot flash system system.img_sparsechunk.2
fastboot flash system system.img_sparsechunk.3
fastboot flash system system.img_sparsechunk.4
fastboot flash system system.img_sparsechunk.5
fastboot flash system system.img_sparsechunk.6
fastboot flash system system.img_sparsechunk.7
fastboot flash system system.img_sparsechunk.8
fastboot flash system_b system_b.img_sparsechunk.0
fastboot flash system_b system_b.img_sparsechunk.1
fastboot flash system_b system_b.img_sparsechunk.2
fastboot flash vendor vendor.img_sparsechunk.0
fastboot flash vendor vendor.img_sparsechunk.1
fastboot flash oem oem.img
fastboot flash oem_b oem_other.img
fastboot erase DDR
fastboot erase cache
fastboot erase carrier
fastboot erase userdata
fastboot oem fb_mode_clear
fastboot reboot
Hope this helps,

First of all this is a guide to lock your bootloader. You shouldn't provide a link to retail builds for this. Always use the current builds matching to your specific software channel.
Before you run any lock command you must check if your system is running. Finish the installation wizard and do a reboot. After that you should run the oem lock command. The very last step is to deactivate the OEM unlock option.

Related

OEM Unlocking Greyed out "flashing_unlocked" in fastboot?

I decided to go back to stock when I learned that the device is receiving Oreo (a bit far too late IMO), but for whatever reason, Android confirms that my bootloader is unlocked, but will not agree to allow me to run
fastboot oem lock to lock the bootloader. Any idea on how to fix this?
ap4ss3rby said:
I decided to go back to stock when I learned that the device is receiving Oreo (a bit far too late IMO), but for whatever reason, Android confirms that my bootloader is unlocked, but will not agree to allow me to run
fastboot oem lock to lock the bootloader. Any idea on how to fix this?
Click to expand...
Click to collapse
Once you have download stock firmware run these commands in fastboot
Note all data on the internal storage will be erased including pictures downloads etc
fastboot oem lock begin
fastboot oem fb_mode_set
fastboot flash logo logo.bin
fastboot flash boot boot.img
fastboot flash recovery recovery.img
fastboot flash dsp adspso.bin
fastboot flash oem oem.img
fastboot flash system system.img_sparsechunk.0
fastboot flash system system.img_sparsechunk.1
fastboot flash system system.img_sparsechunk.2
fastboot flash system system.img_sparsechunk.3
fastboot flash system system.img_sparsechunk.4
fastboot flash modem NON-HLOS.bin
fastboot erase modemst1
fastboot erase modemst2
fastboot flash fsg fsg.mbn
fastboot erase cache
fastboot erase userdata
fastboot oem fb_mode_clear
fastboot oem lock

Z2 with no OS. Need help to get it back

Hello everbody,
Here is my story of how I managed it to have to OS on my Z2 Force (XT1789-6 with 6gb). I wanted to have lineagos on my smartphone and installed it before on my smartphone therefore I thought it would be easy.
1. I visited the official page and followed there instruction until the twrp instruction
HTML:
https://wiki.lineageos.org/devices/nash/install
. I did an oem unlock and installed twrp temporally (fastboot boot twrp-3.2.3-1-nash.img) and did a full backup.
2. I was reading on this forum that I need Oreo on my phone to install lineage, therefore I tried to update it. All attempts to update it failed. I was able to download updates to my phone and it started to install but it always failed.
3. I tried to flash the fitting Oreo Version on my phone (XT1789—06) OPXS27.109-49-5 from
HTML:
https://forum.xda-developers.com/z2-force/development/factory-image-moto-z2-force-nash-retail-t3699306
with the sequence in #5 but it would only flash the bootloader and fails for the rest (erase works).
I flashed no gpt.bin!
*(fastboot flash bootloader bootloader.img) -> only when needed!
fastboot flash modem NON-HLOS.bin
fastboot flash fsg fsg.mbn
fastboot erase modemst1
fastboot erase modemst2
fastboot flash bluetooth BTFM.bin
fastboot flash dsp adspso.bin
fastboot flash logo logo.bin
fastboot flash boot boot.img
fastboot flash system system.img_sparsechunk.0
fastboot flash system system.img_sparsechunk.1
fastboot flash system system.img_sparsechunk.2
fastboot flash system system.img_sparsechunk.3
fastboot flash system system.img_sparsechunk.4
fastboot flash system system.img_sparsechunk.5
fastboot flash system_b system_b.img_sparsechunk.0
fastboot flash system_b system_b.img_sparsechunk.1
fastboot flash system_b system_b.img_sparsechunk.2
fastboot flash system_b system_b.img_sparsechunk.3
fastboot flash oem oem.img
fastboot erase cache
fastboot erase carrier
fastboot erase ddr
fastboot reboot
Click to expand...
Click to collapse
Fastboot menu now showed a modified Version
4. Since the official website does not tell about having Oreo on you smartphone I wanted to give it a try and proceeded with their instruction. I wiped the system and tried to install lineage with help of TWRP with resulted in Error 255.
5. I tried to Recover with TWRP but it told me that no partition is selected. Fastboot menu shows that there is no partition a/b.
I tried to flash Nougat from the same source like Oreo which works for bootloader (and gpt.bin) and fails for the rest
xxx>fastboot flash modem NON-HLOS.bin
Sending 'modem__a' (97411 KB) OKAY [ 2.684s]
Writing 'modem__a' (bootloader) Invalid partitio
n name modem__a
FAILED (remote failure)
Finished. Total time: 2.700s
6. No it shows me in fastboot that I have an unmodified oem locked phone. On start up it tells me that I have a corrupted phone and instead of the yellow unlocked bootloader warning its red. Its starts over and over again until I start fastboot.
Can you suggest me how I can get back to stock or to lineage?
b.bew said:
Hello everbody,
Here is my story of how I managed it to have to OS on my Z2 Force (XT1789-6 with 6gb). I wanted to have lineagos on my smartphone and installed it before on my smartphone therefore I thought it would be easy.
1. I visited the official page and followed there instruction until the twrp instruction
HTML:
https://wiki.lineageos.org/devices/nash/install
. I did an oem unlock and installed twrp temporally (fastboot boot twrp-3.2.3-1-nash.img) and did a full backup.
2. I was reading on this forum that I need Oreo on my phone to install lineage, therefore I tried to update it. All attempts to update it failed. I was able to download updates to my phone and it started to install but it always failed.
3. I tried to flash the fitting Oreo Version on my phone (XT1789—06) OPXS27.109-49-5 from
HTML:
https://forum.xda-developers.com/z2-force/development/factory-image-moto-z2-force-nash-retail-t3699306
with the sequence in #5 but it would only flash the bootloader and fails for the rest (erase works).
Fastboot menu now showed a modified Version
4. Since the official website does not tell about having Oreo on you smartphone I wanted to give it a try and proceeded with their instruction. I wiped the system and tried to install lineage with help of TWRP with resulted in Error 255.
5. I tried to Recover with TWRP but it told me that no partition is selected. Fastboot menu shows that there is no partition a/b.
I tried to flash Nougat from the same source like Oreo which works for bootloader (and gpt.bin) and fails for the rest
xxx>fastboot flash modem NON-HLOS.bin
Sending 'modem__a' (97411 KB) OKAY [ 2.684s]
Writing 'modem__a' (bootloader) Invalid partitio
n name modem__a
FAILED (remote failure)
Finished. Total time: 2.700s
6. No it shows me in fastboot that I have an unmodified oem locked phone. On start up it tells me that I have a corrupted phone and instead of the yellow unlocked bootloader warning its red. Its starts over and over again until I start fastboot.
Can you suggest me how I can get back to stock or to lineage?
Click to expand...
Click to collapse
Try this commands:
fastboot --set-active=_a
pause
fastboot reboot bootloader
fastboot getvar max-sparse-size
fastboot oem fb_mode_set
fastboot flash partition gpt.bin
fastboot flash bootloader_a bootloader.img
fastboot flash modem_a NON-HLOS.bin
fastboot flash fsg_a fsg.mbn
fastboot flash bluetooth_a BTFM.bin
fastboot flash dsp_a adspso.bin
fastboot flash logo_a logo.bin
fastboot flash boot_a boot.img
fastboot flash system_a system.img_sparsechunk.0
fastboot flash system_a system.img_sparsechunk.1
fastboot flash system_a system.img_sparsechunk.2
fastboot flash system_a system.img_sparsechunk.3
fastboot flash system_a system.img_sparsechunk.4
fastboot flash system_a system.img_sparsechunk.5
fastboot flash oem_a oem.img
fastboot erase modemst1
fastboot erase modemst2
fastboot erase carrier
fastboot erase cache
fastboot erase userdata
fastboot erase ddr
fastboot flash fsg fsg.mbn
fastboot flash bluetooth BTFM.bin
fastboot oem fb_mode_clear
fastboot -w
fastboot --set-active=_b
fastboot reboot bootloader
fastboot getvar max-sparse-size
fastboot oem fb_mode_set
fastboot flash partition gpt.bin
fastboot flash bootloader_b bootloader.img
fastboot flash modem_b NON-HLOS.bin
fastboot flash fsg_b fsg.mbn
fastboot flash bluetooth_b BTFM.bin
fastboot flash dsp_b adspso.bin
fastboot flash logo_b logo.bin
fastboot flash boot_b boot.img
fastboot flash system_b system.img_sparsechunk.0
fastboot flash system_b system.img_sparsechunk.1
fastboot flash system_b system.img_sparsechunk.2
fastboot flash system_b system.img_sparsechunk.3
fastboot flash system_b system.img_sparsechunk.4
fastboot flash system_b system.img_sparsechunk.5
fastboot flash oem_b oem.img
fastboot erase modemst1
fastboot erase modemst2
fastboot erase carrier
fastboot erase cache
fastboot erase userdata
fastboot erase ddr
fastboot flash fsg fsg.mbn
fastboot oem fb_mode_clear
fastboot -w
fastboot --set-active=_a
fastboot reboot bootloader
Wow thanks. Worked out perfectly.
So many thanks, this helped me from a hard brick

Problems relocking bootloader on Moto G5S

After running into some issues with my custom ROM, I decided to flash back the Stock firmware on my Moto G5S. In that process I also tried to relock my bootloader but I ran into some issues that I couldnt find an answer to on the Internet.
The first issue was that I couldnt flash the gpt.bin (not exactly sure what it is) and got the error message that it was a downgrade which wasnt possible. The flashing of the other files went without problems at all and also the phone booted sucessfully. So does that gpt.bin matter when flashing the Stock Rom or can I just ignore it?
I doubt that because when I try to run oem lock it gives back an error and says that I had to check "Allow OEM-Unlock" in Developer settings which isn't possible because obviously the bootloader is already unlocked and so it is greyed out.
So what did I do wrong and how do I lock my bootloader again?
DOWNLOAD OREO ROM AND TRY THIS
fastboot oem fb_mode_set
fastboot flash partition gpt.bin
fastboot flash bootloader bootloader.img
fastboot flash logo logo.bin
fastboot flash boot boot.img
fastboot flash recovery recovery.img
fastboot flash dsp adspso.bin
fastboot flash oem oem.img
fastboot flash system system.img_sparsechunk.0
fastboot flash system system.img_sparsechunk.1
fastboot flash system system.img_sparsechunk.2
fastboot flash system system.img_sparsechunk.3
fastboot flash system system.img_sparsechunk.4
fastboot flash system system.img_sparsechunk.5
fastboot flash system system.img_sparsechunk.6
fastboot flash system system.img_sparsechunk.7
fastboot flash system system.img_sparsechunk.8
fastboot flash system system.img_sparsechunk.9
fastboot flash modem NON-HLOS.bin
fastboot erase modemst1
fastboot erase modemst2
fastboot flash fsg fsg.mbn
fastboot erase cache
fastboot erase userdata
fastboot erase customize
fastboot erase clogo
fastboot oem fb_mode_clear
fastboot oem lock
fastboot oem lock
fastboot reboot
That is basically what i already tried except of the two lines erase customize and erase clogo. But I'm getting permission denied errors with these and my bootloader still wont lock.
Is there any way to widen the permissions you have in the bootloader?

My Device doesn't turn on anymore

I was suppose to relock my bootloader, looked on YouTube and Google for answers. And tried this set of commands in the Cmd:
fastboot oem lock
fastboot oem lock
fastboot flash oem oem.img
fastboot flash system system.img_sparsechunk.0
fastboot flash system system.img_sparsechunk.1
fastboot flash system system.img_sparsechunk.2
fastboot flash system system.img_sparsechunk.3
fastboot flash system system.img_sparsechunk.4
fastboot flash boot boot.img
fastboot oem lock
At the commands "flash oem oem.img" down to "fastboot flash system system.img_sparsechunk.4", it says that it failed at the end. I tried three times, still the same thing, so I got desperate to fix the issue and looked on google how to relock bootloader again.
And I just found another set of commands from a website to start off the process:
fastboot oem fb_mode_set
fastboot flash partition gpt.bin
fastboot flash bootloader bootloader.img
fastboot flash logo logo.bin
fastboot flash boot boot.img
fastboot flash recovery recovery.img
fastboot flash dsp adspso.bin
fastboot flash oem oem.img
fastboot flash system system.img_sparsechunk.0
fastboot flash system system.img_sparsechunk.1
fastboot flash system system.img_sparsechunk.2
fastboot flash system system.img_sparsechunk.3
fastboot flash system system.img_sparsechunk.4
fastboot flash system system.img_sparsechunk.5
fastboot flash system system.img_sparsechunk.6
fastboot flash system system.img_sparsechunk.7
fastboot flash system system.img_sparsechunk.8
fastboot flash modem NON-HLOS.bin
fastboot erase modemst1
fastboot erase modemst2
fastboot flash fsg fsg.mbn
fastboot erase cache
fastboot erase userdata
fastboot erase customize
fastboot erase clogo
fastboot oem fb_mode_clear
fastboot reboot
At the end, my phone just ends up dead, I tried turning on back to fastboot mode, it didn't worked. i tried turing it on like how we usually turn it on, same results. I tried charging the phone, the same nothingness we see when our phones are off, and I know that I charged my phone before attempting to relock bootloader.
And I think I just bricked my phone.
Edit: I'm using a Moto G5 [cedric]
Never try and relock the bootloader once you have unlocked it - there is just no point as if you don't do it right you will destroy your device & if you do lock the bootloader without flashing the firmware correctly you may never be able to flash the correct firmware or do it properly again (without specialist equipment)
The first set of instructions you did would never work as for this device there are 9 sparsechunks 0-8
The second set of instructions would not have locked your bootloader but would have just re-flashed stock firmware
The chances are you either flashed the wrong firmware or you tried to flash old firmware and corrupted your gpt & bootloader
If you can't get into your bootloader then follow my guide below step by step exactly - however you may only be only to re-flash firmware if your device is bootloader unlocked as you may get validation errors when trying to reflash gpt & bootloader
https://forum.xda-developers.com/g5/how-to/rooted-moto-g5-run-morning-post-image-t3776012

IMEI missing. Revert to stock rom? Which one?

Hello,
I got an unlocked Moto G7 Play from ebay and apparently flashed LineageOS successfully. Set up all my apps etc, but when it was time to move my SIM card over, Mobile Network is grayed out, and About Phone -> IMEI said unknown.
It sounds like I need to revert to a stock rom to try to get the IMEI back, but which ROM?
This should be a US Moto G7 Play, unlocked - no carrier.
Also, once I find the right ROM how do I install it?
I am primarily a Linux user, not Windows, if that matters.
Thank you very much for any help.
Its best if you flash with windows, but it's possible with Linux too, but I had driver problems and computer wouldn't recognize phone.
Link to Stock ROM:
https://mirrors.lolinet.com/firmware/moto/channel/official/RETUS/XT1952-4_CHANNEL_RETUS_10_QPYS30.85-23-8-2_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml.zip
Flash with these commands:
fastboot getvar max-sparse-size
fastboot oem fb_mode_set
fastboot flash partition gpt.bin
fastboot flash bootloader bootloader.img
fastboot flash modem NON-HLOS.bin
fastboot flash fsg fsg.mbn
fastboot erase modemst1
fastboot erase modemst2
fastboot flash bluetooth BTFM.bin
fastboot flash dsp dspso.bin
fastboot flash logo logo.bin
fastboot flash boot boot.img
fastboot flash system system.img_sparsechunk.0
fastboot flash system system.img_sparsechunk.1
fastboot flash system system.img_sparsechunk.2
fastboot flash system system.img_sparsechunk.3
fastboot flash system system.img_sparsechunk.4
fastboot flash system system.img_sparsechunk.5
fastboot flash system system.img_sparsechunk.6
fastboot flash system system.img_sparsechunk.7
fastboot flash system system.img_sparsechunk.8
fastboot flash system system.img_sparsechunk.9
fastboot flash system system.img_sparsechunk.10
fastboot flash system system.img_sparsechunk.11
fastboot flash system system.img_sparsechunk.12
fastboot flash system_b system_other.img
fastboot flash oem oem.img
fastboot flash oem_b oem_other.img
fastboot flash system_b.img_sparsechunk.0
fastboot flash system_b.img_sparsechunk.1
fastboot flash system_b.img_sparsechunk.2
fastboot flash system_b.img_sparsechunk.3
fastboot flash system_b.img_sparsechunk.4
fastboot flash vendor vendor.img_sparsechunk.0
fastboot flash vendor vendor.img_sparsechunk.1
fastboot flash vendor vendor.img_sparsechunk.3
fastboot flash vendor vendor.img_sparsechunk.4
fastboot flash vendor vendor.img_sparsechunk.5
fastboot flash vendor vendor.img_sparsechunk.6
fastboot erase carrier
fastboot erase userdata
fastboot erase DDR
fastboot oem fb_mode_clear
fastboot reboot
mrsiri said:
Its best if you flash with windows, but it's possible with Linux too, but I had driver problems and computer wouldn't recognize phone.
Link to Stock ROM:
https://mirrors.lolinet.com/firmware/moto/channel/official/RETUS/XT1952-4_CHANNEL_RETUS_10_QPYS30.85-23-8-2_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml.zip
Flash with these commands:
fastboot getvar max-sparse-size
fastboot oem fb_mode_set
fastboot flash partition gpt.bin
fastboot flash bootloader bootloader.img
fastboot flash modem NON-HLOS.bin
fastboot flash fsg fsg.mbn
fastboot erase modemst1
fastboot erase modemst2
fastboot flash bluetooth BTFM.bin
fastboot flash dsp dspso.bin
fastboot flash logo logo.bin
fastboot flash boot boot.img
fastboot flash system system.img_sparsechunk.0
fastboot flash system system.img_sparsechunk.1
fastboot flash system system.img_sparsechunk.2
fastboot flash system system.img_sparsechunk.3
fastboot flash system system.img_sparsechunk.4
fastboot flash system system.img_sparsechunk.5
fastboot flash system system.img_sparsechunk.6
fastboot flash system system.img_sparsechunk.7
fastboot flash system system.img_sparsechunk.8
fastboot flash system system.img_sparsechunk.9
fastboot flash system system.img_sparsechunk.10
fastboot flash system system.img_sparsechunk.11
fastboot flash system system.img_sparsechunk.12
fastboot flash system_b system_other.img
fastboot flash oem oem.img
fastboot flash oem_b oem_other.img
fastboot flash system_b.img_sparsechunk.0
fastboot flash system_b.img_sparsechunk.1
fastboot flash system_b.img_sparsechunk.2
fastboot flash system_b.img_sparsechunk.3
fastboot flash system_b.img_sparsechunk.4
fastboot flash vendor vendor.img_sparsechunk.0
fastboot flash vendor vendor.img_sparsechunk.1
fastboot flash vendor vendor.img_sparsechunk.3
fastboot flash vendor vendor.img_sparsechunk.4
fastboot flash vendor vendor.img_sparsechunk.5
fastboot flash vendor vendor.img_sparsechunk.6
fastboot erase carrier
fastboot erase userdata
fastboot erase DDR
fastboot oem fb_mode_clear
fastboot reboot
Click to expand...
Click to collapse
Had the same problem, this worked perfectly. Some of the commands are redundant as there aren't any files with that name in the rom zip (system sparsechunk 9 to 12 for example) but just ignoring them works just fine. Thanks.

Categories

Resources