FORUMS

Universal DM-Verity, ForceEncrypt, Disk Quota Disabler [3/4/2020]

3,949 posts
Thanks Meter: 6,470
 
Post Reply Email Thread
Hi all!

For the past couple of months, I've been looking into making a more universal solution to disable dm-verity and forceencrypt. Needing to take different zips, modify them for different devices, and then cross your fingers when you switch between custom and stock roms simply wasn't good enough for me. After lots of searching around, failed attempts, and some guidance by @Xennet, @osm0sis, and @nathanchance (thank you all for your help), I finally got a working solution. Ironically, it was under my nose the whole time.

@topjohnwu figured much of this out a while ago with his magiskboot binary - just modify the fstabs. Magiskboot only works for fstabs in the ramdisk though and dm-verity and forceencrypt are only disabled under certain conditions (when you create a .magisk file with the variables set to false and place it in the proper location). So I made an installker with AK3 by @osm0sis and used a combination of sed patches by @jcadduono in addition to others I found for fstabs not in the ramdisk, modified magiskboot with some extra entries I found need to be removed on some devices, and added some stuff of my own like the creation of .magisk and .supersu files in the right location with the proper contents.

The end result: a zip that will remove dm-verity and/or forceencrypt from all fstabs on your device
It can also remove disk quota if you choose. This may be needed if you have an older twrp and/or want to downgrade to Nougat. More info here: https://source.android.com/devices/storage/faster-stats

Instructions:
The name of the zip determines what's DISABLED. Here are the current options:
  • Add 'enfec' or en'forceencrypt' to zipname to keep forceencrypt enabled if present
  • Add 'fec' or 'forceencrypt' to zipname to disable forceencrypt (zipname already has this so remove these if you want to keep it enabled)
  • Add 'quota' to zipname to disable disc quota
Note that verity is always disabled - it has to be for any modifications with this mod

If you're currently encrypted:
  1. BACKUP YOUR INTERNAL STORAGE TO YOUR PC
  2. Format data (this is NOT the same as Wipe data) (In TWRP: Wipe -> Format Data)
  3. Reboot back into recovery
  4. Follow the directions below for when you're not encrypted

If you're not encrypted: flash all of your stuff, then FLASH THIS ZIP LAST

Some extra details for Slot devices:
  1. Flash ROM
  2. Flash TWRP Installer Zip
  3. Reboot into TWRP
  4. Flash everything else
  5. Flash this zip

Only difference here is the twrp zip and the recovery reboot, main principle is the same - FLASH THIS ZIP LAST

Troubleshooting:
  • Take a recovery log after flashing this zip (thanks to @aIecxs for the imgs):
  • If the zip isn't patching any fstabs that it should be, then it's possible that the previous zip(s) didn't unmount system and/or vendor properly. Either unmount them in twrp, or just reboot back into recovery and flash this zip again

Compatibility: Any android device

Source: https://github.com/Zackptg5/Disable_...y_ForceEncrypt

Download
The Following 227 Users Say Thank You to Zackptg5 For This Useful Post: [ View ]
17th July 2018, 10:21 AM |#2  
rippledrums's Avatar
Senior Member
Flag Portugal
Thanks Meter: 559
 
More
Quote:
Originally Posted by Zackptg5

Hi all!

For the past couple of months, I've been looking into making a more universal solution to disable dm-verity and forceencrypt. Needing to take different zips, modify them for different devices, and then cross your fingers when you switch between custom and stock roms simply wasn't good enough for me. After lots of searching around, failed attempts, and some guidance by @Xennet, @osm0sis, and @nathanchance (thank you all for your help), I finally got a working solution. Ironically, it was under my nose the whole time.

@topjohnwu figured much of this out a while ago with his magisk installer. However, dm-verity and forceencrypt (fec) are only disabled under certain conditions (when you create a .magisk file with the variables set to false and place it in the proper location). This would be fine for magisk users, but not for everyone else. So I took Magisk 16.6 beta zip, modified it to add fstab patches by @jcadduono, added some stuff of my own, and then gutted all of the magisk stuff unrelated to this.

The end result: a zip that will remove dm-verity and fec from your boot img and fstab files (without installing magisk, I took all of that out).

Instructions:
If you're currently encrypted: BACKUP YOUR INTERNAL STORAGE TO YOUR PC. Then format data. Reboot back into recovery
After doing that or if you're not encrypted: Flash your rom, custom kernel and/or root (like magisk or supersu), then this zip.
This zip should probably be flashed after anything that modifies your boot img (magisk, supersu, other root solutions, custom kernel, etc.).

Compatibility: Any device magisk is compatible with

Source:https://github.com/Zackptg5/Disable_Dm-Verity_FEC

Hi!

Just to be sure, does this remove the need to flash patched boot.img files when updating stock ROMs with root?

Thanks!

Sent from my OnePlus 3T using XDA Labs
The Following 2 Users Say Thank You to rippledrums For This Useful Post: [ View ] Gift rippledrums Ad-Free
17th July 2018, 11:05 AM |#3  
shadowstep's Avatar
Recognized Contributor
Flag Ambala, HR
Thanks Meter: 6,403
 
Donate to Me
More
@Zackptg5 Thanks for the zip! I trust this will work for both -- Treble and non-Treble ROMs, yes?
17th July 2018, 12:37 PM |#4  
Zackptg5's Avatar
OP Recognized Developer
Thanks Meter: 6,470
 
Donate to Me
More
Quote:
Originally Posted by rippledrums

Hi!

Just to be sure, does this remove the need to flash patched boot.img files when updating stock ROMs with root?

Thanks!

Not sure what you mean. This does patch the boot img to remove verity/fec though if that's what you're getting at

