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.

  • @beeshyams I know I can restore the stock image and flash again, but the question is I want to avoid it, by keeping verity on first flash.
    – iBug
    Aug 29, 2018 at 18:14
  • 1
    Did you try version 17.1 latest one? Claims to keep dm verity
    – beeshyams
    Sep 1, 2018 at 17:26
  • 1
    @beeshyams Thanks for the response. I've flashed Magisk 17.1 and it's working. See my own answer which provides an alternative solution.
    – iBug
    Sep 12, 2018 at 14:18

1 Answer 1


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:


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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .