[GUIDE] relock bootloader and get it back to its OOB state & get your imei back - Moto G5 Questions & Answers

WARNING: DO NOT FLASH THE GPT.BIN OR THE BOOTLOADER.IMG/MOTOBOOT.IMG ON A NEWER FIRMWARE WHEN DOWNGRADING, BECAUSE IT CAN HARD BRICK YOUR DEVICE E.G. DO NOT FLASH THE GPT.BIN OR THE BOOTLOADER.IMG/MOTOBOOT.IMG MADE FOR 7.0 ON 8.1.0 EVEN IF THE FILES IN THE FOLDER BUT ITS FINE IF YOU FLASH THE SAME FILES MADE FOR ANDROID 8.1.0 AVOID FLASHING THESE FILES AT ALL TIMES
I AM NOT RESPONSIBLE FOR ANY DAMAGE CAUSED TO YOUR DEVICE, DO THIS AT YOUR OWN RISK
so a little backstory,
i unlocked my bootloader because i wanted to downgrade back to android 7.0, and then my imei broke on me, so i attempted to upgrade back to android 8.1.0 but then everytime i rebooted my phone i see;
"your device is unlocked and cant be trusted
ID: bad key
your device will reboot in 5 seconds"
then would just loop into the bootloader
and when flashing the logo back it will just say "bad key" when editing logo.bin (changing the logo_unlocked to logo_boot)
with this guide i will tell you how to revert your device back to OOB state (OOB means out of box for all those idiots out there )
THIS WAS TESTED ON MY XT1675 IT WILL BE DIFFERENT FOR EACH DEVICE
1) grab your stock firmware, for me its "XT1675_CEDRIC_RETGB_SS_8.1.0_OPP28.85-19-4-2_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml"
2) install minimal ADB and fastboot
3) then once you installed the adb and fastboot drivers we are really just focusing on the fastboot.exe, i will be linking the platform-tools at the bottom of this post
4) extract the firmware to a place and make sure there are no spaces (e.g. C:/Users/Example/Desktop/moto g5 downgrade otherwise cmd will assume its another path to another folder)
5) the most important file is oem.img because this is the signed file by motorola that we will need to relock the bootloader but it should come in the firmware folder, if not PM me and will try my best to find the matching oem.img
6) once you get all your files type these commands to reload the firmware onto the device
fastboot flash gpt gpt.bin
fastboot flash bootloader bootloader.img
fastboot flash dsp adspso.bin
fastboot flash logo logo.bin
fastboot flash boot boot.img
fastboot flash recovery recovery.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 erase modemst1
fastboot erase modemst2
fastboot flash fsg fsg.mbn
fastboot erase cache
fastboot erase userdata
fastboot reboot
what you will find now is it will at least boot into the setup screen
we are not done yet!
7) now if you reboot into the bootloader screen the options will be seriously messed up (they will overlap if you press up and down on the volume keys, i think this tells motorola that you tampered with your device)
8) now still on the bootloader screen connect up your device with cmd still open, then type these commands
fastboot oem lock
fastboot oem lock (you have to type it twice)
fastboot flash oem oem.img (you need this to relock the bootloader)
fastboot flash gpt gpt.bin
fastboot flash bootloader bootloader.img
fastboot flash recovery recovery.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 boot boot.img
fastboot oem lock
now it will say (lock complete! flash signed images after reboot if needed)
type in
fastboot reboot
now when you reboot your device you will get a black screen then it will show the motorola logo, to fix this go into the bootloader mode and reflash your original bootlogo
you got your device up and running like it did OOB!
LINKS:
Minimal adb and fastboot: https://forum.xda-developers.com/showthread.php?t=2317790
platform tools: https://developer.android.com/studio/releases/platform-tools
if your getting "image signed with key bad key when flashing the boot.img and the recovery.img, i found this really helpful tutorial, just do not flash the files on the G5, this is made for the G5 plus but the bootloader commands works for the G5 as well as the G5 plus
Link: https://forum.xda-developers.com/g5-plus/how-to/solution-to-flash-stock-romfactory-t3691396
also if you get "still requires signed system.img and/or boot.img flash all the system sparsechunk files

I can't re-lock bootloader, getting "(bootloader) Check 'Allow OEM Unlock' in Android Settings > Developer" when I run "fastboot oem lock" second time. Please, help!

gkornaks said:
I can't re-lock bootloader, getting "(bootloader) Check 'Allow OEM Unlock' in Android Settings > Developer" when I run "fastboot oem lock" second time. Please, help!
Click to expand...
Click to collapse
You need to enable oem unlock in developer settings

mattwhite7102 said:
You need to enable oem unlock in developer settings
Click to expand...
Click to collapse
I am having the same error of "Allow OEM unlock" in the android setting, and the option in the developer setting of android is grayed out. I can't switch it.

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

How do I relock bootloader and go back to stock on moto G5s?

A friend unlocked its bootloader and tried to root it with no success.
The phone works but only boots through fastboot, because when I press the power button it enters fastboot mode instead of booting.
I don't know what happened, as I was not the one who tried to root, so I just wanted to know how to revert back to stock and relock the bootloader, since the phone works normally.
freeZbies said:
A friend unlocked its bootloader and tried to root it with no success.
The phone works but only boots through fastboot, because when I press the power button it enters fastboot mode instead of booting.
I don't know what happened, as I was not the one who tried to root, so I just wanted to know how to revert back to stock and relock the bootloader, since the phone works normally.
Click to expand...
Click to collapse
If they flashed twrp and your phone can only be started normally through the bootloader see
https://forum.xda-developers.com/g5/how-to/fix-phone-reboots-recovery-mode-started-t3705325
If you want to root the phone stock can only be rooted with a system root
Most roots now use a systemless root which is not compatible with the stock kernel
You either need a custom rom to use the latest magisk root or if you want to stick with stock use an old version of magisk (can't remember which really old version works) or use supersu but flash the config zip first and set to system as default will be systemless
With regards to flashing stock download firmware and run these fastboot commands assuming you have fastboot set up on your pc
fastboot oem fb_mode_set
fastboot flash partition gpt.bin (do not flash unless you want to repartition the phone)
fastboot flash bootloader bootloader.img (do not flash unless you really need to replace the bootloader)
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 erase customize (ignore any error)
fastboot erase clogo (ignore any error)
fastboot oem fb_mode_clear
fastboot reboot
To lock the bootloader do the above and then go back to the bootloader mode & enter these fastboot commands
fastboot oem lock
fastboot oem lock (yes type it again)
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
Then once restarted refresh all the firmware again with the commands from earlier
I have seen though that some boot.img are not officially signed so it may not lock
TheFixItMan said:
If they flashed twrp and your phone can only be started normally through the bootloader see
https://forum.xda-developers.com/g5/how-to/fix-phone-reboots-recovery-mode-started-t3705325
If you want to root the phone stock can only be rooted with a system root
Most roots now use a systemless root which is not compatible with the stock kernel
You either need a custom rom to use the latest magisk root or if you want to stick with stock use an old version of magisk (can't remember which really old version works) or use supersu but flash the config zip first and set to system as default will be systemless
With regards to flashing stock download firmware and run these fastboot commands assuming you have fastboot set up on your pc
fastboot oem fb_mode_set
fastboot flash partition gpt.bin (do not flash unless you want to repartition the phone)
fastboot flash bootloader bootloader.img (do not flash unless you really need to replace the bootloader)
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 erase customize (ignore any error)
fastboot erase clogo (ignore any error)
fastboot oem fb_mode_clear
fastboot reboot
To lock the bootloader do the above and then go back to the bootloader mode & enter these fastboot commands
fastboot oem lock
fastboot oem lock (yes type it again)
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
Then once restarted refresh all the firmware again with the commands from the first post
I have seen though that some boot.img are not officially signed so it may not lock
Click to expand...
Click to collapse
Yes, thank you.
I was checking the relocking guides here in xda and seems signed boot images are the problem. Anyways, I'll check to see if it works.
freeZbies said:
Yes, thank you.
I was checking the relocking guides here in xda and seems signed boot images are the problem. Anyways, I'll check to see if it works.
Click to expand...
Click to collapse
Also just noticed you are talking about the Moto G5s - this is the Moto G5 Cedric forum
The Moto G5s forum is located
https://forum.xda-developers.com/moto-g5s
TheFixItMan said:
Also just noticed you are talking about the Moto G5s - this is the Moto G5 Cedric forum
The Moto G5s forum is located
https://forum.xda-developers.com/moto-g5s
Click to expand...
Click to collapse
Oh thanks, I'm gonna check it there, because it's indeed a Moto G5S.
Only thing I'd like to say is that on the XDA Labs app the only forum shown when I search for Moto G5S is the Moto G5 forum, no variants are presented, whom should I report this to, so that it can be fixed?
freeZbies said:
Oh thanks, I'm gonna check it there, because it's indeed a Moto G5S.
Only thing I'd like to say is that on the XDA Labs app the only forum shown when I search for Moto G5S is the Moto G5 forum, no variants are presented, whom should I report this to, so that it can be fixed?
Click to expand...
Click to collapse
No idea - don't use the app
The email on the Google play listing says
[email protected]
The thread for the app is
https://forum.xda-developers.com/android/apps-games/labs-t3241866

Lost biometric sensor

I lost my biometric sensor after leaving the test soak and go to a custom rom, how can I recover before leaving the final oreo stock?
eduh9 said:
I lost my biometric sensor after leaving the test soak and go to a custom rom, how can I recover before leaving the final oreo stock?
Click to expand...
Click to collapse
Hi, this happened to me, back to the stock rom (Android 7.0) of the device and do the whole procedure. And your sensor will work
Be careful to do not downgrade your bootloader though.
This tutorial helped me to recover biometrics in my phone (XT1676, reteu, 3/16, DualSIM).
I am not responsible for any damage! If you proceed to follow this, you're doing it at your own risk.
1. Make sure, your adb and fastboot is working.
I recommend using this one https://forum.xda-developers.com/showthread.php?t=2588979 . For me, it's fully working on Win8.1 x64. If you install it (press "Y" for all of 3 questions), but after connecting phone you see "Fastboot cedric S" with yellow exclamation mark in device manager, there's problem with driver: right click on it --> "Update driver software" --> "Browse my computer for driver software" --> "Let me pick from a list of device drivers on my computer" --> "Android devices" --> "Android Bootloader Interface" --> "Next" --> "OK" --> "Close"
(Open cmd and use "cd" command to get to directory, where's adb installed (in this case "cd C:\adb"). Then, press Enter and type "Fastboot devices". If fastboot is properly installed with corresponding drivers, you will see your device listed.)
2. Download this firmware https://drive.google.com/file/d/1hlNzlFhLCEj6xigfKrYcvnwH9jy3f5j3/view and extract it to the same directory as adb is installed.
3. Boot your phone into fastboot mode by pressing and holding power and vol- buttons for few seconds.
4. NOW, THE MOST IMPORTANT PART! Check your bootloader version.
4a. If your bootloader version is B8.25, use these commands to flash:
Code:
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 flash fsg fsg.mbn
fastboot erase cache
fastboot erase userdata
fastboot erase customize
fastboot erase clogo
fastboot oem fb_mode_clear
fastboot reboot
4b. If your bootloader is B8.24 and lower, use these commands:
Code:
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 modem NON-HLOS.bin
fastboot flash fsg fsg.mbn
fastboot erase cache
fastboot erase userdata
fastboot erase customize
fastboot erase clogo
fastboot oem fb_mode_clear
fastboot reboot
5. Your phone should reboot and sucessfully boot into OS in few minutes with fingerprint working.
DON'T EVEN TRY TO TAKE OTA UPDATES.
6. (optional) However, if you want to update your phone, update it manually with correct files from this site https://forum.xda-developers.com/g5/how-to/cedric-ota-archive-t3795275
Moto g5, has a biometric sensor?
666km666 said:
Moto g5, has a biometric sensor?
Click to expand...
Click to collapse
Of course, it has (fingerprint sensor at the front, under the display).
johnnywilly16 said:
Hi, this happened to me, back to the stock rom (Android 7.0) of the device and do the whole procedure. And your sensor will work
Click to expand...
Click to collapse
Sorry I'm just confirming that I need to go to stock 7.0 first? Will the debloated stock 7.0 be good enough?
eduh9 said:
I lost my biometric sensor after leaving the test soak and go to a custom rom, how can I recover before leaving the final oreo stock?
Click to expand...
Click to collapse
For anyone who finds this there is a flastable Nougat zip for Cedric which fixes finger print scanner, it is in the same thread as the soak 8.1 zip. I hope this saves others trouble as it did me. Find direct answers in telegram:
@cedricNOOBchat

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

Categories

Resources