I know, laugh it up.
Anyways, you're either here because you don't know what the EFS is and you wanna know, you ruined your EFS and you're looking for redemption, or you just wanna see me ramble. Whichever the case, I figured I'd write this so nobody else has to deal with the looming fear of your 300 dollar phone with infamously-bad customer support becoming a worthless, barely functioning phone, if not a big 300 dollar brick.
Before I go on, I wanna mention that this guide applies for most if not all phones, not necessarily just the OPO. So if anyone is losing their mind over a corrupted or lost EFS partition, this should get them on the right track to at least understanding the problem.
BACKGROUND: AKA "WHAT IS THE EFS AND WHY DO I EVEN CARE"
EFS stands for Encrypted File System. Imagine the EFS as a big folder containing all of the important stuff that makes the "phone" part of your phone (i.e. what lets you communicate from one person with a phone to another) tick. It contains your IMEI, lots of files revolving around your SIM card and Wifi/Bluetooth (this includes your MAC address for all the radios of your phone), and lots of other things that should never ever under any circumstance be deleted or touched. It's sensitive, it's devastatingly important, and it's a huge pain. If you lose your EFS folder, you lose pretty much any chance of your phone being able to use data, Wifi, Bluetooth, and (in my case) your phone will just not wanna respond and reboot quite a lot.
CHAPTER 1: AKA "THAT SOUNDS LIKE GARBAGE HOW CAN I FIX THIS"
So, like all nice and important things that we have on Android, we can back this folder up, assuming you're rooted and with a custom recovery (though quite frankly if you're not rooted/installing ROMs I have zero idea how you'd corrupt your EFS). I'd recommend doing it through a nandroid backup (TWRP usually has the option to backup EFS, if not there's an unofficial version for bacon that can), but there are other apps that do the job quite nicely. Backing up your EFS is just as essential as backing up your previous ROM; in fact, backing up your EFS is MILES MORE ESSENTIAL because you can just flash a ROM over a corrupted system to get it working. There is no "flashable EFS"; if it were that easy, it wouldn't be so sensitive, and I wouldn't be writing this guide.
CHAPTER 2: AKA "I'M SUPER CAREFUL BRO I'LL NEVER MESS UP MY EFS PARTITION, WHY BOTHER"
Do it anyways.
I installed a ROM, realized my gapps package was screwed up, restored a CM13 backup, and realized my SIM card wasn't being detected. My phone would lag like hell, and after a while it'd just crash and reboot. I had no IMEI, I had no SIM card detection. I knew exactly what it meant. It wasn't fun to restore it.
If ROM installations were perfect, we wouldn't really have to backup anything. But, sometimes a hiccup will occur, something will touch something else that it shouldn't, and chaos ensues. So, if you don't wanna take 4 hours out of your day to hope to Christ that you didn't royally ruin your phone and the restoring method worked, just back it up. It's like, 3MB and it'll save so much frustration. Honestly.
CHAPTER 3: AKA "YEAH ABOUT THAT MY EFS IS ALREADY CORRUPTED, PLS HELP"
Congrats, you did it! Don't feel too bad, it happens to the best of us.
Fixing an EFS on the Oneplus One is pretty easy, but really time consuming and riveting because it might not 100% of the time work. You'll need the following:
- Some sort of ADB/fastboot program. I use Minimal ADB and Fastboot, which rarely has any problems, but you can use whatever as long as it'll talk to your device.
- Your near-dead Oneplus One.
- A few hours of your time.
- Some sort of backup of your data, you'll be factory resetting.
- OxygenOS. Preferrably, a package that can be flashed in TWRP. I won't find that for you.
- An unlocked bootloader. I cannot stress how important this is. If you don't know what this is, do some research before trying to fix your ruined EFS. Again, how you'd have even ruined it with a locked bootloader is beyond me...
- TWRP 184.108.40.206. Yes, it has to be this version; this is the only one that can install firmware correctly. The unofficial modified 220.127.116.11 might be able to, but I'm not about to try it.
- Competence and good reading skills. Do everything exactly as I wrote it.
- Some knowledge on how flashing a ROM works.
- A modified persist.img file that we'll be flashing. You can find it in this thread. Download the Never Settle package and take out the persist.img file; we don't care about the rest. Whether this is mandatory or not, I don't know, but I used it and it worked fine so I'll include it. If anyone tries this without the persist file and it works, let me know. Thanks a ton to markbensze for making this, he saved my skin.
Now for how it's done:
- To start, we gotta put your phone into fastboot mode. Do this by holding the power button and the up volume button as you're turning your phone on. You'll know it worked when the phone very dimly says "Fastboot Mode".
- Plug your phone into your computer. Let it do any driver stuff it has to, then open your ADB/Fastboot program. Type "fastboot devices", if you see a bunch of letters/numbers with the word "fastboot" a few spaces away, you're set.
- Seriously, if your bootloader isn't unlocked, you gotta do that. This will wipe EVERTHING from your phone, including any backups. I won't cover that mess, there's trillions of guides for that.
- Type the following commands:
fastboot erase modemst1 fastboot erase modemst2 fastboot erase persist
- This erases a bunch of partitions that have to do with the EFS. They all regenerate themselves, but as an added precaution we're gonna flash that persist.img you got from the thread in the "what you need" list. In order to do this, enter the following command:
fastboot flash persist [location to your persist.img on your computer]
- If all goes well, you'll get a handy success message and you can get out of fastboot mode by holding down the power button until it turns off.
- Now, reboot to recovery; do this by holding the power button and holding the down volume button as you turn your phone on, until you see the TWRP splash screen.
- How you do this next step is up to you; you can use the built-in MTP to transfer the Oxygen OS file over from your computer to your phone, or you can use ADB sideload. If you don't know how sideload works, just transfer it over.
- Factory reset as you would installing a normal ROM, and flash Oxygen OS through the install menu/sideload/however you wanna. Let it fully install.
- Reboot. Let it boot, pray to the EFS gods that they'll give you their blessing, and check if your SIM card gets detected.
If it did, congradulations! Your EFS is working. Now, go make a backup while you can.