[Samsung Galaxy S7 Edge Questions and Answers] shah22:
I don't know why even at this point of time when there are forums like xda and every basic thing pinned on internet why do people try to intentionally do new/f*** things :)

In other words, try to fix something which isn't broken..

No, you don't "accidentally" turn oem unlock off.. you need to scroll the screen halfway and then 'tap' right buttons on right screen to enter developer options and then scroll to oem unlock option and tap on it "intentionally" to see what happens :)

Not trying to be rude or to pick on you.. but it is hillarious how much people in s7 edge forums are 'accidentally' turing oem unlock off.. my inbox is full of such messages ..

I think xda has some issue displaying words correctly.. otherwise this simple basic sentence is posted everywhere on the xda forums :

"YOU NEED TO ENABLE OEM UNLOCK BEFORE DOING ANY UMOFFICIAL MODIFICATION TO YOUR PHONE"

Do you know oem unlock means to unlock bootloader to flash anything other then official OEM ? Failing which will cause phone to reject unofficial modifications and become a brick..

Also let me tell you this luxury of unlocking bootloader is so easily available on samsung phones ..

Do you know how difficult it is now to unlock bootloader of huawei devices ? They stopped providing unlock codes and its a premium charged service now to unlock huawei bootloaders..

And still.. when samsung has made it so easy .. one tap bootloader unlocking and still people mess it to see "what happens".. is ironic really :)

Ok , the point of all this was not to flame on you or anyone.. but to LET OTHERS KNOW THAT THIS IS NOT A GREAT IDEA TO TURN OEM UNLOCK OFF AFTER YOU MODIFIED YOUR PHONE IN ANY WAY..

Now, to get on your problem.. this cannot be solved by any combination rom ..

The reason your phone cannot boot is because your device's drk (device root key) is corrupted/modified/missing.. which causes dm (device mapping) verity error, it occurs in two types :

1. 1st type is when you enable system modifications in twrp plus dm verity is enabled in the kernel and you "accidentally" turn oem unlock off..

dm verity kicks in this scenario and prevents phone from booting..

BUT your EFS/NV data partition containing DRK is NOT corrupted/modified/missing in this type of error.

This happens when you root your phone with NON-SYSTEMLESS method and oem unlock being turned off..

In this case, just a stock samsung firmware reflash would solve this. Like it happened with @ freakwithracket , he only had frp problem due to oem unlock turned off, and he was able to solve it.

Now the 2nd type which you and many others suffered here too.. this one is akin to a hard brick and trust me when i say hard brick it means it is very very difficult (if not impossible) for average users (including me too) which are noobs to mess in android/linux guts..

I say it is nearly impossible for average users to fix it when even master ChainFire have had difficulty in such..

Refer to his vital post here : https://xdaforums.com/showpost.php?p=72204306&postcount=978

And i am just a noob, i just did some research to get knowledge.. thats what everyone should do before posting..

2. This type 2 dm verity mostly kicks in for unfortunate users when:

They enabled system modifications in twrp, and rooted phone using NON-SYSTEMLESS method.

They decided to jump in the death valley (literally lol) by turning OEM UNLOCK OFF.. why though ? :emo_y.tho:

3rd and main reason : FOR SOME REASON THEIR DEVICE'S NV DATA/EFS PARTITION (WHICH CONTAIN DRK) IS CORRUPTED/ENCRYPTED/MODIFIED IN SUCH WAY THAT WHILE ROOTED AND OEM UNLOCK ENABLED IT CAUSES NO PROBLEM IN BOOTING CUSTOM ROMS (BECAUSE OEM UNLOCK IS ON AND CUSTOM ROMS HAVE DM VERITY DISABLED IN KERNELS) BUT YOU CAN ONLY BOOT CUSTOM ROMS WHICH HAVE DM VERITY CHECK DISABLED.. YOU CANNOT BOOT STOCK UNMODIFIED ROM.. (FOR BOOTING STOCK ROM YOU NEED TO INSTALL TWRP AND FLASH NO VERITY ZIPS IN IT)

BUT WHEN OEM UNLOCK IS TURNED OFF, IT CAUSES DM VERITY ERROR PROBABLY DUE TO CORRUPTED/ENCRYPTED/MODIFIED EFS/NV DATA (CONTAINING DRK) WHEN BOOTING STOCK UNMODIFIED ROM AND YOU CANNOT BOOT WITH ANY MODIFIED BINARIES LIKE TWRP OR CUSTOM ROMS OR NO VERITY ZIPS DUE TO OEM UNLOCK BEING OFF WHICH CAUSES CUSTOM BINARY BLOCKED BY FRP AND STOCK BINARY BLOCKED DUE TO DRK PROBLEM (SO YOU GET KIND OF HARD BRICK)

