Not enough free space on /system to apply patches

Search This thread

AlexPi

New member
Feb 16, 2008
2
6
Just want to give everyone a heads up, when attempting to apply OTA updates to my Nexus 7 2013, I was getting the error: "Not enough free space on /system to apply patches". The error was showing up in the recovery log and I was really confused. I tried reflashing various versions, but still all OTA updates would fail with the same error.

TL;DR: Turns out it was the cache, read on for the fix.

I found the following in the OTA update script:
"apply_patch_space(56661556) || abort("Not enough free space on /system to apply patches.");"

So I assumed that I should have at least 56 MB free in "/system"

Doing df would show this:
Code:
f:\AndroidADT\sdk\platform-tools>adb shell df
Filesystem               Size     Used     Free   Blksize
/dev                   903.4M    56.0K   903.3M   4096
/sys/fs/cgroup         903.4M    12.0K   903.4M   4096
/mnt                   903.4M     0.0K   903.4M   4096
/system                827.8M   819.5M     [B]8.3M[/B]   4096
/cache                  31.5M     4.2M    27.3M   4096
/data                   26.4G     7.9G    18.5G   4096
/persist                14.5M     4.2M    10.2M   4096
/storage               903.4M     0.0K   903.4M   4096
/mnt/runtime/default/emulated: Permission denied
/storage/emulated       26.4G     7.9G    18.5G   4096
/mnt/runtime/read/emulated: Permission denied
/mnt/runtime/write/emulated: Permission denied

I didn't, and I couldn't figure out why.

The answer was, after much searching, is that the error message is wrong.

I found this here (ok, so I can't post links, just Google for "edify_generator.py")
Code:
def CacheFreeSpaceCheck(self, amount):
    """Check that there's at least 'amount' space that can be made
    available on [B]/cache[/B]."""
    self.script.append(('apply_patch_space(%d) || abort("Not enough free space '
                        'on [B]/system[/B] to apply patches.");') % (amount,))

Notice that the comment talks about /cache, while the error is showing /system.

Turns out my /cache was formatted incorrectly. All I had to do was reboot into the bootloader and then format the cache.
Code:
adb reboot bootloader
...wait for bootloader to start...
fastboot format cache

I just wanted to post this somewhere because I've been Googling for a while now and I've seen others get this error with no solution.

Oh, and the reason why it got into this messed up state is because I did:
Code:
fastboot flash cache cache.img
This was using the official images from Google. So don't ever do that ;)
 

tiazek

Member
Apr 5, 2013
44
13
Thank you very much AlexPi, I can finally receive OTAs and avoid the hassle of flashing a new image, specially now that they are releasing more images with minor bug fixes for the same Android version (there are now 3 images for 6.0.0). I had one OTA of only 2 MB in size and I didn't want to flash a new image just because of this minor change.

I just enter (stock) recovery mode and selected "wipe cache" and it worked just fine after that, so it wasn't even necessary any USB data cable to execute adb and fastboot commands.

By the way, the error message was indeed wrong and it was already fixed.
 

msgfromside3

Senior Member
Nov 23, 2010
741
131
Thanks. I also flashed the cache partition because I remember that it was effectively the same as wiping the cache. I guess that is not correct.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 5
    Just want to give everyone a heads up, when attempting to apply OTA updates to my Nexus 7 2013, I was getting the error: "Not enough free space on /system to apply patches". The error was showing up in the recovery log and I was really confused. I tried reflashing various versions, but still all OTA updates would fail with the same error.

    TL;DR: Turns out it was the cache, read on for the fix.

    I found the following in the OTA update script:
    "apply_patch_space(56661556) || abort("Not enough free space on /system to apply patches.");"

    So I assumed that I should have at least 56 MB free in "/system"

    Doing df would show this:
    Code:
    f:\AndroidADT\sdk\platform-tools>adb shell df
    Filesystem               Size     Used     Free   Blksize
    /dev                   903.4M    56.0K   903.3M   4096
    /sys/fs/cgroup         903.4M    12.0K   903.4M   4096
    /mnt                   903.4M     0.0K   903.4M   4096
    /system                827.8M   819.5M     [B]8.3M[/B]   4096
    /cache                  31.5M     4.2M    27.3M   4096
    /data                   26.4G     7.9G    18.5G   4096
    /persist                14.5M     4.2M    10.2M   4096
    /storage               903.4M     0.0K   903.4M   4096
    /mnt/runtime/default/emulated: Permission denied
    /storage/emulated       26.4G     7.9G    18.5G   4096
    /mnt/runtime/read/emulated: Permission denied
    /mnt/runtime/write/emulated: Permission denied

    I didn't, and I couldn't figure out why.

    The answer was, after much searching, is that the error message is wrong.

    I found this here (ok, so I can't post links, just Google for "edify_generator.py")
    Code:
    def CacheFreeSpaceCheck(self, amount):
        """Check that there's at least 'amount' space that can be made
        available on [B]/cache[/B]."""
        self.script.append(('apply_patch_space(%d) || abort("Not enough free space '
                            'on [B]/system[/B] to apply patches.");') % (amount,))

    Notice that the comment talks about /cache, while the error is showing /system.

    Turns out my /cache was formatted incorrectly. All I had to do was reboot into the bootloader and then format the cache.
    Code:
    adb reboot bootloader
    ...wait for bootloader to start...
    fastboot format cache

    I just wanted to post this somewhere because I've been Googling for a while now and I've seen others get this error with no solution.

    Oh, and the reason why it got into this messed up state is because I did:
    Code:
    fastboot flash cache cache.img
    This was using the official images from Google. So don't ever do that ;)
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone