[ROOT] Magisk AutoRoot: Magisk + phh's SuperUser for Nougat (No TWRP required)

topjohnwu

Senior Recognized Developer / Recognized Contribut
Jan 31, 2012
1,849
60,437
0
Taipei
People are panicking about TWRP not working on the latest Nougat firmware.
As an advanced user like me, I cannot live with a device with no root, so here is my solution.
Oh, and of course, your device need to be either bootloader unlocked, S-OFFed, or both.

What Is Magisk
Maybe.... you live under a rock? :p:p
Magisk Subforum on XDA

What This Will Do
Following the instructions here will install Magisk v9.1 (nearly same as official v9 with some fixes for cache support) and phh's SuperUser to your device.
You DON'T need any custom recovery, and your system partition is NOT touched at all.
Files and binaries are stored in the cache image, Magisk will move them to /data in the next reboot.
You can upgrade Magisk, phh root, and install other Magisk Modules within the Magisk Manager app!

Instructions
If a prebuilt boot image is available:
  1. Download "magisk+phh_arm64_cache.zip", your prebuilt boot image, and unzip both
    You should get "patched_boot.img" and "magisk_cache.img"
  2. Install Magisk Manager and phh's SuperUser app
  3. Reboot your device to download mode (adb reboot download)
  4. Manually flash the images:
    Code:
    fastboot flash boot patched_boot.img
    fastboot flash cache magisk_cache.img
  5. Reboot and you're done!
If you are using other bases, then grab your boot image from your OTA package, and follow the instructions:
  1. Download "magisk+phh_arm64_cache.zip", "magisk_boot_patcher.zip", and unzip both
    You should get "magisk_cache.img", and a folder with scripts and tools
  2. Grab ANY rooted device >Android 5.0 to do the patching. Running the scripts on an unrooted device will create an unbootable boot image!
  3. Follow the instructions in the README.txt of the tool, it shall guide you to patch your own boot image

Downloads:
Prebuilt Cache Images:
Prebuilt Boot Images:
Magisk Manager:
phh's SuperUser app:
 

Attachments

jsaxon2

Senior Member
Mar 3, 2010
970
701
123
Lock Haven, PA
Just installed on US Unlocked HTC 10 running Stock Android N. Works great. I now have root back. Thanks for doing this.

Also, @topjohnwu correct me if I'm wrong, but if you install a Magisk Module that prevents your phone from booting, you can just re-flash the cache image. That would remove all modules you may have added and start back with just root.

And as an added bonus, I am also passing SafetyNet which I was not before do to the unlocked bootloader. Great work.
 

Attachments

Last edited:

sane82

Senior Member
Mar 1, 2010
81
10
0
Denver
Sorry if it's already been answered in a different form it has been a while since I've been on here butt Am I able to just pull the boot image file out of the roms zip I am using or could I use the backed up boot image from the nand backup I have. Or do I have to do the Adb method. Thanks in advance.
 

jbm76

Senior Member
Mar 15, 2011
1,066
377
103
Brisbane
This works well thank you. Has anyone been able to get xposed to work within it? I've tried to download all 3 and it will not install them - says Can't load the content at the
moment
EDIT - didn't know Xposed need SDK 24 for N... So disregard last bit
 
Last edited:

GhastlyTT

Member
Jan 19, 2013
38
23
0
Hampton
I have to ask, what Rom are you using? Did you update to N OTA? Are you on Viper or one of the beta ICE or LeeDroid versions?
I fixed the bootloop by extracting the stock OTA boot.img and flashing that. I did update OTA from M using TWRP then SD card flashing the firmware.zip. Really want your stock dialer module back lol.
 

jsaxon2

Senior Member
Mar 3, 2010
970
701
123
Lock Haven, PA
I fixed the bootloop by extracting the stock OTA boot.img and flashing that. I did update OTA from M using TWRP then SD card flashing the firmware.zip. Really want your stock dialer module back lol.

I OTA to Android N and wanted to try this out. Just flashed a stock boot.img and will see if that fixes the bootloop.
We're either of you using Magisk prior to OTA? I'm wondering if the magisk.img file was still in /data after you updated.

I RUU'd prior to taking the OTA so I was coming from a clean phone and did not have any problems installing this.
 

GhastlyTT

Member
Jan 19, 2013
38
23
0
Hampton
I fixed the bootloop by extracting the stock OTA boot.img and flashing that. I did update OTA from M using TWRP then SD card flashing the firmware.zip. Really want your stock dialer module back lol.
We're either of you using Magisk prior to OTA? I'm wondering if the magisk.img file was still in /data after you updated.

I RUU'd prior to taking the OTA so I was coming from a clean phone and did not have any problems installing this.
I was in fact using Magisk. I took the OTA with Magisk and Root installed. In fact, i have the AOSP lockscreen still lol.
 

serophia

Senior Member
Feb 8, 2013
330
97
0
California
We're either of you using Magisk prior to OTA? I'm wondering if the magisk.img file was still in /data after you updated.

I RUU'd prior to taking the OTA so I was coming from a clean phone and did not have any problems installing this.
Yes I was but i thought flashing stock boot.img will remove magisk seeing as how it allowed me to ota onto Android N perfectly fine.