[Recovery][UNOFFICIAL] TWRP Dirty Port For G7 Play

Spaceminer

Senior Member
Sep 9, 2016
1,159
547
123
Olympus Mons
Andy Yans Lineage 17.1 boots up
Havoc 11.19 boots up
Havoc 3.2 with gapps boots up
Extended UI boots up
Arrow Boots up
Android 9 Dot Os Boots Up

Sent from my moto g(7) play using Tapatalk

Thanks bud! After I read your list, I realized that I flashed an arm_a only build like a complete dumbass. Lmao!

Aren't we arm_ab binder64?
 

Spaceminer

Senior Member
Sep 9, 2016
1,159
547
123
Olympus Mons
TWRP - No dtbo

* I've appended the dtbo.img to twrp. It is now self sufficient. You don't need to flash anything before booting this up.

* If you want to use backup & restore or install twrp permanently, you must also install a GSI.

* Do not use this on stock! Motorola has some very nasty security measures in place and you will bootloop no matter what.

* Flashing zips to the stock OS will work. Flashing zips to a GSI will work. Flashing Magisk will not! This is a Magisk issue. If you want to be rooted on stock, patch your boot.img as recovery with magisk manager and flash it from fastboot. It is the only way.

* Disabling verity or forced encryption on stock will break the OS.


How to install twrp...

1. Fastboot boot twrp.img

2. Copy twrp to your external sdcard, or use adb push twrp.img /tmp/twrp.img.

3. Go to Advanced > install recovery ramdisk then navigate to tmp or your external sdcard and select the twrp.img you copied.

4. Use wipe > format > type "yes" to continue then use reboot > recovery from twrp's menus.

5. Once twrp starts up again, wipe data & system, make sure system is mounted, then flash a GSI. Flash the universal disabler afterwards. If you get a failed to unmount error, manually mount all partitions and reflash whatever it errored on.

6. Optional: Flash my modded phh for root. (Install the apk after.) Never use Magisk! It will fail to root, cause a bootloop, or break twrp.

twrp.img

Modded Phh

Side note: My modded phh works on Lineage OS 16 & 17, and should work on any GSI made from Phh's sources. Other GSIs and stock are untested. If anyone can help me fix the overlays for our device, please send me a pm. I have the values for the curves and notch, I just don't know how to compile the overlay as an apk.

How to fix the navbar on a GSI

Code:
adb root
adb shell
setprop persist.sys.phh.mainkeys 0
reboot
 

PoochyX

Senior Member
Oct 23, 2016
2,171
417
143
TWRP - No dtbo



* I've appended the dtbo.img to twrp. It is now self sufficient. You don't need to flash anything before booting this up.



* If you want to use backup & restore or install twrp permanently, you must also install a GSI.



* Do not use this on stock! Motorola has some very nasty security measures in place and you will bootloop no matter what.



* Flashing zips to the stock OS will work. Flashing zips to a GSI will work. Flashing Magisk will not! This is a Magisk issue. If you want to be rooted on stock, patch your boot.img as recovery with magisk manager and flash it from fastboot. It is the only way.



* Disabling verity or forced encryption on stock will break the OS.




How to install twrp...



1. Fastboot boot twrp.img



2. Copy twrp to your external sdcard, or use adb push twrp.img /tmp/twrp.img.



3. Go to Advanced > install recovery ramdisk then navigate to tmp or your external sdcard and select the twrp.img you copied.



4. Use wipe > format > type "yes" to continue then use reboot > recovery from twrp's menus.



5. Once twrp starts up again, wipe data & system, make sure system is mounted, then flash a GSI. Flash the universal disabler afterwards. If you get a failed to unmount error, manually mount all partitions and reflash whatever it errored on.



6. Optional: Flash my modded phh for root. (Install the apk after.) Never use Magisk! It will fail to root, cause a bootloop, or break twrp.



twrp.img



Modded Phh



Side note: My modded phh works on Lineage OS 16 & 17, and should work on any GSI made from Phh's sources. Other GSIs and stock are untested. If anyone can help me fix the overlays for our device, please send me a pm. I have the values for the curves and notch, I just don't know how to compile the overlay as an apk.



How to fix the navbar on a GSI



Code:
adb root

adb shell

setprop persist.sys.phh.mainkeys 0

reboot
OverlayView attachment treble-overlay-moto-g7play.apk.zip

Sent from my moto g(7) play using Tapatalk
 
  • Like
Reactions: Spaceminer

Spaceminer

Senior Member
Sep 9, 2016
1,159
547
123
Olympus Mons
OverlayView attachment 4968557

Sent from my moto g(7) play using Tapatalk
That is awesome! You just save the day. I needed that so badly. Now everything is working perfectly. I can even use the hide option and get symmetrically rounded corners on both sides in landscape. Looks like a retro tv when I run emulators, which really makes me happy.

If anyone wants the Oreo recent apps menu, download the files below. (Spit screen also works.)

1. Copy the permission files to /system/etc/permissions and set permissions to 0644.

2. Copy the launcher3 folder to /system/priv-app, and set permissions on the folder to 0755, & permissions on the app itself to 0644.

3. Delete Trebuchet Quick step launcher from /system/priv-app and reboot.

4. Open "settings > apps > moto app launcher" make sure it has phone and storage permissions. You're done!

* This only works on android 8/9 based GSIs, if anyone can fix that, please let me know.
 

Attachments

PoochyX

Senior Member
Oct 23, 2016
2,171
417
143
Is the persist issue in TWRP going to get fixed and now since TWRP function is accomplished and removing encryption on stock as of right now is not possible are we moving on to orangefox next ?

Sent from my moto g(7) play using Tapatalk
 

Spaceminer

Senior Member
Sep 9, 2016
1,159
547
123
Olympus Mons
Is the persist issue in TWRP going to get fixed and now since TWRP function is accomplished and removing encryption on stock as of right now is not possible are we moving on to orangefox next ?

Sent from my moto g(7) play using Tapatalk
Persist is fixed!

Our security uses FEC, and forced verity. FEC restores missing or corrupted data. Verity is designed to corrupt your userdata and refuse to boot the system if we make changes.

* If we disable verity, FEC will attempt to restore it. If it can't restore it, the bootloader flags the slot as unbootable and it makes you bootloop.

* If we disable FEC, verity will trash userdata.

* If we disable FEC and verity in one shot, the bootloader will refuse to boot the stock OS.

Magisk works on the stock OS because it mirrors your partitions, this bypasses security and neither FEC or verity realize the system has been tampered with. (Bootloader reports green) When we edit vendor or oem, FEC still sees the changes and reverses it. (FEC lives in the kernel by the way.)

If you flash a GSI the bootloader is aware that you're not on stock, so FEC never starts up. Even when using the stock kernel, FEC is just ignored. This behavior is so Motorola can keep the device treble compliant, because all treble devices must be able to boot a GSI. They're also supposed to have a method to disable verity to stay compliant, but they don't... Thankfully the disabler takes care of verity on a GSI.

It might be possible to have full read/write to vendor & oem if we can find a way to make stock look like a GSI. If that can be done, twrp would also work on the stock OS because FEC will get ignored. We'd also be free to disable verity and encryption without bootloops.

OrangeFox is still a possibility. I just haven't had much time to dig into it yet.
 
  • Like
Reactions: DB126 and aIecxs

PoochyX

Senior Member
Oct 23, 2016
2,171
417
143
Persist is fixed!



Our security uses FEC, and forced verity. FEC restores missing or corrupted data. Verity is designed to corrupt your userdata and refuse to boot the system if we make changes.



* If we disable verity, FEC will attempt to restore it. If it can't restore it, the bootloader flags the slot as unbootable and it makes you bootloop.



* If we disable FEC, verity will trash userdata.



* If we disable FEC and verity in one shot, the bootloader will refuse to boot the stock OS.



Magisk works on the stock OS because it mirrors your partitions, this bypasses security and neither FEC or verity realize the system has been tampered with. (Bootloader reports green) When we edit vendor or oem, FEC still sees the changes and reverses it. (FEC lives in the kernel by the way.)



If you flash a GSI the bootloader is aware that you're not on stock, so FEC never starts up. Even when using the stock kernel, FEC is just ignored. This behavior is so Motorola can keep the device treble compliant, because all treble devices must be able to boot a GSI. They're also supposed to have a method to disable verity to stay compliant, but they don't... Thankfully the disabler takes care of verity on a GSI.



It might be possible to have full read/write to vendor & oem if we can find a way to make stock look like a GSI. If that can be done, twrp would also work on the stock OS because FEC will get ignored. We'd also be free to disable verity and encryption without bootloops.



