[Huawei P9 Plus Guides, News, & Discussion] Tecalote:
Instructions for root

Instructions for root access

Root is not required, but if you still wish, here is the guide:​

Due to the fact TWRP cannot access the encrypted data partition, you cannot JUST flash Magisk!!

→ A) But you can flash Magisk with TWRP using a workaround

→ B) Alternatively it is possible to flash a Magisk patched ramdisk.img in Fastboot mode

A) Workaround for flashing Magisk with TWRP – for Advanced Users:

1) Download the favorite Magisk version from here (all releases): https://github.com/topjohnwu/Magisk/releases

The actual and newest stable version you can get always from here too: https://xdaforums.com/apps/magisk/official-magisk-v7-universal-systemless-t3473445

2) Copy the flashable Magisk-vXX.zip and Magisk Manager apk to external SD – and make sure, you have Developer options with 1) ADB Debugging and 2) USB Debugging (in this order) enabled.

3) Reboot device to TWRP, cancle Password, allow system-modification (swipe to confirm)

4) On the main menu go first to "Mount" - down left click on "Select storage" and choose "Micro SD"

5) Go back to main menu and open "Advanced" and open "Terminal"

NOTE:

If you have got a OTA-Firmware Update with “Patch02” or “Patch01” before flashing the Network Patch (after Network Patch, you will not see this in "About phone"!) or if you don’t remember, then use following both Lines in Terminal, but if you are sure, you have only Firmware without Patch 01 or Patch02, then use just "Keep Force encrypt" Line. Write the Lines in TWRP/Terminal exactly.

6) Write following code with Terminal:

echo KEEPVERITY=true>>/cache/.magisk
echo KEEPFORCEENCRYPT=true>>/cache/.magisk

→ Confirm each Line with blue/white checkmark on keyboard, before writing the next Line and confirm also the second Line (if you use two)

7) Go back to the main menu to "Install" and flash Magisk - after that reboot phone without wipe of Dalvik/Cache!

8) Search for Magisk Manager on Homescreen - if it is not installed, just install the Magisk Manager apk

9) Open Magisk Manager → everything should be okay

10) Open normal settings /apps & notifications /Magisk Manager /permissions and make sure Magisk Manager has permission for storage.

11) From Magisk Manager menu above left, section “Downloads” – download and install directly “Busybox for Android NDK” by osmosis – save log and reboot phone.

→ If Magisk get a major update, uninstall first Magisk from Magisk Manager and use “uninstall” button. “Uninstall complete” The phone restarts automatically. After that you can flash the new Magisk and reflash the modules.

B) Flashing Magisk with patched ramdisk.img in Fastboot mode:

If you don’t want flash Magisk with the TWRP workaround – you can use a Magisk patched ramdisk.img instead.

1) You can patch ramdiks.img from update.app by yourself, with following method:

Extract the update.zip of the current installed Firmware, because we need the UPDATE.APP.

Download Huawei Extractor v0.9.9.5 from here: https://xdaforums.com/showthread.php?t=2433454

In the settings of the Huawei Extractor disable "verify header checksum" - then put with drag and drop the UDPATE.APP into Huawei Extractor and extract by right click the RAMDISK.img (on earlier Android Versions it would be: BOOT.img)

2) Copy the original RAMDISK.img to your phone to the internal storage in the folder: Download

3) Install the latest Magisk Manager: https://xdaforums.com/apps/magisk/official-magisk-v7-universal-systemless-t3473445

4) Open Magisk Manager, Magisk Manager ask you "Install Magisk-vx.zip?" - first click on: no thanks

5) Since internal storage is encrypted by default, you must first enable the checkbox: "Preserve force encryption"

5) If you have installed a OTA-Firmware Update with Patch01 or Patch02 – then enable additional the checkbox "Preserve AVB 2.0/dm-verity" in Magisk Manager.

6) Then click on "Install" - "You want to install Magisk-v1x.zip now?" - Install - Patch Boot Image File...

7) Navigate to Download folder, and choose RAMDISK.img

8) Magisk will now patch the RAMDISK.img and and once that's done, Magisk will save the patched ramdisk.img with the new name: patched_boot.img in the "Download" folder on internal storage.

→ Do not be confused - this is just named “patched_boot.img, but it is in fact the patched ramdisk.img !

9) Go to Settings /Apps & notifications/Apps and uninstall Magisk Manager

10) Now you must flash the “patched_boot.img” – Reboot your phone into Fastboot mode

Android 8:

fastboot flash ramdisk patched_boot.img

10) Reboot phone, install again newest Magisk Manager, open it and you will be asked: "Requires Additional setup - to you want to proceed now" Yes. → This step is required for to work properly.

Google Playstore certification

You can try it with method by [MENTION=7786725]zgfg[/MENTION]:

https://xdaforums.com/showpost.php?p=79070144&postcount=1574

→ If it does not work you can try advanced method:

1) Set your phone into Flight Mode (no network should be connected)

2) Open Settings/Apps & notification/Apps and down right in the dot menu click on: show systemprocessing

3) Go step by step into following Apps (if there): Google - Google Play Store - Google Play Services - Google-Service-Framework - each has the entry: storage - delete ONLY cache /not data

4) Open with Mixplorer the directory:

/data/data/com.android.vending/shared_prefs - search for the xml file: finsky.xml

5) Open finsky.xml with TEXT Mixplorer Text Editor

6) Search inside finsky.xml for: <boolean name="device-google-certified"value="false" - change it to:

<boolean name="device-google-certified"value="true"

- means, you change only "false" to: "true"

7) click on the save symbol to save the changes! - close Mixplorer and everything in the Background

8) Disable Flight Mode (so Phone search for network connections)

9) Reboot your Phone

10) Open Playstore menu /settings/ =certified

If you have problems with current version of Magisk and using Gpay (Google Pay), try following workaround:

https://xdaforums.com/showpost.php?p=79028818&postcount=5

How to uninstall Magisk:

A) Before you doing an OTA Update, it is required to uninstall Magisk → and also make sure, to have Stock EMUI Recovery installed (instead of TWRP).

B) In case for a “major” Magisk update it is also sometimes necessary to uninstall Magisk before installing the new version, because with directly update the phone could get a Bootloop. (But normally Magisk updates can be done directly and without uninstalling Magisk before).

C) If your device can not boot into system due to an incompatible Magisk Module.

a + b) If you can boot normally to system, you can uninstall Magisk from Magisk Manager - just use the "Uninstall" button “Uninstall complete”. Magisk will be uninstalled and Magisk files deleted from /data directory. Thereafter, the P9 is restarted automatically.

c) If your device can not boot into system due to an incompatible Magisk Module, you can flash the original EMUI Stock ramdisk.img (which is not patched with Magisk)

→ ramdisk.img must match the Firmware version of your device

For the current Firmware VIE-AL10 b537 you can download the original ramdisk.img here:

VIE-b537-RAMDISK.img:

https://www.androidfilehost.com/?fid=1395089523397898698

You can flash it in Fastboot Mode:

fastboot flash ramdisk VIE-b537-RAMDISK.img

Alternatively, you can flash the image with TWRP.

In this case you flash the img with TWRP by using: "flash img" - but important is, you must flash it to: ramdisk (and NOT to recovery_ramdisk !!)

Soon you have installed the EMUI ramdisk.img, the device can boot to system again and Magisk is disabled.

Credits:

[MENTION=4544860]osm0sis[/MENTION] Busybox for Android NDK

[MENTION=4667597]Didgeridoohan[/MENTION] MagiskHidePropsConfig module

[MENTION=4470081]topjohnwu[/MENTION] Magisk root