Quote:
Originally Posted by shadowstep

@Zackptg5 Thanks for the zip! I trust this will work for both -- Treble and non-Treble ROMs, yes?

Yup
The Following 11 Users Say Thank You to Zackptg5 For This Useful Post: [ View ]
17th July 2018, 12:42 PM |#5  
rippledrums's Avatar
Senior Member
Flag Portugal
Thanks Meter: 559
 
More
Quote:
Originally Posted by Zackptg5

Not sure what you mean. This does patch the boot img to remove verity/fec though if that's what you're getting at

I found this because I saw your post in @Xennet's thread for OP3/3T Oxygen OS patched boot.img files.

Currently every time I update OOS I flash a boot.img patched by him and also a zip by him as well. What I'm asking is if your zip would be enough?

Sent from my OnePlus 3T using XDA Labs
17th July 2018, 12:45 PM |#6  
Zackptg5's Avatar
OP Recognized Developer
Thanks Meter: 6,470
 
Donate to Me
More
Quote:
Originally Posted by rippledrums

I found this because I saw your post in @Xennet's thread for OP3/3T Oxygen OS patched boot.img files.

Currently every time I update OOS I flash a boot.img patched by him and also a zip by him as well. What I'm asking is if your zip would be enough?

Oh, gotcha. Ya, this zip handles that so you don't need to flash the boot img anymore
The Following 4 Users Say Thank You to Zackptg5 For This Useful Post: [ View ]
17th July 2018, 12:48 PM |#7  
rippledrums's Avatar
Senior Member
Flag Portugal
Thanks Meter: 559
 
More
Quote:
Originally Posted by Zackptg5

Oh, gotcha. Ya, this zip handles that so you don't need to flash the boot img anymore

Awesome, thanks!

Sent from my OnePlus 3T using XDA Labs
21st July 2018, 10:59 AM |#8  
Senior Member
Flag Colchester
Thanks Meter: 1,676
 
Donate to Me
More
@Zackptg5 First of all, great job. This looks very impressive and I appreciate the work you've done. I know this will be very useful for people trying things like the P GSI image then going back to no treble ROMs back on Oreo. I was just wondering though, as I have no intention on trying any treble ROMs, is there any benefit to using this over the old no verity V2 zip for someone that will only use non-treble Oreo ROMs. Thank you
The Following 4 Users Say Thank You to DEVILOPS 007 For This Useful Post: [ View ] Gift DEVILOPS 007 Ad-Free
21st July 2018, 01:55 PM |#9  
Zackptg5's Avatar
OP Recognized Developer
Thanks Meter: 6,470
 
Donate to Me
More
Quote:
Originally Posted by DEVILOPS 007

@Zackptg5 First of all, great job. This looks very impressive and I appreciate the work you've done. I know this will be very useful for people trying things like the P GSI image then going back to no treble ROMs back on Oreo. I was just wondering though, as I have no intention on trying any treble ROMs, is there any benefit to using this over the old no verity V2 zip for someone that will only use non-treble Oreo ROMs. Thank you

It really depends on the rom. If you're on a custom rom the old zip is probably fine (but not always, lots of variation there). If you're on a stock or stock based rom however, this is needed (unless you flash a patched boot.img - but why flash 2 things when you can flash 1?). This zip works with treble and nontreble roms by the way and the old zip can be easily modified the same way (I have one floating around xda somewhere).
Assuming you're on a custom rom which already has dm-verity disabled, the benefit to this zip is that not only does it disable force encryption in the vendor fstabs (like the old zip), but it also disables it in the boot img which some roms have
The Following 6 Users Say Thank You to Zackptg5 For This Useful Post: [ View ]
21st July 2018, 02:10 PM |#10  
Senior Member
Flag Colchester
Thanks Meter: 1,676
 
Donate to Me
More
Quote:
Originally Posted by Zackptg5

It really depends on the rom. If you're on a custom rom the old zip is probably fine (but not always, lots of variation there). If you're on a stock or stock based rom however, this is needed (unless you flash a patched boot.img - but why flash 2 things when you can flash 1?). This zip works with treble and nontreble roms by the way and the old zip can be easily modified the same way (I have one floating around xda somewhere).
Assuming you're on a custom rom which already has dm-verity disabled, the benefit to this zip is that not only does it disable force encryption in the vendor fstabs (like the old zip), but it also disables it in the boot img which some roms have

So basically it is a more well-done version if you want to put it that way. Works on stock and custom ROMs including treble no matter what it is or if there is dm-verity enabled or not is what I'm understanding from this. I'm using treskmod currently which is basically OmniRom. I'll give it a go when I get back off holiday so I can clean flash. Thanks again👍
The Following User Says Thank You to DEVILOPS 007 For This Useful Post: [ View ] Gift DEVILOPS 007 Ad-Free
21st July 2018, 02:34 PM |#11  
Zackptg5's Avatar
OP Recognized Developer
Thanks Meter: 6,470
 
Donate to Me
More
Quote:
Originally Posted by DEVILOPS 007

So basically it is a more well-done version if you want to put it that way. Works on stock and custom ROMs including treble no matter what it is or if there is dm-verity enabled or not is what I'm understanding from this. I'm using treskmod currently which is basically OmniRom. I'll give it a go when I get back off holiday so I can clean flash. Thanks again👍

I wouldn't call it more well done but rather more complete

And yup, should work on any rom/device magiskboot is able to work with (which is most of them). Dm-verity will be removed too by this mod by the way
The Following User Says Thank You to Zackptg5 For This Useful Post: [ View ]
Post Reply Subscribe to Thread

Tags
dm-verity disabler, force encryption disabler

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread