[FIX] Device-Mapper-Verity fix for Oxygen OS Nougat Rom ( 4.0.1 and Open Beta's)

Zingapuro

Member
Oct 1, 2012
14
0
0
Hi cpt.macp,

Thanks so much for your extensive reply and help. First of all -- I think I might have cleared a confusion about what you mean with "data" , "data/media", etc.
You mean the partition (e.g. the partitions I can select in TWRP, as opposed to "System" / "Recovery" / etc...)
You don't mean the "\ONE A3003\Internal Storage\data" folder I see when I plug in my OP3 in Windows. Which only has a tiny file ".push_deviceid".

So -- back to my issue at hand:
3. must be doing some mistakes while taking backups , make sure you are using adb properly and you can assess your sdcard properly (i.e MTP is enabled .) also dont change filesystem before backup it will destroy your data . . You have to do it later on after adb pull command is completed.
For sure MTP is enabled because I can see the OP3 in Windows. Questions:
1 - Necessary to perform Backup of all partitions with TWRP before executing adb pull command? (Does adb pull just copy TWRP backup?!*)
2 - Actually, can you just clarify what exactly the end result of the adb pull is? What should I see on my computer, what format will the backup be in?
3 - Is there a way to reproduce that "manually"?

*As I mentioned, copying the TWRP backup, what I've done already, seems to me completely useless because it's in ext4 fs.

So I'm thinking of just manually copying all files and folders I see in "\ONE A3003\Internal Storage" to my computer, then copying them back onto OP3 instead of "pushing them" with adb. Is this an acceptable solution (even if slow)?

Another question -- what do we mean with "encrypted / decrypted" -- something to do with the fs -- what do we want -- ...?
 

cpt.macp

Senior Member
Aug 2, 2013
552
311
63
Under Your Bed
Hi cpt.macp,

Thanks so much for your extensive reply and help. First of all -- I think I might have cleared a confusion about what you mean with "data" , "data/media", etc.
You mean the partition (e.g. the partitions I can select in TWRP, as opposed to "System" / "Recovery" / etc...)
You don't mean the "\ONE A3003\Internal Storage\data" folder I see when I plug in my OP3 in Windows. Which only has a tiny file ".push_deviceid".

So -- back to my issue at hand:


For sure MTP is enabled because I can see the OP3 in Windows. Questions:
1 - Necessary to perform Backup of all partitions with TWRP before executing adb pull command? (Does adb pull just copy TWRP backup?!*)
2 - Actually, can you just clarify what exactly the end result of the adb pull is? What should I see on my computer, what format will the backup be in?
3 - Is there a way to reproduce that "manually"?

*As I mentioned, copying the TWRP backup, what I've done already, seems to me completely useless because it's in ext4 fs.

So I'm thinking of just manually copying all files and folders I see in "\ONE A3003\Internal Storage" to my computer, then copying them back onto OP3 instead of "pushing them" with adb. Is this an acceptable solution (even if slow)?

Another question -- what do we mean with "encrypted / decrypted" -- something to do with the fs -- what do we want -- ...?

Hello once more @Zingapuro .I'm more than happy to help and there is no hassle for me while helping here


1.adb pull gets the thing we ask for after the parameter ( in our case our /data/media ) so it will copy your sd card data to your given location in PC.

2. There is no need to make any Nandroid backups ( futile as we have discussed).

3. yes the end result of adb pull is that we get our data quickly and we don't have to wait much . As MTP is slow and gets data from the emulated FAT drive rather than real ext4. And yes if you copy what you need from /data/media and use classic methor of copy paste or this. There is going to be absolutely no difference. And yes it's gonna be little bit slow . Plus minus 15 minutes

4. Encrypted means this


Since oneplus have not release any source for oxygen os kernel it's difficult to make compatible recovery henceforth it's difficult to manage encrypted data in new partition and causing issues like ,TWRP can't decrypt data
 
Last edited:
  • Like
Reactions: Zingapuro

zulu657

Senior Member
Jun 8, 2012
128
62
48
I got the dm-verity error when trying to flash an update to my phone. I had done a clean install from another ROM to RR5.8.0. That install went fine but when I rebooted to TWRP it wasn't there. Thinking about it, when I did the wipe I wiped internal storage along with the other usual wipes.

Tried to install TWRP with adb and got the error. When attached to the pc, I notice that the TWRP folder is empty so I guess I lost my backups, so I cannot backup the current ROM. No problem there as it can be re-installed.

One thing I seem to notice in many threads is f2fs formatting. I do not want to format anything into f2fs. All I want to do is get rid of the dm-verity error, re-install TWRP and go from there.

No f2fs, no encryption, just make the phone work like it did.

Any help will be much appreciated.
 

Striatum_bdr

Senior Member
May 29, 2011
4,650
2,174
253
Marseille
if you have a backup in ext4 fs , you cant override it over f2fs fs.

restore and backup can only be done with same filesystem , i.e ext4 to ext4 and f2fs to f2fs.

just get /data/media and be happy .
Yes you can, just go in TWRP settings and select 'use rm -Rf instead of formatting' and when you restore a TWRP backup you'll just have a warning about different file format but it will copy the files anyway.

That's how I restored my apps backup after switching to f2fs.

I even wonder if just modifying the name of the backup file won't do the trick, as the file name contains the file format name. If you have an ext4 backup, and you want to restore it on a f2fs partition, perhaps just replacing ext4 by f2fs in the file name would be enough, as a partition image file doesn't save filesystem itself. I think TWRP reads the backup file name to know in witch filesystem the partition must be formatted before restoring.
 
Last edited:
  • Like
Reactions: Zingapuro

Zingapuro

Member
Oct 1, 2012
14
0
0
Hi capt.mac,

Just want to say, thank you for your help and instructions. I don't know why, when I finally tried the 'adb pull' command again, it worked fine. But even better, I used Beyond Compare 4 which has MTP support to find out what exactly was on my phone, and managed to remove 10 GB of junk before performing the backup.

I then followed your guide and the first time around, screwed up at step 8 "Wipe the phone, Advanced Wipe the /data to f2fs"
I got confused, because you wrote "Wipe the phone", I wiped all the partitions. So removed OS4.0.1 I'd just flashed, and verity-dm error returned. When I realized what happened, I went through the whole process again, but made sure only to wipe the data partition on step 8. Maybe you could clarify that a bit in your guide...?

There's another thing: first time booting in TWRP blu_spark 11, (Step 7), I got an "Unmodified system partition" screen:

http://imgur.com/a/lyJC3

Keep System Read only?
TWRP can leave your system partition unmodified to make it easier for you to take official updates. TWRP will be unable to prevent the stock ROM from replacing TWRP and will not offer to root your device.
Installing zips or performing adb operations may still modify the system partition.
Keep Read Only -- Swipe to Allow Modifications

I wasn't sure what to do at that point. And to be honest -- I'm not sure what I ended up picking. (Is there a way to check?)

Anyways -- finally have a working phone again, with no dm-verity error. Thank you very much.
 
Last edited:

cpt.macp

Senior Member
Aug 2, 2013
552
311
63
Under Your Bed
Hi capt.mac,

Just want to say, thank you for your help and instructions. I don't know why, when I finally tried the 'adb pull' command again, it worked fine. But even better, I used Beyond Compare 4 which has MTP support to find out what exactly was on my phone, and managed to remove 10 GB of junk before performing the backup.

I then followed your guide and the first time around, screwed up at step 8 "Wipe the phone, Advanced Wipe the /data to f2fs"
I got confused, because you wrote "Wipe the phone", I wiped all the partitions. So removed OS4.0.1 I'd just flashed, and verity-dm error returned. When I realized what happened, I went through the whole process again, but made sure only to wipe the data partition on step 8. Maybe you could clarify that a bit in your guide...?

There's another thing: first time booting in TWRP blu_spark 11, (Step 7), I got an "Unmodified system partition" screen:

http://imgur.com/a/lyJC3

Keep System Read only?
TWRP can leave your system partition unmodified to make it easier for you to take official updates. TWRP will be unable to prevent the stock ROM from replacing TWRP and will not offer to root your device.
Installing zips or performing adb operations may still modify the system partition.
Keep Read Only -- Swipe to Allow Modifications

I wasn't sure what to do at that point. And to be honest -- I'm not sure what I ended up picking. (Is there a way to check?)

Anyways -- finally have a working phone again, with no dm-verity error. Thank you very much.

just swipe to allow modification if you don't wanna install OTA incremental . they check if / system is untouched or not .
if you dont swipe then you can install OTA by flashing Oxygen OS recoveries and install OTA's or else you need to download full OTA zip and flash it ( 1.4 gb)


and I'll rewrite the wipe data thing again .
 

groshnack

Senior Member
Oct 1, 2013
113
46
48
Paris
There is something I don't understand concerning dm-verity. I got the warning at boot since I switched from FOS (MM) to BJRR N. I don't really want to switch to OOS by now or go back to MM, I'll surely stay on RR or LOS based rom for some time. Is there a way to get rid of this warning without sideloading OOS or remove data? Just flash the zip? All is working fine apart from this warning message (I don't really care about it but why not remove it possible).
I am on latest BJRR/EX kernel (CM root, no supersu), TWRP 28, 4.0.1 firmware/modem, f2fs on data and cache, decrypted.
Thanks!
 

