Unable to flash TWRP on Moto G4 Plus

n_sameem

Member
Nov 21, 2013
18
0
0
Bangalore
I had previously rooted my Moto G4 Plus and used multiple custom ROMs before switching back to Stock firmware.

Now, I'm unable to flash TWRP on my device. Any attempts to flash TWRP ends up with the following error:

Code:
reboot bootloader

mfastboot flash recovery twrp.img
target max-sparse-size: 256MB
sending 'recovery' (12530 KB)...
OKAY [  0.406s]
writing 'recovery'...
(bootloader) Image not signed or corrupt
OKAY [  0.203s]
finished. total time: 0.608s
Any further tries to reboot via adb commands results in the following:

Code:
adb reboot recovery
error: device not found

adb reboot
error: device not found

adb reboot bootloader
error: device not found
The device says the bootloader is unlocked while rebooting. the ID field shows 'bad key'(I feel this is weird).

Can someone please help me with this?

Thanks
 

____Mdd

Senior Member
Jul 26, 2016
721
330
63
24
I had previously rooted my Moto G4 Plus and used multiple custom ROMs before switching back to Stock firmware.

Now, I'm unable to flash TWRP on my device. Any attempts to flash TWRP ends up with the following error:

Code:
reboot bootloader

mfastboot flash recovery twrp.img
target max-sparse-size: 256MB
sending 'recovery' (12530 KB)...
OKAY [  0.406s]
writing 'recovery'...
(bootloader) Image not signed or corrupt
OKAY [  0.203s]
finished. total time: 0.608s
Any further tries to reboot via adb commands results in the following:

Code:
adb reboot recovery
error: device not found

adb reboot
error: device not found

adb reboot bootloader
error: device not found
The device says the bootloader is unlocked while rebooting. the ID field shows 'bad key'(I feel this is weird).

Can someone please help me with this?

Thanks
It has got flashed correctly as you got "OKAY" at end of command. Try to boot into recovery and tell us what happens.
 
  • Like
Reactions: n_sameem

echo92

Senior Member
Jan 1, 2017
3,730
1,987
223
Plymouth
1) That TWRP message of 'Image not signed or corrupt' is normal, since the TWRP custom recovery is not signed. After you see the [OKAY], reboot to recovery directly to fix the TWRP, else the stock recovery will overwrite it. Afterwards, you can boot as normal.

2)If you're still in the bootloader on your device, adb commands do not work - you need to use fastboot commands, or use your device volume keys to select 'Start' (to boot to system) or 'Recovery mode' (to boot to recovery) and press the power key to select. Of course, in this case, after flashing TWRP, you'll want to select 'Recovery Mode' in your bootloader and press the power key. This should then boot into TWRP.
If you find yourself in the bootloader in the future, then 'fastboot reboot' or 'fastboot continue' (both commands to be used without quotes, in the ADB terminal) may get your device rebooting to system.

3)ID Bad key is normal with an unlocked bootloader, on subsequent boots this may change to ID:N/A
 

n_sameem

Member
Nov 21, 2013
18
0
0
Bangalore
1) That TWRP message of 'Image not signed or corrupt' is normal, since the TWRP custom recovery is not signed. After you see the [OKAY], reboot to recovery directly to fix the TWRP, else the stock recovery will overwrite it. Afterwards, you can boot as normal.

2)If you're still in the bootloader on your device, adb commands do not work - you need to use fastboot commands, or use your device volume keys to select 'Start' (to boot to system) or 'Recovery mode' (to boot to recovery) and press the power key to select. Of course, in this case, after flashing TWRP, you'll want to select 'Recovery Mode' in your bootloader and press the power key. This should then boot into TWRP.
If you find yourself in the bootloader in the future, then 'fastboot reboot' or 'fastboot continue' (both commands to be used without quotes, in the ADB terminal) may get your device rebooting to system.

3)ID Bad key is normal with an unlocked bootloader, on subsequent boots this may change to ID:N/A

Hi @echo92,

Thanks for pointing out what I was doing wrong. I now realize that the TWRP recovery was being overwritten by stock recovery and I didn't know adb commands don't work while still in bootloader mode.

I did boot into recovery mode from the bootloader (using the volume buttons from the phone) and it worked.

And the ID: bad key is also gone and now it shows ID: N/A.

Thanks again for your help!

Regards
 

vaibhavhr2010

Member
May 10, 2012
9
0
0
Bengaluru
Im Facing this issue while flashing TWRP
C:\adb>fastboot flash recovery twrp.img
(bootloader) has-slot:recovery: not found
(bootloader) is-logical:recovery: not found
Sending 'recovery' (12644 KB) OKAY [ 0.422s]
Writing 'recovery' (bootloader) Image size exeeded partition limits
(bootloader) Preflash validation failed
FAILED (remote: '')
fastboot: error: Command failed
 

echo92

Senior Member
Jan 1, 2017
3,730
1,987
223
Plymouth
Im Facing this issue while flashing TWRP
Pre flash validation errors suggest that your bootloader is locked (i.e. you have not unlocked your bootloader, or it has been re locked). Can you confirm your bootloader is unlocked, e.g. if there is a warning screen on boot saying your device is unlocked?
 

vaibhavhr2010

Member
May 10, 2012
9
0
0
Bengaluru
Pre flash validation errors suggest that your bootloader is locked (i.e. you have not unlocked your bootloader, or it has been re locked). Can you confirm your bootloader is unlocked, e.g. if there is a warning screen on boot saying your device is unlocked?
Thank You for the Reply!

Yes I have already unlocked the Bootloader.

The device status in Bootloader shows Device is Unlocked, Status Code: 3
 
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone