Home > Tips and Tricks

Disable DM-Verity or Android Verified Boot without TWRP

In this tutorial, we will show you the steps to disable DM-Verity or Android Verified Boot (AVB) without using TWRP Recovery. One of the biggest assets of having an open-source OS like Android is the ability to carry out a plethora of tweaks. And if you are among the tech enthusiasts, then you are likely to take these modifications one step further. To begin with, you could unlock the device bootloader, flash a custom recovery like TWRP, LineageOS, etc or install custom ROMs like Pixel Experience, LineageOS, AOSP among others.

Likewise, you could also root your device via Magisk, with TWRP or without TWRP. But this is where things begin to get interesting. Once you install an app and grant it the superuser permission, then it straight away gets access to the system partition. It could then carry out administrative-level tasks. And this is where DM Verity comes to play. Since your device is now rooted,  some potentially harmful apps might sneak into your device and spell trouble.

As a result, Google has put into a place a stringent security mechanism called Device Mapper Verity. It prevents such apps from executing their tasks. While it is indeed a good move from the security point of view, yet it also restricts the app from performing its full functionalities. A rooted user already knows a thing or two about the apps that might spell trouble for their device and hence they wouldn’t install them in the first place.

So rather than DM Verity straightaway blocking the functions of rooted apps, we believe it should be up to the end-user to act as per the request. And that is what we would be doing in this guide. We will show you how to disable DM Verity or Android Verified Boot (AVB) without using TWRP Recovery. This way you could easily install all the mods and tweaks on your device without any issues. So on that note, let’s get on with the guide.



Method 1: Disable DM Verity via Magisk

The first valid question that might come to your mind is why we went ahead with this method. After all, you could easily disable DM Verity just by flashing a couple of ZIP files via TWRP. So this question becomes all the more justified. Well, the thing is not every Android device comes with a TWRP Recovery.

Furthermore, when one could easily root their device without TWRP and even Install OTA Updates in Rooted Android Device, why should we be dependent on TWRP for the aforementioned task. So for all the device owners that don’t have a working TWRP build or don’t wish to flash one, this method is all that is needed. Follow along for the complete instruction steps to disable DM Verity or Android Verified Boot (AVB) without using TWRP Recovery.

STEP 1: Get Stock Boot Image File

To begin with, you will have to get hold of the stock boot.img file. For that, download the stock firmware corresponding to your device and then extract the boot.img file from it. if the firmware is in ZIP format, you could easily extract it via WinZIP or WinRAR. In case, it is in OZIP format, then refer to our guide on How to Extract OZIP Realme and Oppo Stock ROM (Firmware). Likewise, if it’s in payload.bin format, then head over to the guide: How to Extract payload.bin and get the stock boot image file.

payload-bin-dumper-inside-python
OZIP ROM Extracted via Python

If you have a Xiaomi device, then maybe its firmware would be in GZ format. So rename it to TGZ and use 7ZIP to extract it. We also have a boot.img file for a couple of devices, if it meets your requirement, then you could directly download it without the need for extraction.  The first one is Poco X3 NFC: Download Poco X3 NFC Stock ROMs | Fastboot and Recovery.

Next up, is the OnePlus Budget offering: Download OnePlus Nord Stock Boot Image Files [All Versions]. If you aren’t able to get the boot.img file, let us know in the comments, we will help you out. With that said, let’s proceed with the steps to disable DM Verity or Android Verified Boot (AVB) without using TWRP Recovery.

STEP 2: Install ADB | Enable Debugging

First off, you will have to install Android SDK Platform Tools on your PC. This will provide you with the necessary ADB and Fastboot binary files. After this, install Magisk Manager on your device. Along the same lines, we would request you enable USB Debugging as well. This will make your device recognizable by your PC in ADB mode.

usb debugging oneplus

But why do we need ADB Mode? Well, it will be needed to boot your device to Fastboot Mode. After that, we would use this Fastboot Mode to flash a file. So head over to Settings > About Phone > Tap on Build Number 7 times > Go back to Settings > System > Advanced > Developer Options > Enable USB Debugging. [Don’t Miss: Enable USB Debugging on a Broken Android Device’s Screen? Here’s a Workaround].



STEP 3: Disable Preserve AVB 2.0/dm-verity

disable avb 2.0 dmverity magisk

  1. Its now time to disable the Preserve AVB 2.0/dm-verity option.
  2. So launch the Magisk Manager app on your device.
  3. Tap on Advanced Settings and uncheck the Preserve AVB 2.0/dm-verity option (if not done by default). This is an important step that you need to do before you disable DM Verity or Android Verified Boot (AVB) without using TWRP Recovery.

