Originally Posted by payz
I had a hard time, so I figured this may help someone else fix a broken Nexus 5 with IMEI = 0
Of course, do this at your own risk, I take no responsibility. Thanks goes to vladonru for finding the solution on the russian forums, see thread android.stackexchange.com/questions/85807/nexus-5-imei-0-how-to-restore-imei
I just translated/shortened/fixed some stuff, and here is full instructions below and all files attached.
NOTE: If you can't find/don't know the phone's IMEI it's laser etched onto the sim card holder (whew).
Change or Repair IMEI
1. Install the LG driver LG
2. Install QPST
3. Copy the entire folder EFS Professional to C drive
4. Unpack the archive Nexus5 the root of drive C.
5. Using WUG Nexus toolkit:
a. Make sure running stock Android 5.0.1
c. If necessary, you can reset the IMEI using backups zero IMEI from the archive. To do this, simply make a backup of your EFS in TWRP, then replace in the folder's backup your files on the distribution of similar make and restore EFS.
i. If it is already erased and writes 0, then just skip this step.
d. Advanced tools:
i. Install bootloader 5.0.0_diag_BOOT.img from folder
ii. open a command window:
1. adb shell > su > setprop sys.usb.config diag,adb
This activates the diagnostic mode on the phone and will be available operations with nvram through com port.
6. Open EFS Professional:
a. Click on Qualcomm NV Tools, Hit connect and go to Secure Ops.
b. Hit Read and check off imei and meid, and enter imei and meid (meid is just imei without last two digits)
c. Hit Write
d. Reboot phone and check imei by typing *#06#
e. If imei still 0 > do b above again, then Read (note esn now appears), then Write again (ignore the errors) > Reboot and check, should be working.
f. Repair 3G/LTE:
i. Install the diagnostic bootloader again and run the setprop shell command again
g. Open QPST Configuration from Windows programs
h. Click Ports tab, Add new port, deselect secure ports only and should now see the serial port with phone connected (if not, then the serial drivers aren’t installed properly Use WUG driver support to remove all android drivers and plug the phone in again to install from windows update)
i. Click Start Start Clients > Software Download
j. Go to Backup tab and click Start Leave SPC with all zeros (note file location of backup)
k. Go to Restore tab, check “Allow phone / file ESN mismatch”, restore from the NEXUS5.qcn (from the folder), again leave SPC with all zeros here
l. Now click Browse next to QCN File, locate the backup from j above and now enter in SPC: 308508 > Start
m. Reboot phone > everything should be working!
7. Make complete EFS backup!!!
Can't thank you enough for this post with details and attachments. This saved me big time after I inadvertently overwrote my /efs partition from my previous Nexus 5 to a new one, after I dropped and broke my previous and attempted to restore my latest nandroid to the new phone, all resulting in an IMEI = 0.
Thing is, I know better and still did it!
After much searching and consternation I came across this post and am back to full working order!