[INFO] Nexus 5 OTA Help-Desk

crazycaveman

Senior Member
Aug 28, 2010
60
86
0
For everyone who gets an error message that says "{APP} has unexpected contents", I have created a flashable zip (402 MB) (Mega mirror) that will check all the same files as the OTA (and in the exact same way) and replace any that don't match with the version that was released with KOT49H. It will also check your kernel (boot) and modem, but won't make any changes to those; you'll have to flash manually in fastboot if you get a message that one of those is incorrect. You can flash this as many times as you want and can flash the OTA directly after flashing this.

Code:
File: check_hammerhead_kot49h_system.zip 
[url=http://goo.gl/xLlREk]Google Drive[/url] 
[url=http://goo.gl/lNRLlk]Mega[/url]
MD5: 3a810e0d67e2f7b17af947a9c46664ec *check_hammerhead_kot49h_system.zip
Standard disclaimer: I am not to be held responsible if this messes up your phone in any way. Make sure you have backed up your phone and have backups of your backups. I created it for myself and figured I'd share what I created to benefit others. Just because it works for me does not mean it will work for you. If an alien pops out of your phone or it suddenly implodes or you lose everything on it and have no backups is not my problem.

For those of you who are interested in how I generated this, you'll find the script I created to generate the file below. Also, if you want to check the updater-script that is in the zip file without downloading the whole thing, I've made a paste for easy access.

System checker script (not for the faint of heart!):

If you want to run this to create the zip file yourself, you'll need a zip file of the system directory for the version you're upgrading from and the OTA zip. I'm sure there's a better way to do all this, but this is what my convoluted mind gave me...

Call the script as (2nd argument is optional) ${0} OTA.zip [system_files.zip]
Code:
#!/bin/bash
# This requires 1 argument: the update zip filename
update_zip=$1
if [ -z ${update_zip} ]; then
        echo "Need to let me know the name of the ota zip file!"
        exit 1
fi
system_zip=${2:-$(ls system*.zip)}
extract_dir=/tmp/update_zip_check
update_dir="META-INF/com/google/android"
[ -d "${extract_dir}" ] && rm -rf "${extract_dir}"
mkdir "${extract_dir}"

echo "Updating updater-script for checking and replacing files."
unzip -q -d "${extract_dir}" "${update_zip}" "${update_dir}/update-binary" "${update_dir}/updater-script"

# The following was the old way of updating files
#unzip -q "${system_zip}" $(grep -e 'mount' -e 'getprop' -e 'assert(apply_patch_check(' -e 'assert(apply_patch_space(' ${extract_dir}/${update_dir}/updater-script | sed 's|^assert(\(apply_patch_check("/\)\([^"]*\)\(.*")\));|ifelse(\1\2\3, "", (package_extract_file("\2", "/\2"); ui_print("\/\2")));|' | tee -i ${extract_dir}/${update_dir}/updater-script_check | grep -e 'ifelse' | sed 's|^ifelse(apply_patch_check("/system/\([^"]*\)".*|\1|') -d ${extract_dir}

unzip -q -d "${extract_dir}" "${system_zip}" $(grep -e 'mount' -e 'getprop' -e '^apply_patch_check(' -e '^apply_patch_space(' ${extract_dir}/${update_dir}/updater-script | sed 's!^\(apply_patch_.*\) || abort("\\"/system/\(.*\)\\" .*);$!\1 || (ui_print("/\2 unexpected; replacing"); package_extract_file("\2", "/system/\2"));!' | sed 's!abort!ui_print!' | tee -i ${extract_dir}/${update_dir}/updater-script_check | grep -e '^apply_patch_check("/' | sed 's|^apply_patch_check("/system/\([^"]*\)".*|\1|')

mv "${extract_dir}/${update_dir}/updater-script_check" "${extract_dir}/${update_dir}/updater-script"
cur_dir="$(/bin/pwd)"
cd "${extract_dir}"
echo "Now creating the zip file for flashing."
zip -qr "${cur_dir}/check_system.zip" *

cd "${cur_dir}"
rm -rf "${extract_dir}"
echo 'Done! Please remember to backup any APKs you have replaced on the /system partition of your device; this file will replace with the stock version for your build.'
 
Last edited:

Hangul

Member
Dec 9, 2010
9
1
0
So I need some help figuring out which instructions apply to my situation.

Here's where I am:

  • Unlocked bootloader
  • Stock ROM
  • Rooted with SuperSu (v 1.94)
  • Franco kernel
  • Custom recovery (TWRP)
  • Xposed Framework w/ various modules installed

What steps do I need to take?
 

jd1639

Recognized Contributor
Sep 21, 2012
16,836
5,398
0
Minnesota
So I need some help figuring out which instructions apply to my situation.

Here's where I am:

  • Unlocked bootloader
  • Stock ROM
  • Rooted with SuperSu (v 1.94)
  • Franco kernel
  • Custom recovery (TWRP)
  • Xposed Framework w/ various modules installed

What steps do I need to take?
You need to uninstall xposed and flash the stock kernel then follow B

This will also work for you http://forum.xda-developers.com/showthread.php?p=53109563

Sent from my Nexus 5 using XDA Free mobile app
 
Last edited:

Maxx247

Senior Member
Jan 13, 2013
381
152
0
mumbai
my nexus running stock unrooted locked bootloader. for flashing ota zip, i have to unlock bootloader? if not then all data will get wiped after flashing zip?
 

jd1639

Recognized Contributor
Sep 21, 2012
16,836
5,398
0
Minnesota
my nexus running stock unrooted locked bootloader. for flashing ota zip, i have to unlock bootloader? if not then all data will get wiped after flashing zip?
You do not have to unlock the bootloader. Follow the first scenario. It will not wipe your data

Sent from my Nexus 5 using XDA Free mobile app
 
  • Like
Reactions: Maxx247

crazycaveman

Senior Member
Aug 28, 2010
60
86
0
my nexus running stock unrooted locked bootloader. for flashing ota zip, i have to unlock bootloader? if not then all data will get wiped after flashing zip?
You don't have to unlock the bootloader to flash this zip. You will need adb, though. Just boot into recovery, select the sideload option and then run 'adb sideload <ota_zip>' from your computer (after you've plugged in your phone to USB, of course).
 

devesh38

Senior Member
May 17, 2012
68
6
0
Mumbai
When that happens go to the device manager in Windows and I would bet you will see the Nexus 5 listed in the other category with a warning icon on it. Right click the Nexus 5 and select Update Driver and tell it that you want to manually pick the drivers from the list. Pick the Android phone category and then the ADB drivers. If Android is not an option in the list then that means that the drivers are not installed for some reason. In that case you need to download the Google USB drivers from Google and point the device manager driver updates to the folder that contains those new download the drivers.
this helped me. in device manager it was showing normal when phone was on, but as soon as i go into recovery and abd download, the device manager showed a exclamation mark. Then one needs to follow above steps.
Thanks.
 

shoeseat

Senior Member
Jul 5, 2012
421
83
0

thiagomonts

New member
Jul 7, 2012
3
0
0
Hello, I wonder what I do in my case, I have the stock ROM with root done by Auto-CF-Root, Xposed Framework installed and stock Recovery.

From what I read, I have to uninstall Xposed Framework and then proceed to Section A or Section B, however I can't go to Section A, because I have root and I can't go to section B, because I don't have custom recovery, what should I do?

I just want to update and continue with root, don't want custom recovery.

Thanks for the attention.
 
Sep 4, 2013
32
6
0
Velvet problem with updating

4.4.2 custom recovery rooted, no modifications (so I thought) updating via OTA zip in recovery getting this error 7 (priv-app/Velvet.apk has unexpected contents)

I erased google search and downloaded the version from play store so I'm not sure why I keep getting this error.

Thoughts?
 

crazycaveman

Senior Member
Aug 28, 2010
60
86
0
Hello, I wonder what I do in my case, I have the stock ROM with root done by Auto-CF-Root, Xposed Framework installed and stock Recovery.

From what I read, I have to uninstall Xposed Framework and then proceed to Section A or Section B, however I can't go to Section A, because I have root and I can't go to section B, because I don't have custom recovery, what should I do?

I just want to update and continue with root, don't want custom recovery.

Thanks for the attention.
Try running the steps in Section A. Is there a particular reason you don't want a custom recovery?

4.4.2 custom recovery rooted, no modifications (so I thought) updating via OTA zip in recovery getting this error 7 (priv-app/Velvet.apk has unexpected contents)

I erased google search and downloaded the version from play store so I'm not sure why I keep getting this error.

Thoughts?
It seems like you've modified the Velvet.apk file in /system previously. I have posted a zip file that can fix it for you or you can flash back to stock (just the system partition).
jd1639 has a modified factory image that won't wipe /data that would also help
 
Last edited:
  • Like
Reactions: thiagomonts

crazycaveman

Senior Member
Aug 28, 2010
60
86
0
Thanks! Because I won't put any custom rom on my device, use only root to remove some applications that don't use and Xposed to add some features that I find interesting.
If you have deleted apps from the system partition, there is a high probability that the OTA will fail (something has unexpected contents), but you can still give it a shot without messing up anything. If it does fail, you will need to flash the factory system image to fix this (see jd1639's post)