OrangeFox is still a possibility. I just haven't had much time to dig into it yet.
Oh so if persist is fixed this is just a cosmetic malfunction in twrp about not enough space on the device for persist

Sent from my moto g(7) play using Tapatalk
 

Spaceminer

Senior Member
Sep 9, 2016
1,159
547
123
Olympus Mons
Oh so if persist is fixed this is just a cosmetic malfunction in twrp about not enough space on the device for persist

Sent from my moto g(7) play using Tapatalk
Are you using the latest twrp that I've posted? Because I've never had that error with it. If you're talking about flashing modded phh, that was a bug in the zip's scripts, not twrp. That script error has also been fixed for awhile now too.
 

DB126

Senior Member
Oct 15, 2013
15,235
9,944
253
Persist is fixed!

Our security uses FEC, and forced verity. FEC restores missing or corrupted data. Verity is designed to corrupt your userdata and refuse to boot the system if we make changes.

* If we disable verity, FEC will attempt to restore it. If it can't restore it, the bootloader flags the slot as unbootable and it makes you bootloop.

* If we disable FEC, verity will trash userdata.

* If we disable FEC and verity in one shot, the bootloader will refuse to boot the stock OS.

Magisk works on the stock OS because it mirrors your partitions, this bypasses security and neither FEC or verity realize the system has been tampered with. (Bootloader reports green) When we edit vendor or oem, FEC still sees the changes and reverses it. (FEC lives in the kernel by the way.)

If you flash a GSI the bootloader is aware that you're not on stock, so FEC never starts up. Even when using the stock kernel, FEC is just ignored. This behavior is so Motorola can keep the device treble compliant, because all treble devices must be able to boot a GSI. They're also supposed to have a method to disable verity to stay compliant, but they don't... Thankfully the disabler takes care of verity on a GSI.

It might be possible to have full read/write to vendor & oem if we can find a way to make stock look like a GSI. If that can be done, twrp would also work on the stock OS because FEC will get ignored. We'd also be free to disable verity and encryption without bootloops.

OrangeFox is still a possibility. I just haven't had much time to dig into it yet.
Excellent analysis - thanks for sharing :)
 

BobbyBlunt

Member
Jan 3, 2014
28
5
0
For you guys using a gsi, which one did you end up sticking with? I've ran through a few and I couldn't get them to boot (though I didn't try many, and this was before we could get twrp to stick and yes I did try ones which should be compatible compatible with our device)

I've actually gotten used to the stock rom with magisk, but I wo
PHP:
uldn't mind doing some tinkering

Also would this do us any good to get magisk working with a gsi?

https://forum.xda-developers.com/android/software/magiskfixes-fixing-magisk-magisk-t3977203

Oh and let me not forget.... Thank you @Spaceminer for everything you've done
 
Last edited:
Mar 30, 2020
13
8
0
TWRP - No dtbo

* I've appended the dtbo.img to twrp. It is now self sufficient. You don't need to flash anything before booting this up.

* If you want to use backup & restore or install twrp permanently, you must also install a GSI.

* Do not use this on stock! Motorola has some very nasty security measures in place and you will bootloop no matter what.

* Flashing zips to the stock OS will work. Flashing zips to a GSI will work. Flashing Magisk will not! This is a Magisk issue. If you want to be rooted on stock, patch your boot.img as recovery with magisk manager and flash it from fastboot. It is the only way.

* Disabling verity or forced encryption on stock will break the OS.

How to install twrp...

1. Fastboot boot twrp.img

2. Copy twrp to your external sdcard, or use adb push twrp.img /tmp/twrp.img.

3. Go to Advanced > install recovery ramdisk then navigate to tmp or your external sdcard and select the twrp.img you copied.

4. Use wipe > format > type "yes" to continue then use reboot > recovery from twrp's menus.

5. Once twrp starts up again, wipe data & system, make sure system is mounted, then flash a GSI. Flash the universal disabler afterwards. If you get a failed to unmount error, manually mount all partitions and reflash whatever it errored on.

6. Optional: Flash my modded phh for root. (Install the apk after.) Never use Magisk! It will fail to root, cause a bootloop, or break twrp.

twrp.img

Modded Phh

Side note: My modded phh works on Lineage OS 16 & 17, and should work on any GSI made from Phh's sources. Other GSIs and stock are untested. If anyone can help me fix the overlays for our device, please send me a pm. I have the values for the curves and notch, I just don't know how to compile the overlay as an apk.

How to fix the navbar on a GSI
I tested it and it's working
 
  • Like
Reactions: Spaceminer

SmallGiant

Member
Jan 12, 2016
43
2
0
For you guys using a gsi, which one did you end up sticking with? I've ran through a few and I couldn't get them to boot (though I didn't try many, and this was before we could get twrp to stick and yes I did try ones which should be compatible compatible with our device)

I've actually gotten used to the stock rom with magisk, but I wo
PHP:
uldn't mind doing some tinkering

Also would this do us any good to get magisk working with a gsi?

https://forum.xda-developers.com/android/software/magiskfixes-fixing-magisk-magisk-t3977203

Oh and let me not forget.... Thank you @Spaceminer for everything you've done
Have you had any success since posting this? I haven't had any luck myself, trying lineage 17.1, AOSP V119 or dotOS 3.1.1 (they remain at the boot screen indefinitely) for model XT 1952-2.
 

CFKod

Senior Member
Jun 23, 2016
263
77
43
Cardiff
For you guys using a gsi, which one did you end up sticking with? I've ran through a few and I couldn't get them to boot (though I didn't try many, and this was before we could get twrp to stick and yes I did try ones which should be compatible compatible with our device)

I've actually gotten used to the stock rom with magisk, but I wo]uldn't mind doing some tinkering

Also would this do us any good to get magisk working with a gsi?

https://forum.xda-developers.com/android/software/magiskfixes-fixing-magisk-magisk-t3977203

Oh and let me not forget.... Thank you @Spaceminer for everything you've done
Stock rom with magisk is great for me. No issues with company portal which is currently a necessity working from home


That magisk module specifically mentions gsis and magisk.... Surely onto a winner??
 

BobbyBlunt

Member
Jan 3, 2014
28
5
0
Have you had any success since posting this? I haven't had any luck myself, trying lineage 17.1, AOSP V119 or dotOS 3.1.1 (they remain at the boot screen indefinitely) for model XT 1952-2.

Yes this ONE worked first attempt for me. For now I have chosen to remain on stock with magisk and no twrp, but this one did work fine (except for what is listed as not working)
 
Last edited:

Spaceminer

Senior Member
Sep 9, 2016
1,159
547
123
Olympus Mons
I'm making progress with getting twrp to work on stock. I believe it's an encrypted data problem. Twrp is missing libs for keymaster4 so I'm going to try getting those in there. It seems that, the system init forces encryption, and as soon as data gets created, twrp goes into a bootloop.

I was able to narrow it down by installing twrp, then wiping everything but the data partition. Without any system, vendor, or oem partition, twrp still refuses to boot with encrypted data.

So I think we have a solution. Patch system init, so nothing ever gets encrypted. (The vendor fstab isn't enough by itself.) Or enable decryption support for twrp.
 

AL2009man

Member
Mar 23, 2016
18
4
0
TWRP - No dtbo

* I've appended the dtbo.img to twrp. It is now self sufficient. You don't need to flash anything before booting this up.

* If you want to use backup & restore or install twrp permanently, you must also install a GSI.

* Do not use this on stock! Motorola has some very nasty security measures in place and you will bootloop no matter what.

* Flashing zips to the stock OS will work. Flashing zips to a GSI will work. Flashing Magisk will not! This is a Magisk issue. If you want to be rooted on stock, patch your boot.img as recovery with magisk manager and flash it from fastboot. It is the only way.

* Disabling verity or forced encryption on stock will break the OS.


How to install twrp...

1. Fastboot boot twrp.img

2. Copy twrp to your external sdcard, or use adb push twrp.img /tmp/twrp.img.

3. Go to Advanced > install recovery ramdisk then navigate to tmp or your external sdcard and select the twrp.img you copied.

4. Use wipe > format > type "yes" to continue then use reboot > recovery from twrp's menus.

5. Once twrp starts up again, wipe data & system, make sure system is mounted, then flash a GSI. Flash the universal disabler afterwards. If you get a failed to unmount error, manually mount all partitions and reflash whatever it errored on.

6. Optional: Flash my modded phh for root. (Install the apk after.) Never use Magisk! It will fail to root, cause a bootloop, or break twrp.

twrp.img

Modded Phh

Side note: My modded phh works on Lineage OS 16 & 17, and should work on any GSI made from Phh's sources. Other GSIs and stock are untested. If anyone can help me fix the overlays for our device, please send me a pm. I have the values for the curves and notch, I just don't know how to compile the overlay as an apk.

How to fix the navbar on a GSI

Code:
adb root
adb shell
setprop persist.sys.phh.mainkeys 0
reboot
I followed everything, and now I am getting a I/O Error everytime I try to open any GSI Image, any help here?

Edit: I decided to skip Step 4 and managed to install a GSI. at least it's something...
 
Last edited:

PoochyX

Senior Member
Oct 23, 2016
2,171
417
143
I followed everything, and now I am getting a I/O Error everytime I try to open any GSI Image, any help here?

Edit: I decided to skip Step 4 and managed to install a GSI. at least it's something...
I have a magisk/twrp patched boot img u can use if your using a GSI
Fastboot - w (if your GSI is encrypted) twrp won't open
If already decrypted via decryption zip place twrp img in ADB folder
Fastboot boot twrp.Img
Uhzip twrp folder place it in internal storage restore boot img in twrrp u will be rooted with magisk and have access to twrp still
That zip is located in Moto G7 play how to install android 10 topic discussion at the bottom of the op

([emoji88]Havoc GSI[emoji88])

---------- Post added at 07:24 AM ---------- Previous post was at 07:21 AM ----------

I'm making progress with getting twrp to work on stock. I believe it's an encrypted data problem. Twrp is missing libs for keymaster4 so I'm going to try getting those in there. It seems that, the system init forces encryption, and as soon as data gets created, twrp goes into a bootloop.



I was able to narrow it down by installing twrp, then wiping everything but the data partition. Without any system, vendor, or oem partition, twrp still refuses to boot with encrypted data.



So I think we have a solution. Patch system init, so nothing ever gets encrypted. (The vendor fstab isn't enough by itself.) Or enable decryption support for twrp.
With key master 4 added to twrp we should be able to keep twrp and have are lock screen functional on a GSI.... Have u been able to implement key master 4

([emoji88]Havoc GSI[emoji88])
 

AL2009man

Member
Mar 23, 2016
18
4
0
I have a magisk/twrp patched boot img u can use if your using a GSI
Fastboot - w (if your GSI is encrypted) twrp won't open
If already decrypted via decryption zip place twrp img in ADB folder
Fastboot boot twrp.Img
Uhzip twrp folder place it in internal storage restore boot img in twrrp u will be rooted with magisk and have access to twrp still
That zip is located in Moto G7 play how to install android 10 topic discussion at the bottom of the op

([emoji88]Havoc GSI[emoji88])

([emoji88]Havoc GSI[emoji88])


can you at least provide a "madisk/twrp patched boot.img" and a direct link, because I cannot find it unless it's this one: https://forum.xda-developers.com/showpost.php?p=82929451&postcount=50

and I'm having a hard time figuring your how to follow your guide, can you (at least) try to make the instructions a bit easier to follow?
 
Last edited:

PoochyX

Senior Member
Oct 23, 2016
2,171
417
143
can you at least provide a "madisk/twrp patched boot.img" and a direct link, because I cannot find it unless it's this one: https://forum.xda-developers.com/showpost.php?p=82929451&postcount=50

and I'm having a hard time figuring your how to follow your guide, can you (at least) try to make the instructions a bit easier to follow?
Yeah that's the one..... Alright first install android 9 stock rom (twrp won't boot on a android 10 vendor @Spaceminer will fix the issue when offical android 10 drops for the North America Moto G7 plays) also once u flash a android 10 modem your service won't work on android 9 with the pie modem u would need to reflash the android 10 modem... Then how I do it let it boot to the set up wizard and then reboot to bootloader fastboot - w fastboot flash system GSI name then fastboot boot twrp.img (make sure twrp img is in ADB folder) when twrp boots u format data...un zip my twrp folder and place it internal storage once data is formated then use decryption zip to patch vendor after u restore magisk img patched with twrp... Resize system if using gapps reboot into recovery it will boot with magisk install magisk manager and your rooted after environment setup.... to boot twrp hold volume up button when u reboot to recovery
(to pass environmental setup and for havoc 3.6 to boot u need to remove vendor/bin/init.mimi.hab u should do it in twrp prior to first boot)

([emoji88]Havoc GSI[emoji88])