FORUMS
Remove All Ads from XDA

FIx DRK/dm-verity, Factory CSC and Serial Number

192 posts
Thanks Meter: 105
 
By magix01, Senior Member on 21st July 2016, 10:57 AM
Post Reply Email Thread
Hello,

I have posted on various threads that i can fix DRK (Device root key), but after large demand in PM for the fix i have decided to make a tutorial, since i don't have much time to help everyone, this tutorial is only tested on SM-N910C, could work on other variants of Exynos, perhaps snapdragon but NOT TESTED!!!!

So how is DRK broken? Usually when you flash roms and stuff you should have EFS backup as its most important thing while rooting samsung phones, but some people just dont do that, other people use boxes like z3x for unlocking and they wipe EFS, while unlocking phones the process sometimes changes IMEI number and leaves device root key wiped. These modifications sometimes make it hard to revert back to stock and i personally had problems with device suddenly rebooting etc... with this tutorial we will try to mitigate these problems.

PLEASE DO NOT PROCEED WITHOUT SHELL/ADB KNOWLEDGE IF YOU MESS SOMETHING UP YOU WILL LOOSE IMEI AND WILL HAVE A BRICK! You have been warned and i am not to be held liable!

First we need to make backup of your EFS, we will use TAR and shell which is most reliable way (Partition Backup is good too), with adb shell:
1. su
2. cd /efs
3. tar czf efsbackup.tgz *
4. mv efsbackup.tgz /data/media/0/

Now go to your internal memory in My Computer and there should be file called efsbackup.tgz copy it somewhere safe on your PC. This is your efs backup!
Now we need to take two files which we will reuse latter, you can extract them from efsbackup.tgz but this is easyer:

1. su
2. cd /efs
3. cp nv_data.bin /data/media/0/
4. cp nv_data.bin.md5 /data/media/0/

Now go to your internal memory and copy nv_data.bin and nv_data.bin.m5 to your desktop, we will need these files later. These files contain your imei!

