Monday, December 9, 2013

How to: Manually install an OTA update on your HTC device

Sometimes it turns out that your device for some reason can't find the most recent OTA (Over The Air) update. However, there is a solution to apply OTA update manually, without being forced to wait for the update being downloaded and installed by your device.

Facts you need to know before continuing:
  1. This method has nothing to do with the "adb sideload" feature available on Android devices since Jelly Bean. It should work on every Android HTC device.
  2. Read about different software versions for the HTC devices here. Keep in mind that the OTA update must match the software version on your device. Each original OTA update.zip package has 2 different software versions in its name - the version of the software that must be currently installed on your device and the version of the software that your device will run after the update. For example:
OTA_M7_UL_JB43_SENSE55_MR_HTC_Europe_3.62.401.1-2.24.401.8_release_338160gxmo5sd9337kadux.zip

As you can see, 2.24.401.8 is the software version you must currently have installed to be able to run the OTA and 3.62.401.1 is the version of the software expected after the update. You can't flash an OTA update on a different software version to that expected by the OTA update for two main reasons:
  1. Formal reason - the OTA update.zip package checks if your system is running the expected software version before it starts to install the update:
    assert(file_getprop("/system/build.prop", "ro.build.fingerprint") == "htc/htc_europe/m7:4.2.2/JDQ39/235216.8:user/release-keys");
    This must match the following build fingerprint from the build.prop. If the versions don't match, the installation of the OTA package will be cancelled.
    ro.build.fingerprint=htc/htc_europe/m7:4.2.2/JDQ39/235216.8:user/release-keys
  2. Technical reason - OTA update.zip packages usually contain patches for the target files. This way OTA update doesn't have to be 1GB size, even if it is supposed to update the whole OS to the newer version. Patch files have an *.apk.p extension (f.g. Camera.apk.p) and each patch file must match the target file (f.g. Camera.apk). To make it possible, OTA update.zip package checks the MD5 checksum of each file on the system partition on your device:
    assert(apply_patch_check("/system/app/Camera.apk",
    "b3b79e40bad0b1bec5fb949ac5f8662f91bee714",
    "5a5bf63e3d7c9de52a7d8d7a292e158263783844"));
    And finally, if the MD5 is correct it applies the patch. All these commands are stored in META-INF\com\google\android\updater-script of each OTA update.zip package. If the MD5 is incorrect, or at least one file is missing, the installation of the OTA package will be cancelled.
    assert(apply_patch("/system/app/Camera.apk", "-",
    b3b79e40bad0b1bec5fb949ac5f8662f91bee714, 4229394, 
    5a5bf63e3d7c9de52a7d8d7a292e158263783844,
    package_extract_file("patch/system/app/Camera.apk.p")));

Now you are ready to manually apply the OTA update on your device. The methods you'll use is based on Android stock recovery.

Method 1 (for users with root access)
  1. Make sure you have the stock (original) recovery on your device
  2. Make sure you're running a completely unmodified operating system. Additional files like Superuser.apk or su binary are allowed, you just can't have any system files changed or removed (due to the MD5 check)
  3. Make sure you have a reasonable amount of battery charge remaining
  4. Make sure the OTA update you're about to install matches the software version on your device
  5. Copy the OTA update.zip package to the internal storage /data/media/0/update.zip
  6. Open adb shell or use Android Terminal Emulator and type: echo "--update_package=/data/media/0/update.zip" > /cache/recovery/command
  7. Turn OFF the device (make sure fastboot mode is disabled in settings)
  8. Hold your volume down and power keys until the bootloader starts up
  9. Using the volume keys, navigate down to RECOVERY and press power
  10. The OTA update installation process should now start automatically
  11. Once system is booted you should see a confirmation about the successfully flashed update.
Method 2 (for users without root access) | This method won't work on the S-ON HTC One M8
  1. Make sure you have the stock (original) recovery on your device
  2. Make sure you're running a completely unmodified operating system. Additional files like Superuser.apk or su binary are allowed, you just can't have any system files changed or removed (due to the MD5 check)
  3. Make sure you have a reasonable amount of battery charge remaining
  4. Make sure the OTA update you're about to install matches the software version on your device
  5. Copy the OTA update.zip package to your device (internal storage preferred)
  6. Turn OFF the device (make sure fastboot mode is disabled in settings)
  7. Hold your volume down and power keys until the bootloader starts up
  8. Using the volume keys, navigate down to RECOVERY and press power
  9. You are now in stock recovery mode. You should see nothing more than a (sometimes spinning) Android with the red exclamation mark above it (an empty black screen is also possible). Wait for a few seconds
  10. First hold volume up, then (with volume up held down) press power button to enter the main recovery menu. This keys combination may vary from device to device. Try different keys combination if the above one doesn't work (might be all three keys all together too)
  11. Navigate down to "apply from phone storage" text and press power to confirm
  12. Navigate to the location where you copied the OTA update.zip package and press power to confirm
  13. Wait (sometimes you might need to follow further instructions on the screen) until the update process is finished
  14. Once system is booted you should see a confirmation about the successfully flashed update.
Have any questions or comments? Feel free to share! Also, if you like this article, please use media sharing buttons (Twitter, G+, Facebook) below this post!


For latest news follow Android Revolution HD on popular social platforms:

22 comments:

  1. The Phone has to be rooted?... I have a Htc Amaze 4g, looking to upgrade with your Android Revolution HD ROM, cause I have upgrated it to ICS original rom from the upgrade software of the phone but I had so many problems with the battery, my phone shuts down ramdomly, do you think that this problem can be solved by your ROM?
    Thanks!...
    Greetings From Venezuela / Saludos desde Venezuela

    ReplyDelete
    Replies
    1. You don't need to be rooted.

      Delete
    2. Para flashear una custom ROM, en realidad no hace falta que el equipo esté rooteado, basta con tener el bootloader desbloqueado y un custom recovery.. igual te advierto que existe la posibilidad d q el problema que presenta tu tlf sea de la batería como tal, has probado correr el autodiagnóstico que tienen los tlfs htc?

      Delete
  2. Hello and thank you for this information. Does the phone have to be rooted first? I have an AT&T unlocked htc one using in Germany and still at 4.1.2. Will this void any warranty? Thank you

    ReplyDelete
    Replies
    1. Flashing official OTA will not void your warranty. You also don't have to be rooted to flash official OTA.

      Delete
    2. Thank you mike. Where can i get official OTA?

      Delete
  3. Will this metod work with an unlocked bootloader?

    ReplyDelete
  4. It seems to me, after some back, it only works with S-OFF
    Am I wrong?

    ReplyDelete
    Replies
    1. Nope, it should work on S-ON device too.

      Delete
  5. Hi Mike
    From where can i download the update ?

    ReplyDelete
  6. after flashing ota , stuck on bootloop issue, factory reset , erase cache , nothing work

    ReplyDelete
  7. how do I do if I have TWRP?

    ReplyDelete
  8. Does the stock recovery you provided in the download section also work for Stock Google Edition Rom? I have Stock 4.3 Google Edition and TWRP and I would like to OTA upgrade it to 4.4.

    ReplyDelete
  9. does this method works for RUU update files? if it does will it refresh current installation and keep my settings and apps and all the media files or it will totally reset and wipe everything? I just need to reflash my HTC one dual sim to stock RUU because I did cache wipe and fixed permissions which made me lost some pre-installed apps and video tutorials and caused problems with avatars in contact list, so I just want to restore what I lost without total wipe.

    ReplyDelete
  10. Hi Mike,problem with the camera, pink image Htc one M7...http://www.youtube.com/watch?v=4p7a9tdNVYo
    Hardware?

    ReplyDelete
    Replies
    1. Its htc 4.3 issue!

      Delete
    2. I recently installed the 4.4.2 ROM GE ,the problem continued even witha downgrade to4.2.2, nocure thatproblem... i need help :/

      Delete
  11. While Manualy Updating The Patch Update, Say Of A Custom ROM (Base Installed Version 4.4.2 / Patch For The Same Version), Should I Still Wipe Cache / Data Etc Etc? Or Is It Just Plain Normal Update & Reboot?

    ReplyDelete
  12. i tried to install OTA_M7_UL_K44_SENSE55_MR_HTC_Europe_4.19.401.8-3.62.401.1_release_34978069qunfn8klmohm8p on my HTC One with CID HTC__102 iam currently on 3.62.401.1 but the stock recovery says wrong cid why?

    ReplyDelete
  13. Jadwal Resmi Adu Ayam SV388 9 Maret 2019 di Situs Judi Sabung Ayam Online Melalui Agen Resmi Taruhan Sabung Ayam Live Asli Thailand.

    Situs Judi Sabung Ayam Online SV388 Merupakan Situs Judi Asal Thailand Yang Sangat Terkenal Dengan Permainan Sabung Ayam Yang Fair dan Menghibur Para Penonton Judi Sabung Ayam.

    Untuk Info Lebih Lanjut Bisa Hub kami Di :
    wechat : bolavita
    line : cs_bolavita
    whatsapp : +628122222995
    BBM: BOLAVITA

    ReplyDelete