[Moto G4 Plus Guides, News, & Discussion] echo92:
You can follow this guide here: https://xdaforums.com/moto-g4-plus/how-to/guide-root-moto-g4-plus-supersu-android-t3587918

Same steps apply to the NPJS25.93-14.4 and NPJS25.93-14-8 builds (I've used them on my XT1642 which I flashed with the stock fastboot March 2017 ROM and then updated via OTA to the June build, and it's running well with magisk v13.3 and ElementalX) - I made some changes which I'll detail here: (all credit to the original guide linked above) Links updated on 16/07/2017

1. Unlock your bootloader with the Code you can receive from Motorola. Further instructions: https://motorola-global-portal.custhelp.com/app/standalone/bootloader/unlock-your-device-a. You have to create a Motorola account first. Be aware that unlocking your bootloader will void whatever warranty you have left on your device and also will wipe your device in the process. Back up and keep those backups off your device until you've unlocked your device. You should get a warning about your device being unlocked, when you reboot, if it's worked. Re-locking your bootloader will not restore your warranty. If you've previously unlocked your bootloader, you can skip this step.

2. Flash/boot TWRP through bootloader. I'd suggest using a more up-to-date version than 3.0.2 - I'm using shreps' 3.1.1 TWRP from https://xdaforums.com/moto-g4-plus/development/recovery-twrp-3-0-2-r3-moto-g4-g4-plus-t3494337, though you may wish to use the 3.1 version too - I have found both shrep's 3.1.0 and 3.1.1 TWRP to work well. You can also flash the 3.1.0/3.1.1 official TWRP from https://dl.twrp.me/athene/ When flashing TWRP for the first time, you may encounter the warning message 'Image not signed or corrupt' - that's normal since TWRP isn't cryptographically signed with the expected keys. Provided you see [OKAY] at the end of the flashing command, reboot directly to recovery, so TWRP sticks. Afterwards, you should be able to reboot as normal.

3. Backup partitions in TWRP (especially the boot-partition) - This will give you a stock backup to revert to, with a stock kernel. If you wish to make a backup that you could revert back for taking OTA updates, see the bottom of this post.

4. Flash the ElementalX kernel through TWRP - ElementalX from here: https://xdaforums.com/moto-g4-plus/development/kernel-elementalx-g4-0-01-t3424836 v1.04 stock is what you want, do not omit this step else rooting with the stock kernel will cause bootloops! It appears the resolution to this bootloop is to reflash the stock ROM...

5. Wipe Cache and ART-Cache through TWRP (don't know if necessary but doesn't harm)

5a. Reboot and verify your device is running okay.

5b.If your device is running okay, reboot back to TWRP and backup your system again (make a note this is the backup with ElementalX kernel). You may wish to delete this backup once you're rooted.

6. Flash SuperSU v2.82 through TWRP. https://xdaforums.com/apps/supersu/stable-2016-09-01supersu-v2-78-release-t3452703 . EDIT - looks like v2.82 SR1 beta is up too, so up to you which SuperSU you choose to flash. Just ensure it's 2.79 SR3 or newer.

6a. Alternatively (instead of SuperSU), flash the magisk zip v12.0 or 13.3 in TWRP (from https://xdaforums.com/apps/magisk/official-magisk-v7-universal-systemless-t3473445 ), then update the magisk manager app from the magisk page on XDA (since magisk got taken off the Play Store). Don't mix root managers unless you've uninstalled the previous one, though looks like magisk could be flashed over SuperSU. I'm running the v12 build of magisk in core mode and seems to be giving me Safety Net on a NPJS25.93-14-8 ROM on a XT1642. You may wish to flash magisk v13.3 instead for additional magisk hide support and that's working on the June 2017 stock ROM.

Now, you should be rooted on the March 2017 (or June 2017) security update. Bear in mind that any future Motorola OTA updates require a stock recovery, kernel and system. Attempts to take the updates when you have TWRP may cause a soft-bootloop unless you boot into your bootloader and select 'Start'.

There's a couple of ways to revert back to stock:

a) With step 2/3 as above, when booting into TWRP for the first time, it'll ask if you wish to make modifications to your system or leave it as read-only.

Do not swipe to make modifications, leave your system unmodified (read-only).

Then, make a backup of your device partitions as listed under 'Back up' - you may wish to exclude Cache (and should normally appear unselected). This should make an unmodified backup of your system, (boot) kernel and other partitions. Name as appropriate.

Afterwards, boot back into TWRP and this time, swipe to allow modifications. Then proceed with the rooting.

The reason to make this unmodified backup is, from what I understand, OTA updates now check if your system was modified at all, and fail if even read-write access was granted. Thus, you can revert back to this unmodified backup in TWRP, after which you may be able to flash stock recovery of the same patch level (or if you booted to TWRP only, you should have a stock recovery anyway) and take OTA updates. Don't forget that logo.bin (the boot splash screen with that annoying bootloader unlocked warning) is not backed up/restored by TWRP, so if you flashed a custom logo.bin to hide the warning, you'll have to pull the logo.bin from the same stock ROM as your device's patch level and flash in fastboot. Of course, by using this TWRP backup, you'll lose your messages and data newer than the backup, so back up accordingly.

b)Flash the stock ROM, of the same patch level as your existing device patch level. As we're using the same patch level stock ROM, you'll likely have a bootloader and GPT that matches that in the ROM we're flashing, so no need to re-flash it. Using the following fastboot commands with the stock ROM will remove TWRP, root and ElementalX, but should preserve your data. However, back up in case your device becomes unstable and you need to perform a factory reset in the stock recovery:

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 modem NON-HLOS.bin
fastboot erase modemst1
fastboot erase modemst2
fastboot flash fsg fsg.mbn
fastboot erase cache
fastboot reboot