Now we need to reboot to TWRP and format EFS partition via terminal (We are doing this to force radio to recreate the files we lost while flashing and make system more stable, no reboots etc..)
TWRP --> Advanced --> Terminal type these (These will also fix "Failed to mount /efs (Invalid Argument)) Don't missspell, if you get error no mount in fstab, that is ok!

1. mke2fs /dev/block/mmcblk0p3
2. mount -w -t ext4 /dev/block/mmcblk0p3
3. reboot

Now the system will be booting, once done when you dial *#06# you will see generic IMEI and it's not yours, don't freakout this is how its supposed to be. Radio also recovered your default values in FactoryApp folder which is nice. Now reboot phone twice!

Let's restore nv_data and restore imei, assuming you still have those files in your internal memory do this with ADB:

1. su
2. cd /efs
2. rm -rf /efs/nv_data.bin
3. rm -rf /efs/nv_data.bin.md5
4. mv /data/media/0/nv_data.bin* /efs/
5. chmod 700 /efs/nv_data.bin*
6. chown radio:radio nv_data.bin*
7. reboot

After phone reboots your factory IMEI is back and registering to network properly, now we have achieved stable device no random reboots and clean remade factory EFS!!!

DRK REPAIR PART!


Now lets go to the part of fixing DRK Device Root Key and dm-verity error! I have attached file called prov_data.zip, extract the prov_data folder to your internal memory (This is not a flashabe zip) And run these commands with your ADB Shell:

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

Device root key is now present in your device but not yet active/validated, in order to validate this, you need to flash your factory firmware with ODIN, go to factory recovery and wipe data/factory reset, and dm-verity error is now gone!


SERIAL NUMBER FIX PART


I have attached file called serial_no.zip (Not a flashable zip file), extract the file from it called serial_no open it with notepad or whatever text editor you use and replace XXXXXXXXXXX with your own serial number that is written behind your phone. Now copy serial_no file to your internal memory again and with adb we do this:

1. su
2. cd /efs
3. mv /data/media/0/serial_no /efs/FactoryApp/
4. chmod 700 /efs/FactoryApp/serial_no

Reboot and done, you have your serial number back *#06#!

FACTORY CSC FIX PART

Download the file called csc_repair.zip, inside you will see the file called mps_code.dat, open it with notepad or whatever text editor you use, type in your factory CSC instead of XXX in my file and save. If you cant find your factory CSC, go to Kies or SmartSwitch, initialize firmware, type in your serial number and device model it will show your factory CSC for reinstall, this is your CSC. Now copy mps_code.dat file to your internal memory and again we run ADB Shell:

1. su
2. cd /efs
3. mv /data/media/0/mps_code.dat /efs/imei/
4. chown root:root /efs/imei/mps_code.dat
5. chmod 755 /efs/imei/mps_code.dat

This is it, if you can follow these steps you can get clean factory remade EFS partition, with your own IMEI, Serial Number, CSC Code, DRK/dm-verity fixed. Flashing factory ODIN firmware after this will make your phone work as it should!
Attached Files
File Type: zip prov_data.zip - [Click for QR Code] (14.0 KB, 13128 views)
File Type: zip serial_no.zip - [Click for QR Code] (156 Bytes, 11076 views)
File Type: zip csc_repair.zip - [Click for QR Code] (163 Bytes, 12732 views)
The Following 23 Users Say Thank You to magix01 For This Useful Post: [ View ] Gift magix01 Ad-Free
 
 
23rd July 2016, 11:43 PM |#2  
SeerePetrova's Avatar
Senior Member
Flag Ixtapa
Thanks Meter: 24
 
More
i have this issue on the n910t... I have full access and a working phone but it lags a lot... youtube videos stutter and when typing some words they keyboard, well all keyboards stutter too... this began to happen when my phone started showing me this message, you see the phone was unlocked by certfile with octoplus or z3x... then it lost signal but when i tried to wipe efs, the phone recovered its own imei and serial... So i unlocked it normally with z3x but had to downgrade the modem from EPE3 to DOK2 to unlock it.... then i restored the complete firmware to the latest version of android 6.0.1 and it showed me the DRK problem..
I'm going to try this tutorial and see it this stops all the stuttering every 8 seconds,..
24th July 2016, 11:56 AM |#3  
OP Senior Member
Thanks Meter: 105
 
More
Quote:
Originally Posted by SeerePetrova

i have this issue on the n910t... I have full access and a working phone but it lags a lot... youtube videos stutter and when typing some words they keyboard, well all keyboards stutter too... this began to happen when my phone started showing me this message, you see the phone was unlocked by certfile with octoplus or z3x... then it lost signal but when i tried to wipe efs, the phone recovered its own imei and serial... So i unlocked it normally with z3x but had to downgrade the modem from EPE3 to DOK2 to unlock it.... then i restored the complete firmware to the latest version of android 6.0.1 and it showed me the DRK problem..
I'm going to try this tutorial and see it this stops all the stuttering every 8 seconds,..

I am not sure if it will work on N910T variant, but you can try it. DRK error happened on your note because z3x wipes EFS and then writes new nv_data.bin, but by wiping it destroys your prov_data/dev_root folder which contains DRK. If you think your EFS partition created your problem, you can start from the start and format EFS to make it factory and then proceed.
24th July 2016, 01:04 PM |#4  
Junior Member
Thanks Meter: 0
 
More
Hey there!
I recently bought a used Note 4 910C. I was told by the shopkeeper that it has never been tempered with. But OTA update fails bcuz of DRK error. I guess someone did try something with it previously. I manged to update Marshmallow via ODIN.

yesterday I rooted it and followed your DRK REPAIR Part. flashed via ODIN for validation but the error still exists. I did not do the whole method from the beginning ( I backed up EFS and nv_bin). Plz tell me what did I do wrong.

Another thing that may be of some importance. The serial no was different form phone's back in just one letter in the middle. Instead of '5' it was showing 'S'. I wonder it can not be by mistake. there must be some messing up previously.
Anyway I followed ur method of SERIAL NO repair and managed to repair the serial no. The IMEI was already a match.

Plz help me what should I do for DRK repair.

Regards.
27th July 2016, 10:11 AM |#5  
OP Senior Member
Thanks Meter: 105
 
More
Usually when you restore prov_data folder properly, you need to go to twrp, format system, data and cache. Then with odin flash stock firmware with your own csc code (do csc repair if its not a match). After that phone should boot to stock recovery, then do format data/factory reset from stock recovery. It should say something like "verifiyng dm-verity" when you go to reboot. After system boots when you go to recovery again it wont show drk error anymore. Tested 100% on 910c variant.
31st July 2016, 05:27 AM |#6  
Member
Thanks Meter: 2
 
More
Quote:
Originally Posted by magix01

Usually when you restore prov_data folder properly, you need to go to twrp, format system, data and cache. Then with odin flash stock firmware with your own csc code (do csc repair if its not a match). After that phone should boot to stock recovery, then do format data/factory reset from stock recovery. It should say something like "verifiyng dm-verity" when you go to reboot. After system boots when you go to recovery again it wont show drk error anymore. Tested 100% on 910c variant.

So I'm doing the drk fix on my smg925p device and when doing the drk commands the prov_data folder doesn't move to the efs folder it stays in my internal memory and i did the restore and reset and i still get the drk error clearly a command or something is wrong
31st July 2016, 08:28 AM |#7  
OP Senior Member
Thanks Meter: 105
 
More
Use root explorer to move the folder then :P
4th August 2016, 08:14 PM |#8  
doctor-cool's Avatar
Senior Member
Thanks Meter: 157
 
More
Quote:
Originally Posted by magix01


This is it, if you can follow these steps you can get clean factory remade EFS partition, with your own IMEI, Serial Number, CSC Code, DRK/dm-verity fixed. Flashing factory ODIN firmware after this will make your phone work as it should!

1. su
2. cd /efs
3. tar czf efsbackup.tgz *
4. mv efsbackup.tgz /data/media/0/

Testing........I was able to make a backup of efsbackup.tgz on a phone without any dm-verity damage. So the command works.

But on the phone that needs efs repair, when I run the command tar czf efsbackup.tgz * with Terminal Emulator
I get the error message tar: efsbackup.tgz: file is the archive; skipping

Any thoughts anyone?
4th August 2016, 08:30 PM |#9  
OP Senior Member
Thanks Meter: 105
 
More
Try with busybox installed and system root not systemless.
The Following 2 Users Say Thank You to magix01 For This Useful Post: [ View ] Gift magix01 Ad-Free
4th August 2016, 10:48 PM |#10  
doctor-cool's Avatar
Senior Member
Thanks Meter: 157
 
More
Quote:
Originally Posted by magix01

Try with busybox installed and system root not systemless.

Thanks, that worked. The phone I'm working on is a SM-N910V and it does not have the files nv_data.bin or nv_data.bin.md5 inside the efs folder, any suggestions?
Can I send you my efs folder for repair?
I have two SM-N910V one is Okay. could I pull some files from the good one to help fix the damaged one?
5th August 2016, 09:48 PM |#11  
ElRongMcBong's Avatar
Senior Member
Flag Neuss
Thanks Meter: 81
 
More
+1 N910F have dont the nv_data's...my efs it's okay, i only wanna look
Post Reply Subscribe to Thread

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

Advanced Search
Display Modes