[Huawei P9 Guides, News, & Discussion] Wattsensi:
Step 0: introduction

Hello everyone. As you may or may not know, after unlocking, rebranding, updating and patching our P9's, we can now install a part of a big universe of brand new Treble ROMs into our devices. An example of that kind of ROMs is the OpenKirin team's AOSP-based ROMs, AndyYan's LineageOS or phhusson's Phh-Treble for a barebones pure Android experience.

But that experience so far is far from perfect. Aside from Q ROMs not booting yet on hi3650 devices like ours, some features may be missing such as camera support, GApps or [insert favorite mod here] which come in the form of flashable zips. A major problem now is that our phone's internal storage must always be encrypted at every ROM install. This poses some problems such as:

* Having to install Huawei's stock recovery every time you need to do a factory reset otherwise your brand new ROM is not booting when you wipe with TWRP.

* Not being able to flash ZIPs in TWRP from the internal storage.

* Having to install custom ROMs by flashing to /system through fastboot which is slow and can be interrupted

* On a fresh ROM boot, the phone takes extra time to encrypt and then on every subsequent boot it will take longer to boot.

Encryption brings extra security, but at the cost of usability and speed. Luckily for us, it can be disabled in favor of having a more traditional custom ROM + TWRP flashing workflow. This can be done by editing a fstab file in our device's vendor partition. Once the procedure is done you will be able to:

* do factory resets from TWRP without problems

* mount internal storage in TWRP and flash ZIPs without problems

* not need to juggle .img files to switch recoveries because everything will be possible from TWRP

Note: This effect is permanent. No need to do it again. You can also easily reverse it manually.

WARNING: YOUR INTERNAL STORAGE MUST BE WIPED CLEAN. BACKUP ANY IMPORTANT DATA TO AN EXTERNAL STORAGE BEFOREHAND. YOU WILL LOSE ALL YOUR FILES AND APPS.

Note: If you ever decide to reflash your stock EMUI firmware, remember that your device will be re-encrypted. If you get stuck at the boot logo after going back to EMUI from a decrypted device, reboot manually to recovery, do a factory reset in the stock recovery and try again.

Required:

* A backup of your important data

* A computer

* working Android install with root

* A working ADB/fastboot environment

* A USB-C cable with data connections

* Pretoriano80's TWRP for Treble-enabled Huawei P9

Your ROM, custom kernels and Magisk will survive the procedure. Don't worry about them.

Step 1: Modify the vendor fstab

Using MiXplorer, navigate to /vendor/etc. We're going to modify the fstab.f2fs.hi3650 file. Back it up in your SD card, because the internal storage will be wiped clean so if you mess the process up you don't want to lose it. Now open the original file with a text editor and edit it, go to the line that contains /data and change the forceencrypt word to encryptable.

Step 2: Flash TWRP

Through Fastboot, install Pretoriano80's TWRP. This is the best TWRP available for our device.

# fastboot flash recovery_ramdisk twrp.img

For the next step, we need to reboot to the recovery.

# fastboot reboot recovery

Step 3: Format internal storage

On TWRP, back your internal storage up if you haven't already. This is your last chance to do a backup.

After that, wipe your internal storage. Go to Wipe -> Format Data and confirm. The deed is done.

Now boot your system. ROMs should no longer push their encryption on you, and you can now mount the internal storage in TWRP.