dbabaev21

Senior Member
Jan 3, 2017
186
123
0
There is something I don't understand concerning dm-verity. I got the warning at boot since I switched from FOS (MM) to BJRR N. I don't really want to switch to OOS by now or go back to MM, I'll surely stay on RR or LOS based rom for some time. Is there a way to get rid of this warning without sideloading OOS or remove data? Just flash the zip? All is working fine apart from this warning message (I don't really care about it but why not remove it possible).
I am on latest BJRR/EX kernel (CM root, no supersu), TWRP 28, 4.0.1 firmware/modem, f2fs on data and cache, decrypted.
Thanks!
Here: https://forum.xda-developers.com/oneplus-3/development/recovery-official-twrp-oneplus-3-t3539129
 

postwarbreakout

Senior Member
Aug 15, 2010
102
7
0
29
Quick question - the first post says you have to install the "dm-verity and forced encryption disabler" if the dm-verity issue appears again, but in another post it says cannot fix an already existing dm-verity issue. What's true now?
 

abalam

Senior Member
Oct 30, 2011
2,374
2,222
193
www.qrz.com
I have a question in the steps:

Flash and boot into stock recovery*recovery_OBT8N.img

While in stock recovery, Wipe everything ( resetting variables for dm-verity inside the system boot image ) , all the 3 options , just do all (for a clean flash).

Install*OxygenOS 4.0.2*through sideload

Question: can we flash the .zip in the stock recovery or must we switch first to twrp. Sorry but never now that we can flash .zip in stock recovery.
 

dbabaev21

Senior Member
Jan 3, 2017
186
123
0
I have a question in the steps:

Flash and boot into stock recovery*recovery_OBT8N.img

While in stock recovery, Wipe everything ( resetting variables for dm-verity inside the system boot image ) , all the 3 options , just do all (for a clean flash).

Install*OxygenOS 4.0.2*through sideload

Question: can we flash the .zip in the stock recovery or must we switch first to twrp. Sorry but never now that we can flash .zip in stock recovery.
Flash the OTA via sideload in stock recovery. Boot to the OS, configure it. Boot to bootloader and flash TWRP.
If you have issues, use this guide too: https://forum.xda-developers.com/oneplus-3/how-to/guide-flashing-oos-v4-0-1-custom-rom-t3537757
 

cpt.macp

Senior Member
Aug 2, 2013
552
311
63
Under Your Bed
Seems Like there is a big Misconception with DM verity issues here .

First Of all Lads its not any kind of Issue or Problem . Infact its a warning that tells that any changes made to the system partition will be detected on boot or access as DM verity . It's a safety feature which is there in system image (i.e our OnePlus) and triggers a flag in bootloader that the phone is not safe to use thus keeps showing every time ( for those people who dont know what root is , their data is vulnerable and not secure ) .
Verity is a security feature which was originally found in ChromeOS, designed to provide assured and trustworthy computing devices, preventing malicious software from modifying a device. Back in Android 4.4, Google announced verity for Android, and then all remained quiet . Now its showing its face and making hassels for root users .
All it Means is that If you want root , you’re going to need to use a modified boot image. While it case for some time – SELinux changes make it much harder to get root access without modifying the boot image. And as modifying the boot image requires an unlocked bootloader Obviously. So If You install any untrusted thing in your phone ( having any system with DM verity ) it will trigger the dm verity in bootloader and it will keep showing it .
 
Last edited:

cpt.macp

Senior Member
Aug 2, 2013
552
311
63
Under Your Bed
There is something I don't understand concerning dm-verity. I got the warning at boot since I switched from FOS (MM) to BJRR N. I don't really want to switch to OOS by now or go back to MM, I'll surely stay on RR or LOS based rom for some time. Is there a way to get rid of this warning without sideloading OOS or remove data? Just flash the zip? All is working fine apart from this warning message (I don't really care about it but why not remove it possible).
I am on latest BJRR/EX kernel (CM root, no supersu), TWRP 28, 4.0.1 firmware/modem, f2fs on data and cache, decrypted.
Thanks!
I would also like an answer to.


You need to flash Oxygen OS to reset variables in bootloader . ( it will think that the system image is not modified ) with trustred Oxygen Recovery and Wipe data , Dalvik and all the 3 options .
then Simply when DM verity is gone simply flash your Custom ROM and Enjoy ( prior Flashing TWRP of your Choice )

Allow Modifications (TWRP Swipe , basically triggers this dm verity ) when On Oxygen OS ( if done before First Boot )
 
Last edited:
  • Like
Reactions: groshnack

abalam

Senior Member
Oct 30, 2011
2,374
2,222
193
www.qrz.com
Seems Like there is a big Misconception with DM verity issues here .

First Of all Lads its not any kind of Issue or Problem . Infact its a warning that tells that any changes made to the system partition will be detected on boot or access. as DM verity . It's a safety feature which is there in system. image ( i.e our OnePlus ) and triggers a flag in bootloader that the phone is not safe to use thus keeps showing every time ( for those people who dont know what root is , their data is vulnerable ) .
Verity is a security feature which was originally found in ChromeOS, designed to provide assured and trustworthy computing devices, preventing malicious software from modifying a device. Back in Android 4.4, Google announced verity for Android, and then all remained quiet . Now its showing its face and making hassels for root users .
All it Means is that If you want root , you’re going to need to use a modified boot image. While it case for some time – SELinux changes make it much harder to get root access without modifying the boot image. And as modifying the boot image requires an unlocked bootloader Obviously. So If You install any untrusted thing in your phone ( having any system with DM verity ) it will trigger the dm verity in bootloader and it will keep showing it .
So in other words. If you used the phone just for hobby, example flashing ROMs and mods, it's no problem. Do you use it for real personal matters such as banking, corporate emails etc can we best carry out this operation. I just think if you root the phone you it certainly should not be used for business stuff! But just as a hobby in my case, we do so not to worry about the message, or am I wrong?