STEP 4: Patch Stock Boot Image File

Next up, you will have to patch the stock boot.img file via Magisk. Here are the required instructions for the same:

  1. Transfer the stock boot.img file to your device.
  2. Launch Magisk Manager and tap on Install.
  3. From the Install Magisk popup that appears, again tap on Install.
    patch-stock-boot-image-disable-dmverity-avb
  4. Then under Select Method, tap on Select and Patch a file.
  5. Navigate to the stock boot.img file and select it. If you have a Samsung device then it might be in .tar format
  6. Magisk will now begin patching the stock boot.img file. It should only take a few seconds for the process to complete.
    patch-stock-boot-magisk-disable-dmverity-avb
  7. Once done, the magisk_patched.img file will be created and saved under Internal Storage > Downloads.
  8. Copy this file and move it to the platform-tools folder (where Android SDK is installed) on your PC. After that, you may proceed with the below steps to disable DM Verity or Android Verified Boot (AVB) without using TWRP Recovery.

STEP 5: Flash Patched Boot IMG File | Disable DM-Verity

Finally, you now have to flash this patched boot.img file via Fastboot Commands. Refer to the below steps to do so:

  1. Connect your device to PC via USB Cable. Make sure USB Debugging is enabled.
  2. Then head over to the platform-tools folder. Type in CMD in the address bar and hit Enter. This will launch Command prompt.
    command-prompt-adb
  3. Now execute the below command to boot your device to Fastboot mode:
    adb reboot bootloader
  4. Finally, execute the following command to flash the patched boot.img file:
    fastboot flash boot magisk_patched.img
  5. When that is done, you may now reboot your device to the system using the below command:
    fastboot reboot

With this, we conclude the guide on how to disable DM-Verity or Android Verified Boot (AVB) via Magisk. If you have any queries, do let us know in the comments section below.

Method 2: Disable DM Verity via Fastboot Commands

You could also disable the verity checks on your device by flashing the vbmeta (and in some cases, the vbmeta_system and vbmeta_vendor files as well). Here’s how it could be carried out. Droidwin and its members wouldn’t be held responsible in case of a thermonuclear war, your alarm doesn’t wake you up, or if anything happens to your device and data by performing the below steps.

STEP 1: Install Android SDK

install adb platform tools windows

First and foremost, you will have to install the Android SDK Platform Tools on your PC. This is the official ADB and Fastboot binary provided by Google and is the only recommended one. So download it and then extract it to any convenient location on your PC. Doing so will give you the platform-tools folder, which will be used throughout this guide.

STEP 2: Download and Extract Stock Firmware

Next up, download the stock firmware for your device and extract it to any convenient location on your PC. Once the extraction is complete, transfer the below files to the platform-tools folder.

  • boot.img [compulsory]
  • vbmeta.img [compulsory]
  • dtbo.img [if present]
  • vendor_boot.img [if present]
  • vbmeta_system.img [if present]
  • vbmeta_vendor.img [if present]

disable DM Verity

Do note that not every device has the dtbo.img, vendor_boot.img, vbmeta_system.img, and vbmeta_vendor.img, that is completely fine. However, your stock firmware should definitely have the boot.img and vbmeta.img files.

STEP 3: Enable USB Debugging and OEM Unlocking

Next up, you will have to enable USB Debugging and OEM Unlocking on your device. The former will make your device recognizable by the PC in ADB mode. This will then allow you to boot your device to Fastboot Mode. On the other hand, OEM Unlocking is required to carry out the bootloader unlocking process.

disable DM Verity

So head over to Settings > About Phone > Tap on Build Number 7 times > Go back to Settings > System > Advanced > Developer Options > Enable USB Debugging and OEM Unlocking.

STEP 4: Unlock Bootloader

Next up, you will also have to unlock the device’s bootloader. Do keep in mind that doing so will wipe off all the data from your device and could nullify its warranty as well. So if that’s all well and good, then please refer to our detailed guide on How to Unlock the Bootloader on any Android Device.

disable DM Verity

STEP 5: Boot Device to Fastboot Mode

  1. Connect your device to the PC via USB cable. Make sure USB Debugging is enabled.
  2. Then head over to the platform-tools folder, type in CMD in the address bar, and hit Enter. This will launch the Command Prompt.
  3. After that, type in the following command in the CMD window to boot your device to Fastboot Mode
    adb reboot bootloader
  4. To verify the Fastboot connection, type in the below command and you should get back the device ID.
    fastboot devices

disable DM Verity

STEP 6: Disable DM Verity Check via Fastboot

You may now disable the verity check by flashing the vbmeta (and vbmeta_system and vbmeta_vendor) files. So proceed with the below instructions to start the process:

  1. To begin with, flash the vbmeta file to both the slots using the below command:
    fastboot --disable-verity --disable-verification flash vbmeta_a vbmeta.img
    fastboot --disable-verity --disable-verification flash vbmeta_b vbmeta.img
  2. Then if your device comes with a vbmeta_system file, then flash it across both the slots using the following commands:
    fastboot --disable-verity --disable-verification flash vbmeta_system_a vbmeta_system.img
    fastboot --disable-verity --disable-verification flash vbmeta_system_b vbmeta_system.img
  3. Likewise, if your firmware also has the vbmeta_vendor file, then flash it across both the slots using the below commands:
    fastboot flash --disable-verity --disable-verification vbmeta_vendor_a vbmeta_vendor.img
    fastboot flash --disable-verity --disable-verification vbmeta_vendor_b vbmeta_vendor.img
  4. That’s it. You may now reboot the device to the OS via the below command:
    fastboot reboot

So these were the steps to disable DM-Verity or Android Verified Boot (AVB) via Fastboot Commands. If you have any queries concerning the aforementioned steps, do let us know in the comments. We will get back to you with a solution at the earliest.


Share:
  • Aleksandr

    Could you write please, what version of Magisk and Magisk Manager you used?
    I installed several versions from 2023 to 2019 and I could not find a menu “Advanced Settings” in all of them.

    • Aleksandr

      I saw the version numbers in the picture. I apologize for the question.

  • Hello!
    Tell me what about dtbo and vendor_boot?
    I dont see any command with it here.

    Executed all vbmeta and patched boot commands,
    phone is rooted and works fine but /system and /vendor is read only,
    cannot modify it. How to fix it?

  • Moiz Faisal

    hello i am trying to root my device vivo y55 2022, i have disabled vbmeta and vbmeta_system via adb and flashed magisk patched image as well, but when i reboot my device it says device is corrupted and it will not boot, really want to root if you can help me it will be appreciated, my android version is 12

  • Boot image for my device is unpublished. Can’t I just make a copy with dd linux utility?

  • Navid Bazrkar

    please tell me all Ways to prevent twrp injection into the phone recovery partition

  • Jennifer

    I tried to root my Samsung A52s 5G, I used odin 3.14 to flash a magisk patched AP.tar which is patched by Magisk v23, unfortunately, it results a bootloop on my device, and I saw this article about disable dm-verity, but there is no “Preserve AVB 2.0/dm-verity” option in Magisk v23, please help me to root my A52s 5G, thanks.

    • Jennifer

      by the way, my device is unlocked, and I cannot find any TWRP for A52s 5G, so I tried your Magisk way, whether I use Magisk v23 version or the canary build, boot-loop still happens, please help, thanks.

  • BennieHelder

    good day !
    i have an motorola one action with android 11 R. Because it is rolled out via the Rescue and Smart Assistant from Lenovo, you do not have the firmwarefiles. Is it possible for you to extract the boot.img from this update, so I can root the phone?
    info:model: xt2013_2
    canal : reteu
    firmware : Troika_RSBS31.Q1-48-36-13_subsidy-DEFAULT_regulatory-DEFAULT_(2,1GB)

    This is the code you find on the Lennovo assistant, so I hope you can make the patch or send the bootfile, I use this guide’s permanently and thank you for all this help! Bennie from Holland

  • LUCASYMAX

    PLEASE HELP ME THANKS IN ADVANCE

  • Hi
    Could you please help me to root my galaxy s9+ ?
    [link removed by admin]
    Thanks

    • Sadique Hassan

      Hi Sami, I have added it to my bucket list, shall cover it shortly.

      • lucasymax

        C:\Users\HARMAN\AppData\Local\Programs\Python\Python38>python ozipdecrypt.py realme.ozip
        ozipdecrypt 1.3 (c) B.Kerler 2017-2021
        Detected mode 2….
        Finding key… realme.ozip
        Unknown mode2, boot.img wasn’t encrypted

        C:\Users\HARMAN\AppData\Local\Programs\Python\Python38>
        same error as fubuki
        realme 7 rmx 2151 dual sim
        android 10
        cpu helio G95
        compilacion RMX2151_11_A.83
        KERNEL 4.14.141
        VERSION DE COLOR OS v7
        BASE BAND M_V3_P10,M_V3_P10

        • Sadique Hassan

          Hi lucasymax, will upload the file within a day and will share the link in my Realme post.

          • i am also getting the “Unknown mode2, boot.img wasn’t encrypted” error on my realme XT,

            Help?

            • Sadique Hassan

              Could you verify if you are trying these steps with the entire firmware file and not the incremental OTA. Because the latter is known to cause issues.