[T-Mobile LG G5 Guides, News, & Discussion] waylo:
I've been watching the Magisk threads for the past week and decided to take the plunge today. Many Nexus phones seem to have a lot of trouble with Android Pay, but other makes seem to do better. There were confirmations from LG G4 owners. As of this writing Magisk is on v3.

The install steps from the Magisk thread are this:

1. Reflash a stock boot.img to reset your systemless root

2. Flash Magisk.zip

3. Flash modified phh-superuser.zip (not the official one). Chainfire's SuperSU does not currently have as much support, but there is a modified supersu zip as well.

4. Boot and install phh's superuser app from the App store.

5. A 'magisk manager' app is installed via the flashed .zips. This allows you to turn off root for a set # of minutes, without rebooting.

Given the unique way the G5 is rooted, with automatic encryption, I figured it might not be so simple to install this if I wanted to keep my data without a full wipe. It quickly became much more complicated than what I wanted. Here's exactly what happened.

First, I made a full boot+system+data backup.

Then, these were my thoughts/concerns:

I have Adaway installed with the systemless addon zip and SuperSU installed. Magisk installation requests flashing back the stock boot.img. What would this do to the supersu install and Adaway?

The adaway systemless zip makes a script file which is kept in the /su/su.d/ folder. I removed this.

The SuperSU has a complete uninstall feature. As part of this uninstall process, it asks if you want to restore the boot.img (yes--this stock one is backed-up after the initial supersu.zip flash during our initial root/TOT process) and/or the recovery (no, don't do this, but it probably would not have done anything as there is no stock recovery backup). I thought this would accomplish our goal. It does warn you that you may have re-encrypting of the data partition if you go this route.

And unfortunately, after rebooting, it automatically and immediately encrypted the data partition.

Well shoot. Correct me if I'm wrong, but an encrypted data partition cannot be worked on. It booted just fine, but without root.

I started having some doubts at this time so I decided to try to restore back to my initial setup. Through TWRP, I wiped the data partition and flashed the no-verity.zip, to hopefully stop any re-encryption.

Then, after figuring out how to mount system properly (TWRP defaulted to mount system as r/o), I restored my nandroid backup in its entirety.

But upon reboot, it went immediately into bootloader mode. And it continued to do this after every battery pull and power on. I had never heard of this before! Finally, I realized I could still boot into TWRP. I flashed the 10Dcomplete.zip made by autoprime, restoring the boot and system partitions to stock. And then I flashed the magisk v3.zip and the modified phh-superuser zip.

It finally rebooted into Android, with data intact! Oddly, my unlock pattern had changed without my knowledge, but the backup PIN worked. I installed the market phh Superuser. Magisk is installed properly and it passes SafetyNet, and I can add cards to the app. I'll test out Android Pay next opportunity I have.

If I had to do it all again and wanted to keep data intact, this is what I would do.

1. Autoprime did make a 10D boot flashable zip. So this would restore the stock boot.img as intended. There are some files to clean up, such as data/su.img, but that can be dealt with later.

2. I do not know if just flashing the stock boot.img would result in re-encrypting. It probably would. So, immediately after flashing the boot.img in TWRP I would flash magisk and the phh-superuser.

Alternatively, they say you should not dirty flash for things this complex. So consider starting completely new from a 10Dcomplete flash with wiped data.