Earlier today I was restoring my iPhone 4 to latest version of iOS 4.2.1 and the installation process was frozen in half following error 1013 and recovery mode loop on each restart. I tried every possible solution available in the wild i.e. Tiny Umbrella, Recboot, iRecovery and iReb. I also tried DFU + Restore but none of the trick worked for me.
When I googled about it, I found many people stuck in recovery phase while updating to iOS 4.2.1 and have found themselves before the fateful error 1013 and an iPhone in recovery mode unusable. Let’s see how to solve this problem.
Try the following tricks one by one :
1. Open your host file and add “#” just before “gs.apple.com” (without quotes) Save your host files and try to restore again.
2. Restart your computer and try again the restore procedure. Possibly try a different USB port.
3. Download the latest version of TinyUmbrella (download here) Launch umbrella, in Advanced uncheck "Set to Hosts Cydia on Exit", then click "Exit Recovery Mode" to exit the recovery mode. Now restart your computer and try again Restore
4. Use RecBoot to exit recovery. Operation is simple, since you run the program, connect your iPhone to your computer via USB and click on "Enter Recovery Mode".The other button, "Exit Recovery Mode", is used to exit the mode. The application can be downloaded for free by users Mac OS X and Windows. Now restart your computer and try restoring.
5. If the error 1013 still persists, then the last way is to try another computer, if possible try on Mac.