I'm trying to restore android after playing around with ubuntu touch

I follow exactly the same steps described the ubuntu's wiki page i.e.

  1. Download the factory image corresponding to your device's model and version (initial table has links).

  2. Ensure the device is connected and powered on.

  3. Extract the downloaded file and cd into the extracted directory.

  4. run adb reboot-bootloader

  5. run ./flash-all.sh (use sudo if lack of permissions on the workstation don't allow you to talk to the device).

The archive is downloaded successfully, checked the sha1 checksum everything is ok. But the ./flash-all.sh fails like this

sending 'bootloader' (2308 KB)...
OKAY [  0.513s]
writing 'bootloader'...
OKAY [  0.292s]
finished. total time: 0.805s
rebooting into bootloader...
OKAY [  0.007s]
finished. total time: 0.008s
sending 'radio' (12288 KB)...
OKAY [  2.668s]
writing 'radio'...
OKAY [  1.372s]
finished. total time: 4.040s
rebooting into bootloader...
OKAY [  0.009s]
finished. total time: 0.009s
archive does not contain 'boot.sig'
archive does not contain 'recovery.sig'
failed to allocate 435793780 bytes
error: update package missing system.img

My device is Nexus 4. Tried both 4.2.2 and 4.3 androind versions for Nexus 4 still the same. Any ideas how problem can be solved ?


Figured out on my own

First partitions need to be erased manually

fastboot erase boot
fastboot erase cache
fastboot erase recovery
fastboot erase system
fastboot erase userdata

The images from the zip file inside the original download from google install each image manually like this

fastboot flash boot boot.img
fastboot flash system system.img
fastboot flash recovery recovery.img
fastboot flash userdata userdata.img

I had same problem and got stuck at first to the complain that:

archive does not contain 'boot.sig'
archive does not contain 'recovery.sig'
failed to allocate 435793780 bytes
error: update package missing system.img

After following the solution proposal I unzipped all individual images and then tried to flash them one by one.

When flashing system.img I got new kind of error saying that there is not enough space available in device. Actual complaint was:

error: cannot load 'system.img': Cannot allocate memory

Accidentally, I mistyped the command at some point by writing instead:

fastboot flash system recovery.img

Then amazingly when executing the command it passed ok. After noticing that I mistyped the command, I tried original one again and it went ok.

fastboot flash system system.img 



The issue here is lack of available system reseources.

error: cannot load 'system.img': Cannot allocate memory

is talking about your system memory, as the file is loaded into memory before being sent across to the device.

Try freeing up resources (close unnecessary programs) and then retry the commands.


This error occurs when you don't have enough memory (RAM) available on the system to complete the task. The entire update file is loaded into memory before being sent over the wire. In the latest version of Android, Marsh mellow, this system.img file is over 1 GB. To circumvent this problem, simply create a temporary swap space by:

$ sudo fallocate -l 2G /tmp/swapfile
$ sudo chmod 600 /tmp/swapfile
$ sudo mkswap /tmp/swapfile
$ sudo swapon /tmp/swapfile

Now flash your files and when you are done, remove the swap file by:

$ sudo swapoff -a
$ sudo rm -f /tmp/swapfile

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.