Install Magisk in TWRP, with "Keep DM-Verity/AVB 2.0" option? I want to flash the Magisk ZIP while keeping dm-verity and AVB 2.0.

The Magisk ZIP detects my encrypted /data partition and keeps force encryption, but always disables dm-verity and AVB 2.0 when flashed with TWRP. This leads to the inconvenience that I have to restore the "stock boot image" (with TWRP) and flash it again in Magisk Manager.

It's better if dm-verity and AVB is preserved at the first flash in TWRP.
With Magisk 17.1 (introduced by topjohnwu in this commit), Magisk installer ZIP now detects system_root_image and keeps dm-verity/AVB 2.0 when being flashed in recovery. This should solve the issue most of the times (at least with my OnePlus 5 and OnePlus 6).

Alternatively, create a file at /data/.magisk with the following content:

KEEPFORCEENCRYPT=true
KEEPVERITY=true


This file will be parsed by the installer script (here) and the settings will be respected.