yashsingh1/xdaforums huggingface dataset:
[Moto G5 Plus Guides, News, & Discussion] Johny Cipeli:
UPDATE

Hey all :) It has passed some time since the first post isn't? And with this time, things get better, easier to be done, and as still nowadays people PM me asking for some tips, so I decided to update the methods by using nowadays tools. SO LET'S ROCK! :highfive:

Your warranty is now void.

I am not responsible for bricked devices, dead SD cards,
thermonuclear war, or you getting fired because the alarm app failed. Please
backup your data before flashing it!
YOU are choosing to make these modifications, and if
you point the finger at me for messing up your device, I will laugh at you.

Do everything at your own risk!

STEPS :D

1. Unlock your bootloader

2. Download all files in the end of this post

3. Backup your data and files, all will be lost

4. I recomend you make a clean install, then flash stock ROM again, you can do this or not, if yes, so flash it(let the phone start)

5. Turn off the mobile, then go to bootloader screen and flash TWRP

6. In the Decrypt /data screen, press cancel, then "Swipe to Allow Modifications"

7. Go to WIPE, then "Swipe to Factory Reset"

8. Come back to TWRP main menu, go to REBOOT, then RECOVERY, then DO NOT INSTALL

Now TWRP is rebooting :p

9. "Swipe to Allow Modifications"

10. Plug your phone to PC

11. Copy your favorite Root tool (SuperSU or Magisk), and then flash it

12. After the setup, come back to TWRP main menu, go to REBOOT, then SYSTEM, then DO NOT INSTALL

13. When the Phone starts, go to Magisk App

14. Open Magisk.......

15.BOOOOMMMM YOU NOW HAVE ROOTED PHONE!!!!

SOME EXPLANATIONS :confused:

*Whats the main difference??

Twrp is now do the work of "no-verity-opt-encrypt-5.1" by itself, both Root Tools are working, and download links updated.

*Which Stock Version??

Should work in every version available

DOWNLOADS :cowboy:

Magisk: https://goo.gl/qC4Lyq

SuperSU: https://goo.gl/kRU6Ag

Last Stock ROM: https://goo.gl/ytKbJ7

TWRP: https://goo.gl/f3yVpn

A bit late, Happy New Year, and enjoy your potter !! :good: ;)
[Moto G5 Plus Guides, News, & Discussion] Wolfcity:
Thx for that guide, I've got some questions.

I just bought my Moto G5+ coming from a Moto G 2014 (titan).

Why is a complete clean flash of stock rom recommend? Or is it just for those coming from a custom rom?

In the quoted guide it says 'in TWRP "Keep system read-only." In your guide it's the other way round, "allow modifications".

As magisk don't touch the system partition why is it necessary to allow modifications?

What about the part with the f2fs problem of many Moto devices? The guys over at the magisk thread strongly recommend flashing a custom kernel to keep the full functionality of magisk, especially magisk hide and module installation or reformat the data partition.

Magisk makes the no-verity-opt-encrypt.zip superfluous but can't handle our stock kernel as it's used to be.

I'm about to root my device and for the option to receive future OTA's I want to change as less as possible.

Much appreciated.
[Moto G5 Plus Guides, News, & Discussion] Jrhotrod:
Everyone has their own way of rooting. Keeping system read only is just a method that works for me; there is no reason to allow modifications, nor does it harm anything. So in the long run it really doesn't matter :p either way works just fine
[Moto G5 Plus Guides, News, & Discussion] Johny Cipeli:
Well man, its just a suggestion to avoid every inconveniences or issues during the process.
[Moto G5 Plus Guides, News, & Discussion] logic88:
Thanks for the guide!

I haven't purchased a G5+ yet but am thinking about it so was doing research and came across this guide.

After rooting, can I accept the OTA updates and then re-root? Or what is the procedure for OTA updates?
[Moto G5 Plus Guides, News, & Discussion] Psycake:
Is it recommended to flash a kernel with a fixed F2FS implementation after/before rooting using this method?
[Moto G5 Plus Guides, News, & Discussion] logic88:
What is the F2FS bug? Does it affect anything aside the ability to run certain magisk modules?
[Moto G5 Plus Guides, News, & Discussion] Psycake:
As far as I know, no.
[Moto G5 Plus Guides, News, & Discussion] Wolfcity:
In my case magisk hide also doesn't work and the official TWRP wasn't able to hold any settings.

I use the loopback bug module by [MENTION=5228676]VR25[/MENTION] and everything is working.
[Moto G5 Plus Guides, News, & Discussion] Psycake:
Okay, so would that module be installed after rooting, right? How can I install it?
[Moto G5 Plus Guides, News, & Discussion] Wolfcity:
https://xdaforums.com/apps/magisk/guide-magisk-official-version-including-t3577875

-Unlock bootloader

-Flash latest TWRP

-Format data to decrypt it

-Flash magisk 15.3

-Flash the loopback module

-Boot to system

If the module won't stick or isn't shown in magisk modules try to flash it through magisk or through TWRP again.
[Moto G5 Plus Guides, News, & Discussion] Psycake:
Makes sense, thanks!
[Moto G5 Plus Guides, News, & Discussion] logic88:
Sorry to repeat the question but I'm still curious about OTA updates.

Is there a procedure for updating and then re-rooting?

Thanks!
[Moto G5 Plus Guides, News, & Discussion] Psycake:
What is "Format data to decrypt it"? Like how do I do it?

How do I flash the module? Using TWRP or what?
[Moto G5 Plus Guides, News, & Discussion] Wolfcity:
Your device comes out of the box with an encrypted data partition. To make everything work as it should you can decrypt it in TWRP by going to Wipe - Format data - Type "yes. Save your data as everything from internal storage will be deleted.

And yes,flash the module using TWRP.
[Moto G5 Plus Guides, News, & Discussion] Psycake:
Thank you everyone, you've been so helpful!
[Moto G5 Plus Guides, News, & Discussion] Johny Cipeli:
Well, I don't know nowadays, but in my first Android device the default method used to got me a bootloop, so I recommend you install OTA by yourself and then re root. But as I said, I don't know nowadays.
[Moto G5 Plus Guides, News, & Discussion] Psycake:
Sorry to bother again, but I'm still not sure how this all works.

I'll root my phone tonight or tomorrow. Would you (or someone else) mind explaining the steps a bit further? Like step by step, option by option.

Thanks!

---

If I understand correctly, I gotta follow the original guide as is, but before booting, I have to flash the loopback fix module. Am I right, or do I have to do something else apart from that? Do I have to allow modifications to /system? I want a systemless root.

Quoting original guide just in case:
[Moto G5 Plus Guides, News, & Discussion] Psycake:
Just noticed [MENTION=7896819]Jrhotrod[/MENTION] posted a 100% noob-friendly guide, and it doesn't use the no-verity.zip file (or whatever it's called). So I guess this guide is equivalent to the one [MENTION=7157402]Johny Cipeli[/MENTION] posted back in early January. Can some one confirm this?

Also, in the bottom of the noob-friendly guide it's mentioned that you won't be able to pass SafetyNet with stock kernel. Why is this? Is this because the F2FS loopback bug? If so, can this be fixed with the F2FS loopback bug workaround module by [MENTION=5228676]VR25[/MENTION] (therefore allowing you to pass SafetyNet)?

Quoting the noob-friendly guide just in case:
[Moto G5 Plus Guides, News, & Discussion] Wolfcity:
Basically just follow the guide(s).

I think you know the bootloader unlocking procedure via Motorola website. (unlocking wipes your device).

Flash latest TWRP, for Potter: https://twrp.me/motorola/motorolamotog5plus.html

Now you have to think about the fact that your data partition is encrypted. The one scenario is that TWRP decrypts the partition automatically, the other is that TWRP asks for a decryption password than the decryption failed (happens in most cases) and you have to reformat your data partition to decrypt it.

For that in TWRP go to wipe/ format data/ confirm with "yes".

Remember that all your data will be lost also from internal storage.

It doesnt matter if you swipe allow modifications in TWRP, your root will be systemless anyway.

The second thing you have to take care of is the loopback bug.

There are 3 solutions: The loopback module,formatting your data partition to ext4 or flashing a custom kernel like ElementalX .

I recommend to try the module, flash it before magisk.

Flash magisk 15.3 through TWRP as described.

If you decide to flash a custom kernel later, maybe because the module doesn´t work for you remember to flash it last, after magisk.

Remember: The main functions of magisk will work without the loopback module, only magisk hide, passing safety net checks and installing modules in magisk manager won´t work and maybe some setting won´t stick.

So regarding to your question: You can allow modifications in TWRP, your root will be systemless. You just have to flash the loopback module as described, be sure to flash the latest version: https://xdaforums.com/showpost.php?p=75198840&postcount=97

edit: As you edited your post: You don´t need the no-verity-opt-encrypt.zip anymore, TWRP should do the job. And yes, if the loopback module is working correct you will pass the safety net checks.

Good luck. It´s a bit tricky and I had to reflash my stock rom a few times but at last it´s working.
[Moto G5 Plus Guides, News, & Discussion] Psycake:
Okay, let me see if I got that:

I'll follow the noob-friendly guide. So this is how the procedure is in my head right now:

1. I'll follow it until step 16b

2. I'll flash the module (do I just select the ZIP and install it like I would with Magisk?)

3. I'll continue with the guide like normal.

But I wonder, where does decrypting the /data partition go? Between which steps?

Also, how much time does it take to do all of this?

Thank you for you time!
[Moto G5 Plus Guides, News, & Discussion] Wolfcity:
1. I didn´t flash stock rom before but that´s up to you.

2. Yes, flash the loopback module like any other zip through TWRP, it will appear in magisk manager later as a module if everything works right.

3. Yes

The decryption happens when you boot into TWRP the first time. If not you will see a screen asking for your decryption password (that´s what happend to me).

Tap cancel, go to "Wipe"- format data - confirm with yes. This procedure takes just a few seconds.

If everything works well the whole process should not take more than 10 minutes. If you have to reflash stock it takes longer.

I would do it when you have enough time.
[Moto G5 Plus Guides, News, & Discussion] Psycake:
Okay, got that, thanks!!!

Another quick question. At the end of all the process, I want to have the latest Mexico stock ROM from here: https://xdaforums.com/g5-plus/development/rom-twrp-flashable-stock-builds-t3675616.

When would I flash it? Before rooting, or after, or in between? And how?

Edit: I got another question. In case I want to flash this stock ROM, but keep the one I have anyway (it's an older version, but the latest to my carrier), when would I have to backup the one I have, then flash the new one?
[Moto G5 Plus Guides, News, & Discussion] Wolfcity:
If you're sure that rom is the correct one for your device the right time to flash it would be after unlocking the bootloader and before flashing TWRP.

If you want to save your actual rom you should do it also after unlocking the bl. To get an untouched backup don't flash TWRP with

fastboot flash recovery "name-of-recovery.img", instead of just boot into TWRP with

fastboot boot recovery "name-of-recovery.img".

The TWRP recovery has to be in your adb/fastboot folder when you do that.

Your device will only boot TWRP and you can do a backup of your system with your stock recovery inside. Store that backup on the external SD because your internal storage will be wiped later when decrypting the data partition.

After the backup is done you can flash the newer stock rom in fastboot mode with the flashall.bat found in [MENTION=7896819]Jrhotrod[/MENTION] 's tutorial.

The extracted rom and the flashall.bat have to be in your fastboot folder.

Now you've got a backup of your actual rom and the newer rom build installed.

At this point you can start with flashing TWRP, decrypting and rooting as described.
[Moto G5 Plus Guides, News, & Discussion] Psycake:
So I'll unlock the bootloader, boot into TWRP and backup my ROM into external SD. Then...

Can I flash TWRP as recovery and then use TWRP to flash the new stock ROM (so I would have to flash TWRP as recovery again; no big deal), or do I have to flash the new stock ROM first with the batch file, then flash TWRP as recovery?

Also, what happens if I flash a ROM not for my device? This ROM shouldn't be a problem since I bought my phone in the region (XT1680), but just curious.

One more thing. Can I make the backup of my ROM in internal storage, then copy to PC, then flash the new stock ROM, or it must be in external SD?
[Moto G5 Plus Guides, News, & Discussion] Wolfcity:
No,the new stock rom has to be flashed through stock recovery, there are modified stock roms for TWRP around on XDA but I recommend to flash the original rom via fastboot. It's not a big deal, the flashall.bat will do the whole job in a minute.

Just extract the rom zip to your fastboot folder, copy the flashall.bat to it and start it.

I don't know what you are using, I use the latest Minimal ADB & Fastboot tool (search on XDA or use this:https://drive.google.com/file/d/0B0WGdtNWubBJZTFtNnk0dXlTTms/view?usp=drivesdk )

And don't forget to install the Motorola drivers:

https://drive.google.com/file/d/0B0WGdtNWubBJYnlDcWRBZXltanc/view?usp=drivesdk

If you flash a rom that's not for your region or even worse not for your device you could lose your mobile data/WiFi or end with a unbootable device maybe without IMEI.

But if you check your build number/baseband/regulatory information in about phone and compare it with your downloaded rom nothing should go wrong.

About your backup: It happens that nandroid backups can't be restored when they have copied to PC and back. So if you want to be on the safe side insert a SD card and let TWRP backup to that location.
[Moto G5 Plus Guides, News, & Discussion] Psycake:
The ROM I had linked earlier is modified for TWRP, so I guess I'll have to look for a stock unmodified one.

I installed with the Minimal ADB + fastboot. I also installed the Motorola Drivers.

How do I check the build number/baseband/regulatory info in the downloaded ROM?

Also, the stock ROM I'm talking about hasn't been released by my carrier yet (my phone is carrier locked). Will this cause any issues or should I just not flash any ROM to be on the safe side?

I'll use an external SD to backup then! Thanks!
[Moto G5 Plus Guides, News, & Discussion] Wolfcity:
You´ll find everything under Settings-About phone (see attached screenshots). My Build Nr. is NPNS25.137-33-11 and if I tap on regulatory information I see my model, XT1685.

Compare these specifications with the name of the stock rom zip, mine is called "POTTER_NPNS25.137-33-11_cid50_subsidy-DEFAULT_regulatory-DEFAULT_CFC.xml.zip". As you said the rom you linked is a TWRP flashable build. Here are some good resources for Motorola stock roms:

https://mirrors.lolinet.com/firmware/moto/potter/official/RETAIL/

http://www.filefactory.com/folder/c6cdedc45a775d27/?sort=created&order=DESC&show=25&page=1

https://firmware.center/firmware/Motorola/Moto%20G5%20Plus/Stock/

The 137-33-11 in the Build Nr. is the build version, there are newer versions for my device too.

If you are sure that the newer version is for your device and region it´s ok even if your carrier hasn´t released it yet.

But you´ve got always some residual risk, one thing is that you should never downgrade your bootloader on stock, it will hardbrick your device. So if you flash an older firmware over a newer one you have to skip the gpt.bin/bootloader.img.

It´s up to you if you want to flash the latest firmware. I didn´t because in a few month Oreo will arrive for our device and if I´m still on stock then I will clean flash my rom anyway.
[Moto G5 Plus Guides, News, & Discussion] Psycake:
Okay, so I won't flash any ROM for now since Oreo is pretty close. I'll just wait till Oreo releases for my region and device. A bit off topic question, but once I'm rooted and all, when Oreo comes out, can I just flash it, or do I have to deroot, flash it, then reroot?

Will do this procedure tomorrow in the morning:

1. Unlock bootloader, boot into TWRP, and backup stock ROM.

2. Follow the noob-friendly guide skipping the ROM flashing steps, and until step 16b.

2. Flash the F2FS loopback fix module.

3. Continue with the guide like normal.

4. Boot my device.

Is that right? Thanks!
[Moto G5 Plus Guides, News, & Discussion] Psycake:
[MENTION=5237901]Wolfcity[/MENTION] Did everything, and everything went fine. I even passed SafetyNet. One thing though: the F2FS loopback bug workaround module doesn't appear in the Modules section in Magisk Manager. Is this bad? I'm 100% certain I flashed the module.
[Moto G5 Plus Guides, News, & Discussion] Wolfcity:
Great to hear that it works for you.

If everything works you can leave it as it is.

You could also try to flash the loopback bug module with magisk manager- (Correction: Always flash with TWRP)nothing should go wrong but that's up to you.

Check that thread if magisk has limited functionality (modules can't be flashed,Adaway doesn't work): https://xdaforums.com/apps/magisk/guide-magisk-official-version-including-t3577875/page11
[Moto G5 Plus Guides, News, & Discussion] Psycake:
Everything works (even AdAway), so I'm leaving it like this.

Thank you very much for all of your help! Gave a great day!
[Moto G5 Plus Guides, News, & Discussion] Psycake:
Whoa, just found out the F2FS module hadn't installed at all, but for some reason I was passing SafetyNet without problems.

I was having trouble installing any Magisk Module, so I reflashed the F2FS module through TWRP and that did the job.
[Moto G5 Plus Guides, News, & Discussion] eemgee:
I'm having problems just backing stock up.

Booted twrp but backing up gets stuck at

"updating partition details"
[Moto G5 Plus Guides, News, & Discussion] Wolfcity:
The latest build of the module does everything by itself. You just have to flash it one time successfully with TWRP and forget it. You can update magisk and it's modules and even if you accidentally wipe cache partition a reflash of the latest module should solve it.
[Moto G5 Plus Guides, News, & Discussion] logic88:
I had a question about this part. I'm a bit paranoid so I like to keep my data partition encrypted.

Can I still keep my data partition encrypted while rooted on the Moto G5+? If yes, should I skip this step or what should I do?

Thanks!
[Moto G5 Plus Guides, News, & Discussion] Jrhotrod:
Just flash Magisk and you'll preserve encryption. See screenshot:
[Moto G5 Plus Guides, News, & Discussion] gigagb:
How to download the files? All links direct me to an email page. I registered and logged in. It's just a web email UI.
[Moto G5 Plus Guides, News, & Discussion] Wolfcity:
Here you find everything you need, latest magisk is 15.3:

https://xdaforums.com/g5-plus/how-to/how-to-root-moto-g5-plus-t3579659/post74673573
[Moto G5 Plus Guides, News, & Discussion] kavstubh:
I am trying to root the device since yesterday!

Problems:

1) I cannot see the phone's internal storage on my PC. (Which is required to copy Magisk zip to my internal storage). (Can't figure out why) - Changed the driver in "Device Manager".

2) Now with multiple unsuccessful attempts to not able to flash Magisk, I need to reboot to system (I just have only one phone - my daily). - TWRP is installed, even after booting into system and then rebooting to TWRP.

And when I come again, I need to flash TWRP again.

I have MTP enabled. USB cable is fine(Just flashed TWRP).

Even, on the taskbar, it shows the option to eject Moto G.

Thanks.
[Moto G5 Plus Guides, News, & Discussion] bluesneaky:
Okay I am having a problem here and it's something I am doing wrong but I cant figure it out. (Keep in mind the last phone I rooted was a Moto Bionic on 4.1.2 - yes I am upgrading from that to a G5+) I am trying to make a image of my system onto my SD card before I push forward with anything else so the above procedure caught my eye.

I am able to load (not flash) twrp3.2.1.img into the phone with a "fastboot boot twrp3.2.1.img" command (not "fastboot boot recovery twrp3.2.1.img" if that makes a difference). TWRP seems to be running fine on the phone but when I go to make a backup of the system image, twrp freezes at various points in the backup. I have tried version 3.2.1 and 3.1.1. Both will run for a while then just lock up at various points in the save. If I hit cancel it is of no use, its frozen. Only a long hold of the power button will get me out of the freeze up.

As the phone recovers and brings up the warning screen stating my device has been unlocked and can't be trusted I notice on that warning that the "ID:" field is followed with "bad key". Is this normal? It is a little unnerving as if I screwed up the bootloader unlock - none the less the bootloader is unlocked. Just freaks me out and now that I am having trouble it makes me wonder if I am in the first stages of a clusterfudge. Any advice?
[Moto G5 Plus Guides, News, & Discussion] Wolfcity:
First of all,the "bad key" ID is normal, looked the same for me, it's just the warning screen that your bootloader is unlocked, the OEM's like to make it more scary....

To remove it you can flash another bootlogo (there are some around here in the Moto G5+ threads which are flashable through TWRP), you can also extract the logo.bin out of a stock rom and flash it by fastboot (fastboot flash logo logo.bin).

About your problem with the booted TWRP: Some custom recoveries aren't bootable at all and some don't work as they should. The command 'fastboot boot twrp3.2.1.img' is correct, the 'recovery' only comes in when you use the flash command, my fault. So if the backup can't be completed that way you will have to flash the TWRP and do the backup.

If you need a clean and untouched system you can always flash a stock ROM.

I didn't try to backup my ROM with booted recovery but I don't think that you do anything wrong (I suspect you took care of things like PC didn't went into sleep mode or something and the connection to the mobile device was stable all the time, display on, battery loaded).

There are some unofficial TWRP builds in the development thread, you can try one of these as last resort.

But imho it's not such a big problem to don't have a untouched backup. It's good to have one but the 'risky' things happen after flashing the custom recovery when it comes to rooting, encrypting, flashing custom ROMs etc.

So it seems to be not possible to get a full nandroid backup with booted potter TWRP, someone may correct me if I'm wrong.
[Moto G5 Plus Guides, News, & Discussion] Jrhotrod:
If anything will put you in a clusterfudge it'll be flashing one of those damn 64-bit Oreo ROMs. They irreversibly screwed my phone to the point where:

1) I can't use VoLTE if I ever wanted to, they permanently break it

2) Whenever I flash stock my IMEI turns to 0

3) As a result of the IMEI issue, cell service doesn't work. No texts, calls, data, anything.

4) I have to boot up TWRP and restore a lucky EFS backup I made to get cellular working again

5) I can never accept an OTA update again.

Yeah.. stick with stock man. You won't regret it.