Photo credit: hirotomo (Flickr)
Having recently updated my iPhone 4 to iOS 4.2.1 I can report that it wasn’t without pain. For a period of time I found myself stuck on the recovery screen because iTunes couldn’t verify my iPhone with Apple’s servers. For reasons known only to Apple, when you restore your iDevice, iTunes will “prepare” your iPhone for restore i.e. place it in a unusable state before then verifying with Apple that it’s cool to upgrade before then proceeding to load new firmware. [C’mon, seriously Apple? – do that before you put my device into recovery mode please!]Â Each and every time I attempted to restore my iPhone I ended up with “The iPhone could not be restored. An unknown error occurred (1013)“. This was down to a pesky entry in my hostfile that needed eradicating. If you’re in the same boat then here’s the fix I found when doing a little Googling:
Mac OS X
1. On your Mac, open your Applications folder.
2. Navigate to the Utilities folder.
3. Open Terminal.
4. Type “sudo nano /etc/hosts” (without quotes) and press enter.
5. Enter your password
6. Use the down arrow key to find the gs.apple.com entries. Once the cursor is in front, make sure you comment out the line(s) by entering # in front of the text.
7. Save the file by pressing CONTROL+O.
8. Exit the nano editor by pressing CONTROL+X.
9. Restore your iDevice.
1. Press Start, then Programs, then Accessories
2. LaunchÂ Notepad or WordPad
3. Click Open from File menu.
4. Browse to Windows/System32/drivers/etc
5. In “files of type:” select all documents
6. Open “hosts“
7. Delete all line that have gs.apple.com or similar
8. Hit Save
9. Restore your device
UPDATE: Important notes if you are getting the error when installing an older firmware
There are some occasions where you want to install an older firmware and do so using a tool like TinyUmbrella to give access to those SHSH blogs you’ve got saved (since Apple doesn’t sign old firmware). If you get error 1013 when updating with TinyUmbrella running, do the following:
– let the iPhone boot to the iTunes recovery screen
– stop your TSS server from running in TinyUmbrella
– click “Exit Recovery” in TinyUmbrella
– iPhone will now boot as normal and you can jailbreak as you would before
This basically happens because the baseband is being preserved.1013, 4, 4.2.1, error, iOS, iPhone, iTunes, Mac, recovery, restore, stuck, upgrade, windows