[One (M9) Original Android Development] Captain_Throwback:
Frequently Asked Questions (FAQ)

1. Why is this device different than my previous HTC device?

With the M9, HTC has moved to a block-based OTA system. This means that even mounting system as read-write (as TWRP typically does during startup checks) will nullify the device's ability to take an OTA. Any other changes to the system partition will also cause an OTA to fail (even if that check is removed from the OTA zip) due to "unexpected contents."

2. Which version of TWRP am I supposed to use?

For AOSP/LineageOS-based ROMs: The best version to use is 3.4.0-0, the latest official TWRP from twrp.me.

For stock-based Marshmallow/Nougat ROMs: The best version to use is 3.2.3-0, from twrp.me.

For ROMs older than Marshmallow: The best version to use is 2.8.7.0, from twrp.me.

NOTE: The 3.x versions of TWRP and newer will not boot on Lollipop firmware.

3. Why is there a "System" backup option and a "System Image" backup option now?

The "System" option is the standard tar backup. The "System Image" option is only relevant if your system is unmodified. This allows you to make a fully stock backup that can be restored later to take an OTA.

NOTE: If you are using a FAT32-formatted card, a "System Image" backup will fail, due to the 4GB file limit on that format. For a successful System Image backup, NTFS or exFAT-formatted storage must be used (either SD card or USB-OTG)

4. How am I supposed to root?

Magisk is the recommended root solution, as it is actively developed and up-to-date. It also allows devices to pass Google's SafetyNet API for working contactless payments. See the below thread for full details.

Magisk

5. I tried to install x ROM, but it won't boot. Should I use TWRP 2.8.5.0 to flash it?

No, you shouldn't. You should use the version of TWRP recommended above. If the ROM updater-script is done properly, even if your device has system mounted read-only, the ROM should still flash fine. If your ROM chef/team has chosen to mount the partitions some other way, then you may have to mount system manually in order for the ROM to flash successfully. This can be done in the Mount menu, by unchecking the "Mount system as read-only" box and then checking the box next to System to mount it. The very act of booting 2.8.5.0 will change the system checksum, making it impossible to get a fully stock backup.

6. So what's the proper procedure to root without breaking OTA?

There is no way to take an OTA after you root. However, prior to rooting, you can take a fully untouched system image backup with TWRP, which can be used to restore a fully stock system to the device in order to take an OTA.

7. How do I backup stock recovery prior to flashing TWRP?

You can't. The "fastboot boot" command appears to be disabled on the M9's ABOOT, so TWRP must be fastboot flashed over stock recovery. The firmware zip included in the OTA will include a usable stock recovery image. That can be extracted and flashed after stock system is restored so that the OTA can be applied.

UPDATE: As of 3.x firmware, the M9 now supports the fastboot boot function from the bootloader! Now you can fastboot boot TWRP, and then select "Recovery" to back up stock recovery.

8. How do I restore stock system so that I can accept an OTA?

Check the "Mount system as read-only" box in the Mount menu.

Restore stock "System Image" backup (This will only work if you've made a System Image backup prior to making any modifications to /system). As of the official 2.8.6.1 version, it is no longer necessary to fastboot flash the stock system image.

NOTE: If you made a stock system backup with one of the Beta TWRP versions, you will have to rename the backup file in the backup folder manually from "system.emmc.win" to "system_image.emmc.win" for the new official TWRP to see it as a "System Image" backup rather than a "System" backup. Otherwise, you'll get an error that the backup can't be restored because system is read-only.

Fastboot flash stock recovery (fastboot flash recovery recovery_signed.img)

NOTE: It is also possible to restore stock recovery via the TWRP GUI. Rename the stock recovery file to "recovery.emmc.win" and place in the backup folder with the stock system image. Recovery will then show as a restore option. MAKE SURE YOU REALLY WANT TO DO THIS, AS TWRP WILL BE GONE WHEN YOU REBOOT OUT OF RECOVERY!!

Reboot to system, install OTA.

9. What if I have an RUU? Do I need to worry about all this OTA nonsense?

Not if you don't care about losing all your data. If you're S-ON and have an RUU available for your exact variant (model ID and CID must match) and software number (main version must be the same or newer), then you can get back to a fully stock state by relocking (fastboot oem lock) and flashing an RUU. However, if you'd prefer to take an OTA to keep your data intact, the method stated above is how to do so. Or, you can just run a custom ROM and wait for your ROM chef to update their ROM to the latest software (though you'll still have to find a way to update your firmware if you're not S-OFF)

10. After I go through all this and successfully apply an OTA, how do I make sure I have a clean starting point again?

After the OTA is applied and TWRP is flashed, it will once again detect an untouched system, which will mount system read-only and allow you to make a fully stock backup and start the process over again, this time with the new base.

11. How do I get that new stock theme from the Screenshots tab?

See here.

12. What if I'm unlocked but unrooted and don't have access to a computer? How can I install TWRP?

See here.