News Tips

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.

Avatar

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