How to Fix Empty IMEI, Corrupted EFS, No SIM, Unknown Baseband and WiFi/Bluetooth issues after restoring a TWRP Backup

While flashing things with TWRP is fun and games, it can sometimes also lead to serious issues on your device. If proper care is not taken or if the installed TWRP recovery on your device has bugs/issues, then restoring a backup from it may corrupt your device, resulting in lost information and features.

Below is a list of issues that could occur when a TWRP restore goes wrong:

  • No IMEI number
  • Corrupted EFS
  • No SIM, card not detected
  • Unknown Baseband
  • Issues with WiFi and Bluetooth

The major cause behind all these issues after restoring a TWRP backup is the EFS partition. The EFS partition sometimes fails to restore correctly and hence corrupts all other partitions as well.

Developer jcadduono has explained the issue in detail, so we’ll just go ahead quote him below:

The EFS restoration issue was due to a missing file name set bug during the backup restoration process.

This caused all subpartitions associated with a backup-enabled partition to have the first item (ex. the main/non-subpartition) restored to all subpartitions as well.

See for example the partition entries in Angler’s recovery.fstab:

Code:
/efs1            emmc              /dev/block/platform/soc.0/f9824900.sdhci/by-name/modemst1  flags=backup=1;display=EFS
/efs2            emmc              /dev/block/platform/soc.0/f9824900.sdhci/by-name/modemst2  flags=backup=1;subpartitionof=/efs1

While creating the backup of EFS, you will end up with:
efs1.emmc.win (modemst1 partition raw data)
efs2.emmc.win (modemst2 partition raw data)

When restoring this EFS backup, what happened was the file name was not updated for restore, and you ended up with:
Restoring EFS…
Restoring efs1.emmc.win to modemst1
Restoring efs1.emmc.win to modemst2

It should have been:
Restoring EFS…
Restoring efs1.emmc.win to modemst1
Restoring efs2.emmc.win to modemst2

Losing your device’s IMEI and cellular functionality is pretty scary. But fret not! Fixing the issue is fairly simple. You just have to erase/reset the modemst1 partition and things will be good again.

You can fix the issue from TWRP recovery, over ADB from Android or via Bootloader mode using Fastboot commands. Below are detailed instructions for both:

How to Fix EFS from TWRP recovery

  1. Boot into TWRP recovery.
  2. From TWRP’s main screen, select Advanced » then Terminal.
  3. Type the following commands in terminal (one by one):
    dd if=/dev/zero of=/dev/block/bootdevice/by-name/modemst1
    dd if=/dev/zero of=/dev/block/bootdevice/by-name/modemst2
  4. Reboot device.

How to Fix EFS over ADB

  1. Setup ADB and Fastboot on your PC.
  2. Enable Developer options & USB debugging on your Android device.
  3. Connect your device to the PC and open a command window on the PC.
  4. Issue the following commands one by one:
    adb shell 'dd if=/dev/zero of=/dev/block/bootdevice/by-name/modemst1'
    adb shell 'dd if=/dev/zero of=/dev/block/bootdevice/by-name/modemst2'
    adb reboot

How to Fix EFS from Bootloader Mode using Fastboot commands

  1. Setup ADB and Fastboot on your PC.
  2. Enable Developer options & USB debugging on your Android device.
  3. Connect your device to the PC and open a command window on the PC.
  4. Issue the following commands one by one:
    adb reboot bootloader
    fastboot erase modemst1
    fastboot erase modemst2
    fastboot reboot

That’s all. Hope the fixes shared above helps you resolve the issues.

Posted by
Shivam Malani

Shivam is our resident designer and web developer who also enjoys writing. He loves to meditate, drive on the freeways and hunt for snipers during his Call Of Duty playtime. Email: shivam@theandroidsoul.com

54 Comments

  1. I was trying to follow these steps to regain baseband…..but when I do it succeeds in fixing base band but wipes IMEI…..hence still cannot gete network…..if I restore the backup I have it brings back IMEI but restores the non functinoal baseband……any suggestions?

  2. I was trying to follow these steps to regain baseband…..but when I do it succeeds in fixing base band but wipes IMEI…..hence still cannot gete network…..if I restore the backup I have it brings back IMEI but restores the non functinoal baseband……any suggestions?

  3. I was trying to follow these steps to regain baseband…..but when I do it succeeds in fixing base band but wipes IMEI…..hence still cannot gete network…..if I restore the backup I have it brings back IMEI but restores the non functinoal baseband……any suggestions?

  4. I was trying to follow these steps to regain baseband…..but when I do it succeeds in fixing base band but wipes IMEI…..hence still cannot gete network…..if I restore the backup I have it brings back IMEI but restores the non functinoal baseband……any suggestions?

  5. Oh my god!!! You, original poster, is a life saver!!!!! Thanks a million. My IMEI actually got corrupted somehow while I’m restoring a backup from TWRP.

  6. Oh my god!!! You, original poster, is a life saver!!!!! Thanks a million. My IMEI actually got corrupted somehow while I’m restoring a backup from TWRP.

  7. Oh my god!!! You, original poster, is a life saver!!!!! Thanks a million. My IMEI actually got corrupted somehow while I’m restoring a backup from TWRP.

  8. Oh my god!!! You, original poster, is a life saver!!!!! Thanks a million. My IMEI actually got corrupted somehow while I’m restoring a backup from TWRP.

  9. hi, for me it says :
    can’t open ‘/dev/block/bootdevice/by-name/modemst1’: No such file or directory
    (and for modemst2 the same …)

    any idea ?

  10. hi, for me it says :
    can’t open ‘/dev/block/bootdevice/by-name/modemst1’: No such file or directory
    (and for modemst2 the same …)

    any idea ?

  11. I managed to find out the partitions by using a program that backups the EFS partitions and ran the commands accordingly :
    dd if=/dev/zero of=/dev/block/mmcblk0p13
    dd if=/dev/zero of=/dev/block/mmcblk0p14

    but still haven’t succeeded into making the phone work 🙁

    My actual problem :
    I have Galaxy S5 with a CM 13 backup that works ok …
    But since then I have switched to Ressurection Remix and restoring any RR backup brings up the problem with EFS

  12. I managed to find out the partitions by using a program that backups the EFS partitions and ran the commands accordingly :
    dd if=/dev/zero of=/dev/block/mmcblk0p13
    dd if=/dev/zero of=/dev/block/mmcblk0p14

    but still haven’t succeeded into making the phone work 🙁

    My actual problem :
    I have Galaxy S5 with a CM 13 backup that works ok …
    But since then I have switched to Ressurection Remix and restoring any RR backup brings up the problem with EFS

  13. hi, for me it says :
    can’t open ‘/dev/block/bootdevice/by-name/modemst1’: No such file or directory
    (and for modemst2 the same …)

    any idea ?

  14. hi, for me it says :
    can’t open ‘/dev/block/bootdevice/by-name/modemst1’: No such file or directory
    (and for modemst2 the same …)

    any idea ?

  15. I managed to find out the partitions by using a program that backups the EFS partitions and ran the commands accordingly :
    dd if=/dev/zero of=/dev/block/mmcblk0p13
    dd if=/dev/zero of=/dev/block/mmcblk0p14

    but still haven’t succeeded into making the phone work 🙁

    My actual problem :
    I have Galaxy S5 with a CM 13 backup that works ok …
    But since then I have switched to Ressurection Remix and restoring any RR backup brings up the problem with EFS

  16. I managed to find out the partitions by using a program that backups the EFS partitions and ran the commands accordingly :
    dd if=/dev/zero of=/dev/block/mmcblk0p13
    dd if=/dev/zero of=/dev/block/mmcblk0p14

    but still haven’t succeeded into making the phone work 🙁

    My actual problem :
    I have Galaxy S5 with a CM 13 backup that works ok …
    But since then I have switched to Ressurection Remix and restoring any RR backup brings up the problem with EFS

  17. Thank u very much, well done guys it help me a lot, thanks buddy

  18. Thank u very much, well done guys it help me a lot, thanks buddy

  19. rajkumar lamichhane

    Thank u very much, well done guys it help me a lot, thanks buddy

  20. Thanx but i am facing a little challenge when i tried to fix EFS via TWRP RECOVERY..
    After running the first command “dd if=/dev/zero of=/dev/block/bootdevice/by-name/modemst1”
    my samsung s6 is saying
    dd: writing ‘/dev/zero of=/dev/block/bootdevice/by-name/modemst1’ : No space left on device

    1. did you find any solution for this?

    2. No solution yet

    3. I have also tried to fix the “not registered on network” issue using EFS backup mobile app but when i tried to do the efs backup its saying “sorry we can not detect any EFS/IMEI partition on your device”

  21. Thanx but i am facing a little challenge when i tried to fix EFS via TWRP RECOVERY..
    After running the first command “dd if=/dev/zero of=/dev/block/bootdevice/by-name/modemst1”
    my samsung s6 is saying
    dd: writing ‘/dev/zero of=/dev/block/bootdevice/by-name/modemst1’ : No space left on device

  22. Wellington Hamandawana

    Thanx but i am facing a little challenge when i tried to fix EFS via TWRP RECOVERY..
    After running the first command “dd if=/dev/zero of=/dev/block/bootdevice/by-name/modemst1”
    my samsung s6 is saying
    dd: writing ‘/dev/zero of=/dev/block/bootdevice/by-name/modemst1’ : No space left on device

    1. did you find any solution for this?

      1. Wellington Hamandawana

        No solution yet

      2. Wellington Hamandawana

        I have also tried to fix the “not registered on network” issue using EFS backup mobile app but when i tried to do the efs backup its saying “sorry we can not detect any EFS/IMEI partition on your device”

  23. pleaaaaaaaaseeeeee someone help meeeeeeeeeeee……….if i do the twrp thing it says no space left on device, i did the adb thing and rebooted and still nothing then i did the fastboot thing and it says permission DENIED!?!?!?!????!?

    1. did you unlock your phone’s bootloader?

  24. pleaaaaaaaaseeeeee someone help meeeeeeeeeeee……….if i do the twrp thing it says no space left on device, i did the adb thing and rebooted and still nothing then i did the fastboot thing and it says permission DENIED!?!?!?!????!?

  25. pleaaaaaaaaseeeeee someone help meeeeeeeeeeee……….if i do the twrp thing it says no space left on device, i did the adb thing and rebooted and still nothing then i did the fastboot thing and it says permission DENIED!?!?!?!????!?

    1. Cường Bùi Mạnh

      did you unlock your phone’s bootloader?

  26. please help me , i lost modem bands from Europe , now showing only USA Bands LTE 2.4 .7 But i need 1 3 7 20 Doogee Y6

  27. please help me , i lost modem bands from Europe , now showing only USA Bands LTE 2.4 .7 But i need 1 3 7 20 Doogee Y6

  28. not working

  29. I experienced this trouble on my xperia x compact, now it does not read dim card, and randomly reboots. Tried to erase everything (userdata, boot, cache, recovery, system) with fastboot and reinstall TWRP plus omnirom, but does not work.

  30. I experienced this trouble on my xperia x compact, now it does not read dim card, and randomly reboots. Tried to erase everything (userdata, boot, cache, recovery, system) with fastboot and reinstall TWRP plus omnirom, but does not work.

  31. Fix EFS from TWRP recovery! works! the IMEI number is back, thanks for advice, but some network-pin is needed after reboot

  32. LG V20 H990DS – After installing TRWP lost baseband. Reflashed, tried different ROMS and factory updates. On going for last 6 months.
    After doing the TRWP method above, baseband returned.
    NB: after running command, I also got No space left on device, this is not a problem because all the command does is write ZERO’s to modemst1 & modemst2
    Software version changed from H990ds10b_00_OPEN_TW_DS to H990ds10b-GLOBAL-COM.
    Under phone status – IMEI is ‘0’ – not a problem as I can enter the IMEI from the sticker on back of the cover.
    Now having fully working LG V20, rooted and with XPOSED installed.

    Phone is based in New Zealand, was running default OPEN_TW_DS firmware before I rooted.

    Thank You. Thank You. Thank You

  33. its worked for me Thanks, Samsung Galaxy A3 A320F 2017 lineage 16 OS i did it with TWRP Recovery

  34. Redmi note 4x Snap 3/32GB not working

    Is there any other way to correct it ? Thanks

  35. Lotto IvMa (LottoIvMa)

    I have a Huawei y6 scl-l21 with imei erase, any suggestions?

  36. Fix EFS from TWRP recovery! works! the IMEI number is back, thanks for advice, but some network-pin is needed after reboot

  37. I experienced this trouble on my xperia x compact, now it does not read dim card, and randomly reboots. Tried to erase everything (userdata, boot, cache, recovery, system) with fastboot and reinstall TWRP plus omnirom, but does not work.

  38. not working

  39. please help me , i lost modem bands from Europe , now showing only USA Bands LTE 2.4 .7 But i need 1 3 7 20 Doogee Y6

  40. Lets see if it works…

  41. NO such file found…err.

    1. did you ever fix your problem?

  42. I’m unable to dial out after making the below changes on How to Fix EFS from TWRP recovery

    dd if=/dev/zero of=/dev/block/bootdevice/by-name/modemst1
    dd if=/dev/zero of=/dev/block/bootdevice/by-name/modemst2

    Is there a way to reverse this?

  43. I was trying to get back imei on moto g5s plus but couldn’t after spending full day i finally gave up. On next day i went to repair this device and fortunately mechanic wasn’t there as he was ill so i next day i went there to hear this and took my device back. Now i was about to go for another technician but all of sudden i changed my plan and went home. Now i was supposed to get to the mechanic tomorrow. I told to myself why not to have another try by searching stuff. So, i tried many tutorials but couldn’t find any thing. At last i was trying a fix but was pending restart and i tried this fix too and fortunately device is back to working conditions. Thank you so much. I am not sure was it these fixes or was the pending restart but it worked. Thank you

Comments are closed.