Handling “Package file is invalid” problems on CyanogenMod 7

Update: The latest update for CyanogenMod for Milestone – version solves this problem as well.

Lately I’ve been having problems updating software on my Motorola Milestone (1, as in A853) running CyanogenMod 7.1 (thanks to Nadalbak who maintains an unofficial and unsupported port of CyanogenMod for this old device). When I start the Android Market and do an update of an existing application, I get the error “Package file is invalid” for any application. Sometimes removing an application and reinstalling it will work, but often not.

There could be several problems that cause this, apparently a problem with the file permissions on the file systems is common, and if this is your problem then it can be fixed by opening the terminal emulator, executing “su” to gain super-user permissions and then running “fix_permissions” (it will take a while to complete).

If this doesn’t solve the problem for you, then likely the problem is that you ran out of space on your “data” partition or “cache” partition. This is very common if you have a large “apps partition” on your SD card and you are in the habit of installing tons of applications – I know I am 🙂 .

The problem is the “Dalvik cache” that gets full and apparently the operating system doesn’t clear old files from it so it will eventually run out of space.

I’ve tried cleaning the Dalvik cache, using Titanium backup and the OpenRecovery menu – but that doesn’t clean the cache properly for some reason, likely because it expects the cache to be on the “data” partition but in CyanogenMod 7 for Milestone the Dalvik cache is on the “cache” partition.

To solve the problem, boot into OpenRecovery1 then select “Wipe cache” from the main menu. Please note that you must wipe the entire cache partition and not just the Dalvik cache. Also make sure not to choose the similar option to wipe the data partition as that will remove all your personal data from the phone…

Good luck.


If your /cache partition is constantly overloaded in your Mileston A853 running CyanogenMode 7.1, you can disable the hosting of the apps dalvik cache under /cache by editing the system’s build.prop file. To do it follow these instructions.

  1. Start a terminal in your phone using the terminal emulator app (or an alternative – I use ConnectBot).
  2. Execute su and approve the super user mode.
  3. Execute mount /system -o remount,rw to allow editing the build.prop file.
  4. Execute vi /system/build.prop to edit the file.
  5. Find the instruction dalvik.vm.dexopt-cache-only – you can type /dalvik<ENTER> to find it. Move the cursor to the end of the line and press on “A” to start editing. Delete the “1” at the end of the that line and write “0” instead.
  6. Issue an “ESC” button (in ConnectBot you can do it by pressing the camera shutter button) and then type “:x” to save the changes and leave the editor.
  7. Execute mount /system -o remount,ro to return the system files to read only mode.
  8. Reboot to OpenRecovery and use it to clear the dalvik cache and the cache partition, and then reboot the phone.

Your device should now have enough space in the /cache partition.

Enhanced by Zemanta
  1. When you hold the power button and select “Reboot” from the popup menu, CyanogenMod will ask you if you want to do a normal reboot or to boot to recovery, so it is very easy to get to. Otherwise you can turn off the phone and then hold the “x” button on the hardware keyboard while turning on the phone []

2 Responses to “Handling “Package file is invalid” problems on CyanogenMod 7”

  1. Larry:

    Good article. Toda!

  2. dennis:

    Thank you so much! I was about to re install my cyanogenmod 7.2 because of this error. You saved me lots of late night work.

    Thanks man

Leave a Reply