BUT WHICH CANNOT BE SOLVED BY REFLASHING STOCK.. OR ANY COMBINATION ROM..

Now how it can be solved ..

1. Surely can be solved by opening android's/linux guts along with opening your phone's guts and maybe using some hardware tools/boxes too (which frankly only developers can do)..

2. Surely a hardware box can solve this.. (for repairers)

3. Not 100% sure (may work) , editing your stock firmware to "REMOVE" recovery partition and flashing it .. SO THERE IS NO RECOVERY PRESENT BUT PHONE CAN BOOT AND YOU CAN GO IN SETTINGS TO ENABLE OEM UNLOCK..

AND YES, RECOVERY CHECKS DM VERITY AND BLOCKS BOOTING.. (BUT AS MASTER CHAINFIRE SAID THIS MAY NOT WORK BUT PLEASE TRY ! )

I will refer you two posts.. 1st post for following 2nd (box) method above, 2nd post for the 3rd method above..

1. Using box (this may work) https://xdaforums.com/s7-edge/how-to/fix-imei-downgrading-g935f-fd-t3947911

This guy here was able to fix something like this too using a box : https://xdaforums.com/s7-edge/help/s7-edge-t4073957/post82232707

2. Using no-recovery method

https://xdaforums.com/s7-edge/help/samsung-s7-edge-g935f-custom-binary-dm-t4073925/post82134961 - just apply the method on official downloaded stock firmware you had in your phone before it got this problem OR another firmware with a MATCHING bootloader number..

Good luck !

Edit : Was your imei okay and network working?

Pro/experimental tip .. always backup your efs partition (first thing you do after installing twrp), if you have efs backup before all this (which you expect to NOT be corrupted).

Only do this *IF YOU GOT A BACKUP OF EFS (FIRST TIME AFTER INSTALLING TWRP)*..

1. Extract that backup and copy prov_data folder (not a flashable zip) to phone internal memory..

2. Open root explorer , navigate to efs partition (delete all files there EXCEPT FACTORY APP.. DELETE THE PROV_DATA FOLDER THERE TOO) or go in twrp recovery and do this.

3. The moment you delete these files you will not reboot again in phone..

use these commands in adb shell while in twrp

1. su

2. cd /efs

3. mv /data/media/0/prov_data /efs/

4. chmod -R 755 /efs/prov_data

5. chown -R root:root /efs/prov_data

(Note: S7 Edge on android 8's path may differ, just replace with correct one)

Don't reboot phone..

After this, device's original drk is restored, but need to be activated, go in download mode from twrp.. flash correct combination rom, go into combination recovery from download mode (without booting into combination rom) do factory data wipe and clear cache and reboot now into combination rom.. your original drk should be okay now.

Warning

*DON'T DO THIS IF YOU DON'T HAVE UNTOUCHED/UN-CORRUPTED (NOT CORRUPTED) EFS BACKUP !*

*YOU NEED TO MAKE YOUR PHONE BOOTING AGAIN TO DO THIS ! AND BEFORE DOING ALL THIS YOU NEED TO REFLASH YOUR CORRECT STOCK FIRMWARE IN ODIN THEN GO IN RECOVERY AND FACTORY DATA WIPE AND CLEAR CACHE, THEN ROOT YOUR PHONE TO GET SU PERMISSIONS THEN BOOT INTO PHONE TO DO ABOVE*

*DON'T DO THIS IF YOU ARE NOT SURE ABOUT ADB COMMANDS*

Successfully doing this can restore drk so if you "accidentally" turn off oem unlock again you won't have a hard brick again.. :) (Nah, just kidding lol..)

IF YOU DON'T HAVE ORIGINAL EFS BACKUP.. NEVER DO THIS EXPERIMENTAL PROCESS..

Original post reference : https://xdaforums.com/showpost.php?p=67840769&postcount=1

All credits to their respective contributors.

Edit 2 : how to check if your drk is corrupted/modified/missing??

(Always try this after backing up all stuff and making SURE THAT OEM UNLOCK IS ON!!)

Simply flash stock unmodified rom (BUT ALWAYS KEEP OEM UNLOCK ON AT ANY COST), then go in recovery from download mode directly without booting phone, do a factory data wipe and clear cache then reboot phone.. if you can boot into stock unmodified rom without any verification errors.. then your drk is intact (immediately make a backup of your phone's efs partition using any method/tool but systemless root is preferred)

If it gives verification errors, then your drk has problem as described above .. you cannot boot unmodified stock rom and oem unlock being enabled is essential for your phone to be alive.. Flash twrp and then no verity zip to eliminate the dm verity error in stock unmodified rom..

OR flash any custom rom to your liking (most have dm verity disabled in them)

Sorry for the huge word wall, but i thought it is essential information to share ;)