Fixing IMEI=0 issue on Moto G4 Plus
[NOTE: GPT PARAPHRASED THIS ARTICLE, AND I WILL SIMPLIFY IT LATER]
In October 2018, I was experimenting with custom ROMs on my Moto G4 Plus. While going back to the stock firmware, my phone started showing its IMEI as 0.
I couldn't find a working solution for my device. So I spent roughly a week reading forums, trying different things, and learning about parts of Android I had never worked with before.
I tried Qualcomm tools, backed up partitions, experimented with persist, and even opened the modemst1 and modemst2 partitions in a hex editor. My thinking was simple: if the IMEI was somewhere in that data, maybe I could find it and fix it.
Most of these attempts didn't work. But each attempt helped me understand a little more.
Eventually, I found research and a recovery method for the Moto G5 Plus. It wasn't for my phone, but with some trial and error, I got it working on the G4 Plus.
After days of trying, my IMEI was back!
Then I took a backup through TWRP and deliberately made it zero again.
Why break it again?
I knew a sequence of steps fixed the problem. But I still didn't understand which step actually mattered, or why the problem happened in the first place.
Getting something to work and understanding why it works are two different things.
Now that I had a backup and a way to recover, I wanted to figure it out.
Building on the community's research and testing on my own phone, I traced the issue to directory ownership inside /persist.
Moving between Android versions could leave the rfs and hlos_rfs directories with owners that the stock system didn't recognise correctly. Flashing stock firmware also erased the modem's EFS data. On the next boot, the phone couldn't access the files it needed to recreate that data.
After all that searching and experimenting, the fix came down to restoring the correct directory ownership.
Sharing the fix
On 27 October 2018, I published an XDA guide explaining how to check for the issue and fix it. The work of NZedPred, rachitrawat, and Tyrantre helped me get there, and I credited them in the guide.
I later made a YouTube walkthrough and a flashable ZIP so others could apply the fix through TWRP without entering the commands manually.
But I kept experimenting.
I compared files inside persist, including id_00 and id_01, looking for patterns in how the IMEI digits appeared. I wanted to know whether those files could help recover phones whose original persist data had been replaced.
Some of my theories were wrong.
Further testing and feedback showed that deleting those files didn't prevent recovery, while modifying another file, dhob.bin, did. I updated the thread with what I had tested and corrected my earlier assumptions.
Eventually, I couldn't make sense of the remaining data. I said so and left the findings available for anyone who wanted to continue.
The IMEI was back, but VoLTE still didn't work
Another XDA thread pointed me towards restoring the appropriate modem files. But the G4 Plus had several regional variants, and the existing guide didn't have files for all of them.
So I started contacting other owners.
People helped supply the modem, fsg, and hw images for five regional models: Brazil, Latin America, EMEA, India, and the US retail variant.
I organised the files by model number, added checksums, and published a second guide on 11 November 2018, crediting the people who supplied and tested the files.
It covered baseband, network, and VoLTE issues. It also covered cases where a G4 Plus appeared as a G4, with only one IMEI and no fingerprint functionality.
What started as fixing my own phone turned into two guides, a video, a flashable fix, and conversations with people using the same phone around the world.
This was my first time digging this deeply into something like this. A lot of it was unfamiliar. I learned by reading, trying things, asking questions, and correcting myself when I was wrong.
I enjoyed it enough that once my phone worked, I broke it again to understand why.