18 September 2015 by Lars Vilhuber
Unlock HTC One (AT&T) Odysee
After switching to T-mobile, I paid my early termination fee to AT&T, and then claimed my unlock code. It took a day for it to get sent, yielding an email like this:
Thank you for contacting AT&T about unlocking your mobile device. Congratulations! Here are your unlock instructions: Your unlock code is: Unlock Code 12345678 1. Power off the device and remove the AT&T SIM card. 2. Insert non-AT&T SIM card. 3. Power on the device. Wait a few moments, allowing the device to fully power-up. 4. Enter the unlock code when prompted. 5. Press OK. The device is unlocked.
with the ominous last line
Note: You are allowed five attempts to unlock before your device permanently locks to the AT&T network.
After grabbing a (non-AT&T, non-US) micro-SIM card (the T-mobile one wouldn’t work, as I got a nano-SIM), insert, and answer the prompt. Success?
So what’s the problem?
The short of it is, and this gets technical:
- Your bootloader needs to be locked
- Your recovery needs to be stock
- Your “ROM” needs to be stock
If you don’t know what I’m talking about, then you probably don’t have my problem, and you can stop reading. If not, continue reading.
My AT&T HTC One was immediately rooted and patched to run the fabulous TWRP recovery and Android Revolution HD version of the HTC One (i.e., no AT&T crap ware, no restrictions on features, etc – works like a charm. Thank you,
mike1986). In order to do so, you have to unlock the bootloader. So violate all of the above (note: if you are still on AT&T, none of this should worry you, and you should DEFINITELY swap out your stock ROM anyway). After leaving AT&T, I decided to go with the Google Play Edition (GPE) in its GPE Google Plus+ version, but that’s not relevant here.
So I finally figured out I needed to undo all of the above. Turns out it can be easy, thanks to the efforts of the hacking community (thanks htc1guru):
Step 0: Oops
After all the intermediate steps, I found myself with a bad /data filesystem. Needs to be reformatted, but the TWRP recovery doesn’t have a mkfs.ext4 tool.
Step 1: return to stock ROM and recovery
Download this fabulous image: http://www.htc1guru.com/downloads/stock-rom-downloads/ (choose the 1.xx version for AT&T) and flash to my (now restored) /data partition:
adb push Guru_Reset_M7_1.26.502.15.zip /data/
and walk through the TWRP steps to flash a ROM. You’ll have to use the mouse (worked like a charm, who knew…). Ignore all the setup steps in the AT&T setup, you’re not going to use it anyway, right? (Note, however, that you will need to uncheck (Settings -> Power) the “Fast Boot” option, otherwise you can’t get into the bootloader).
Step 2: Lock bootloader
Now back to adb. You should still have the
Unlock_code.bin from when you unlocked your phone. Keep it safe for afterwards. For now, boot into bootloader, choose fastboot, and type
fastboot oem lock
Your bootloader is now locked.
Step 3: Finally unlock the SIM
Put in a SIM card, boot up, and answer the prompt (with the mouse!). It now works, and the phone reboots.
Step 4: Put all those nice ROMs back
Step 4.1 Unlock bootloader again
fastboot flash unlocktoken Unlock_code.bin
Step 4.2 Flash TWRP again
fastboot flash recovery twrp-188.8.131.52-m7.img
Step 4.3 Flash ROM again
adb push Google-Plus-Edition-LP_m7_v3.2_072915.zip /data/media/
(Note: because I flashed a Android 4.x ROM from AT&T, the data structure is under /data/media. Android 5.x has it under /data/media/0). Then install using TWRP. I do love the sophisticated and slick tools the open-source/hacking community has come up with, including TWRP (a touch-enabled recovery, essentially a mini-Android system for flashing, restoring, etc.), and the Aroma installer used by many ROM packagers, which has all the slickness of a professional installer, with options to choose from and all.