nv_data.bin.md5

IMEI and Custom ROMs

Posted on Updated on

Recently Android KitKat (4.4) has been released and now available in Google’s flagship device NEXUS 5. On every Android update there comes the introduction of CyanogenMod custom ROM or simply CM. The latest release of CM is v11. But CM11 has been released only for few devices. For my luck I could find CM11 or Android KitKat ported on my device (SGS I9003) that too an unofficial version in XDA forum. Let me personally thank the person behind porting CM11 on SGS I9003 (http://forum.xda-developers.com/showthread.php?t=2534312) . So as usual I installed the ROM using the steps specified in the forum and I could successfully boot into the new OS.   The very first moment I entered the home screen after some registration procedures I could find few random changes compared to Jelly Bean starting right from the dock menu to settings page. Anyways the new OS is looking too cool and thought of keeping the device for testing overnight before using the new OS for regular use.

After 24hrs of use I could find that the phone doesn’t connect to network provider. So I started to figure out the cause. From my observation I found that the device is having data connectivity but no telephony services. Later I replaced the SIM with another one but still the problem persists. Suddenly something caught in my eyes that the IMEI number has been changed when the new OS has been installed. The following is the new IMEI generated in my device when the OS (CM 11) has been installed.

                                                               ” 004999010640000

Here is the issue, I will give a brief explanation which I found in XDA forum ( http://forum.xda-developers.com/showthread.php?t=859914) . This could be really useful for those who really prefer to install custom ROM rather than stock OS. (THIS IS ONLY FOR SAMSUNG DEVICES)

Samsung uses RFS as their default file system. The IMEI number is stored in /efs folder found in the root directory.  This is a very sensitive system folder that contains Phone-specific information such as the IMEI , wireless devices MAC addresses, product code, and much more.The file system used by custom ROMs are YAFFS (Yet Another Flash File System). When custom ROMs are installed the filesystem will be changed to YAFFS and hence the RFS file system cannot be accessed since it is  proprietary of Samsung. So for as result the default device sensitive information are not available. To overcome this issue please use the following steps to recover back your lost IMEI number once custom ROM has been installed.

Step 1: Creating backup of the IMEI before flashing the stock ROM

  • While in stock ROM create a backup of the efs folder using the following command either in ADB or terminal emulator
                  ADB command prompt: su tar zcvf /sdcard/efs-backup.tar.gz /efs 
                  Terminal Emulator: busybox tar zcvf /sdcard/efs-backup.tar.gz /efs
  • The above command will create a backup of “efs” folder in your internal memory. Please copy the backup file to your sdcard.

Step 2: After installing custom ROM and restoring back the IMEI

  • Now extract the contents of the backup to your sdcard and perform the following commands using Terminal Emulator App
                      cp /sdcard/nv_data.bin /efs/nv_data.bin 
                      rm -rf /efs/nv_data.bin.md5
  • The first commands will copy the backup file “nv_data.bin” to your efs folder. And the second command will delete the existing “nv_data.bin.md5” since we have replaced the another file for “nv_data.bin” and the hash signature has been changed. Reboot the device and the system will generate a new “nv_data.bin.md5” file. Make sure you have rebooted the device after executing the above commands.
  • Now after rebooting the device use the following command in Terminal Emulator app to change the ownership of the file
                       chown 1001:1001 /efs/nv_data.bin
  • Cheers!! You have successfully replaced your default IMEI number.