• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Mods [Guide]How to flash a Nexus Factory Image manually.

With my N4, the Flash-all.bat file worked, but with the N6 I had to extract the .img files and flash them individually.

If you are using the flash-all.bat file per the instructions, it's common to get an error message like that. Extract the .img files from the zip and flash them one at a time with fastboot. You do not need to restart the bootloader each time.
 
  • Like
Reactions: scary alien
Upvote 0
@lunatic59 did all that, nothing worked. Flash like 5 times now, always stuck.
@AsteroidS downloaded this version, and tried by your tutorial. Error after flashing the radio, saying something like "system.gis not founded" and then press any key to exit. You extracted twice the file? Or just once and left the .zip archive in the folder? Thanks all, I'm starting to think that maybe it's a hardware problem, bad.

i extracted the file twice (i.e. extracted the contents in image-occam-lrx21t.zip), and manually ran each command:
  • fastboot flash system system.img
  • fastboot flash boot boot.img
  • fastboot flash recovery recovery.img
  • fastboot flash cache cache.img
i would suggest:
1. try it on a different PC
2. try to use the SDK Manager / platform-tools from: https://developers.google.com/android/nexus/images

good luck
 
Upvote 0
Thanks for the guide,
can someone help me where is my problem? after flashing I get stuck on the Marshmallow animated logo.
Also noticed that after every bootloader reboot I have to manually unlock the bootloader.
Thanks


C:\Program Files (x86)\Android\android-sdk\platform-tools\hammerhead-mmb29q>fastboot oem unlock
...
OKAY [ 6.837s]
finished. total time: 6.838s

C:\Program Files (x86)\Android\android-sdk\platform-tools\hammerhead-mmb29q>fastboot erase boot
erasing 'boot'...
OKAY [ 0.217s]
finished. total time: 0.217s

C:\Program Files (x86)\Android\android-sdk\platform-tools\hammerhead-mmb29q>fastboot erase cache
******** Did you mean to fastboot format this partition?
erasing 'cache'...
OKAY [ 0.216s]
finished. total time: 0.216s

C:\Program Files (x86)\Android\android-sdk\platform-tools\hammerhead-mmb29q>fastboot erase recovery
erasing 'recovery'...
OKAY [ 0.220s]
finished. total time: 0.220s

C:\Program Files (x86)\Android\android-sdk\platform-tools\hammerhead-mmb29q>fastboot erase system
******** Did you mean to fastboot format this partition?
erasing 'system'...
OKAY [ 0.212s]
finished. total time: 0.212s

C:\Program Files (x86)\Android\android-sdk\platform-tools\hammerhead-mmb29q>fastboot flash bootloader bootloader-hammerhead-hhz12k.img
< waiting for any device >
target reported max download size of 1073741824 bytes
sending 'bootloader' (3120 KB)...
OKAY [ 0.296s]
writing 'bootloader'...
FAILED (remote: flash write failure)
finished. total time: 0.496s

C:\Program Files (x86)\Android\android-sdk\platform-tools\hammerhead-mmb29q>fastboot reboot-bootloader
rebooting into bootloader...
OKAY [ 0.002s]
finished. total time: 0.003s


C:\Program Files (x86)\Android\android-sdk\platform-tools\hammerhead-mmb29q>fastboot oem unlock
...
OKAY [ 7.949s]
finished. total time: 7.949s

C:\Program Files (x86)\Android\android-sdk\platform-tools\hammerhead-mmb29q>fastboot -w update image-hammerhead-mmb29q.zip
target reported max download size of 1073741824 bytes
archive does not contain 'boot.sig'
archive does not contain 'recovery.sig'
archive does not contain 'system.sig'
archive does not contain 'vendor.img'
Creating filesystem with parameters:
Size: 29236371456
Block size: 4096
Blocks per group: 32768
Inodes per group: 8192
Inode size: 256
Journal blocks: 32768
Label:
Blocks: 7137786
Block groups: 218
Reserved block group size: 1024
Created filesystem with 11/1785856 inodes and 156120/7137786 blocks
Creating filesystem with parameters:
Size: 734003200
Block size: 4096
Blocks per group: 32768
Inodes per group: 7472
Inode size: 256
Journal blocks: 2800
Label:
Blocks: 179200
Block groups: 6
Reserved block group size: 47
Created filesystem with 11/44832 inodes and 5813/179200 blocks
--------------------------------------------
Bootloader Version...: HHZ12k
Baseband Version.....: M8974A-2.0.50.2.28
Serial Number........: xxxxxxxxxxxxxxxxxxx
--------------------------------------------
checking product...
OKAY [ 0.100s]
checking version-bootloader...
OKAY [ 0.099s]
checking version-baseband...
OKAY [ 0.099s]
sending 'boot' (9152 KB)...
OKAY [ 0.499s]
writing 'boot'...
OKAY [ 0.761s]
sending 'recovery' (10010 KB)...
OKAY [ 0.568s]
writing 'recovery'...
FAILED (remote: flash write failure)
finished. total time: 2.629s

C:\Program Files (x86)\Android\android-sdk\platform-tools\hammerhead-mmb29q>fastboot erase userdata
******** Did you mean to fastboot format this partition?
erasing 'userdata'...
FAILED (remote: failed to erase partition)
finished. total time: 0.254s

C:\Program Files (x86)\Android\android-sdk\platform-tools\hammerhead-mmb29q>fastboot flash userdata userdata.img
target reported max download size of 1073741824 bytes
erasing 'userdata'...
FAILED (remote: failed to erase partition)
finished. total time: 0.168s

C:\Program Files (x86)\Android\android-sdk\platform-tools\hammerhead-mmb29q>fastboot reboot
rebooting...

finished. total time: 0.001s

C:\Program Files (x86)\Android\android-sdk\platform-tools\hammerhead-mmb29q>
 
Upvote 0
@lifeisfun, are you running the flash-all.sh (or flash-all.bat) scripts or typing the commands in yourself?

If you're running the script, you might want to try to copy / paste the commands manually with a little more time in between them (we've seen this sometimes be helpful).

Also, try making sure you've got a good cable and good connection to your USB port on each end.

One last thing, try using a USB 2.0 port instead of a USB 3.0 port which sometimes seems to be sensitive to fastboot.

Cheers!
 
Upvote 0
Here's what jumps out at me ...

C:\Program Files (x86)\Android\android-sdk\platform-tools\hammerhead-mmb29q>fastboot oem unlock
...
OKAY [ 6.837s]
finished. total time: 6.838s

and

Also noticed that after every bootloader reboot I have to manually unlock the bootloader.

While the actual command to unlock the bootloader is rather quick, in order to complete the phone must completely reboot/reset following unlocking the bootloader, even if it had been previously unlocked and re-locked.

I also don't see anywhere in your log that the bootloader was re-locked, so if you have to continually run the unlock command, it says to me that you really never unlocked the bootloader in the first place, in which case the subsequent failures when attempting to flash various firmware makes perfect sense.

Since you are flashing hammerhead, I assume you have a Nexus 5, but you didn't mention which version of Android it has now. You'll have to forgive me here because I'm an old fart with a memory like a steel seive, but in one of the later versions of android (I thought it was Marshmallow, but it could have been Lollipop) you need to go into settings to allow the bootloader to be unlocked. Humor me and go to settings>developer options and see if there is an option to allow OEM unlocking and if there make sure it's enabled.

I'd also try unlocking manually rather than using a script or a toolkit. It's very simple. First enable USB debugging and plug your phone into your PC. The first time you do this you should see an RSA prompt like this.

nexusae0_Screenshot_2013-02-12-11-47-41_thumb.png


If you saw that already and checked always allow, then you're golden, otherwise check the always allow this time and tap OK. Now power down your phone, press and hold Vol. down, up and power all at the same time until the fastboot menu appears. Then plug in your phone (or if was already plugged into your pc, just set it down).

On your PC (Windows or Linux) or Mac, open a command prompt/terminal window and navigate to where fastboot.exe resides.

Code:
CD C:\users\yourname\Desktop\mini-sdk\sdk-tools\

That's assuming windows, and you are using the mini SDK extracted to your desktop.

Type
Code:
>fastboot devices
just to make sure your phone is being seen by your PC. You will see a serial number. If it's blank then we need to work on that. Assuming you're connected type
Code:
>fastboot oem unlock
and you should see a warning pop up on your phone which you must accept to proceed. It's rather dire, but all it's going to do is factory reset and then reboot with an unlocked bootloader.

Once that completes, then you're good to flash your firmware. Let us know how you make out.
 
Upvote 0
^^^ Great feedback, as always, Luna! :) [I didn't catch the part about him having to unlock the bootloader each time...]

I don't believe there's the requirement for the N5 to enable fastboot unlocking in the Settings app...my N6 was the first device that I had to do that for (pretty sure, but I'm getting old, too ;) :p :D). So, perhaps this is not an N5 we're dealing with? :eek:

Also, just to follow-up to my reply from last night...I only see that @lifeisfun did the "fastboot reboot-bootloader" once in the above and I'm pretty darned sure that the flash-all.* scripts insert that in several places (presumably to "clean the pipes", etc. (technical stuff :p) and insert a requisite pause in the process).

That was also the gist of my asking/encouraging you to issue the commands manually.

So, @lifeisfun, please verify for us that you are indeed trying to flash an LG Nexus 5 and then also try to make sure you follow all of the steps (i.e., especially the reboot-bootloader steps) from the flash-all.* script as the proper template (copy/paste them manually in lieu of invoking the script, though).
 
Upvote 0
Thanks for confirming my senility SA. ;)

I've never had an N5 so while Lollipop on the 4 didn't have it, wasn't sure about the 5 ... I went right from the N4 to the N6 and I'll give that up when you pry it from my cold, dead fingers. :D (or the next Nexus comes out with an app that detects coffee withing 100 yards of the phone. ;)

As for rebooting the bootloader, I'm pretty sure you only need to do that following flashing a new bootloader and the radios. You can flash system, recovery, cache and user partitions without a refresh.
 
Upvote 0
Here's what jumps out at me ...



and



While the actual command to unlock the bootloader is rather quick, in order to complete the phone must completely reboot/reset following unlocking the bootloader, even if it had been previously unlocked and re-locked.

I also don't see anywhere in your log that the bootloader was re-locked, so if you have to continually run the unlock command, it says to me that you really never unlocked the bootloader in the first place, in which case the subsequent failures when attempting to flash various firmware makes perfect sense.

Since you are flashing hammerhead, I assume you have a Nexus 5, but you didn't mention which version of Android it has now. You'll have to forgive me here because I'm an old fart with a memory like a steel seive, but in one of the later versions of android (I thought it was Marshmallow, but it could have been Lollipop) you need to go into settings to allow the bootloader to be unlocked. Humor me and go to settings>developer options and see if there is an option to allow OEM unlocking and if there make sure it's enabled.

I'd also try unlocking manually rather than using a script or a toolkit. It's very simple. First enable USB debugging and plug your phone into your PC. The first time you do this you should see an RSA prompt like this.

nexusae0_Screenshot_2013-02-12-11-47-41_thumb.png


If you saw that already and checked always allow, then you're golden, otherwise check the always allow this time and tap OK. Now power down your phone, press and hold Vol. down, up and power all at the same time until the fastboot menu appears. Then plug in your phone (or if was already plugged into your pc, just set it down).

On your PC (Windows or Linux) or Mac, open a command prompt/terminal window and navigate to where fastboot.exe resides.

Code:
CD C:\users\yourname\Desktop\mini-sdk\sdk-tools\

That's assuming windows, and you are using the mini SDK extracted to your desktop.

Type
Code:
>fastboot devices
just to make sure your phone is being seen by your PC. You will see a serial number. If it's blank then we need to work on that. Assuming you're connected type
Code:
>fastboot oem unlock
and you should see a warning pop up on your phone which you must accept to proceed. It's rather dire, but all it's going to do is factory reset and then reboot with an unlocked bootloader.

Once that completes, then you're good to flash your firmware. Let us know how you make out.
Thanks for reply guys, I wish I could enable debugging, the device (N5) won't boot after google OTA update, clearing cache gives error that it can't be mounted. ( E: failed to mount /cache invalid argument) Factory reset also not working
That's why I tried this.
The first update from Lollipop to Marshmallow was fine but the one after ended in this mess.

Bootloader HHZ12k
6.0.1/MMB29K/2419427 shows in recovery
 
Last edited:
Upvote 0
@lifeisfun can you do me a favor and boot into your bootloader and run the command: fastboot getvar all
and copy/paste the results here for me? I'd like to check a few things out in those results and see where we can go from there.
C:\Program Files (x86)\Android\android-sdk\platform-tools>fastboot getvar all
(bootloader) max-download-size: 0x40000000
(bootloader) version-hardware: rev_11
(bootloader) version-baseband: M8974A-2.0.50.2.28
(bootloader) version-bootloader: HHZ12k
(bootloader) version-cdma: N/A
(bootloader) variant: hammerhead D820(H) 32GB
(bootloader) serialno: 070a9ce500cac136
(bootloader) carrier: None
(bootloader) secure-boot: yes
(bootloader) unlocked: no
(bootloader) product: hammerhead
(bootloader) partition-size:aboot: 80000
(bootloader) partition-type:aboot: emmc
(bootloader) partition-size:boot: 1600000
(bootloader) partition-type:boot: emmc
(bootloader) partition-size:recovery: 1600000
(bootloader) partition-type:recovery: emmc
(bootloader) partition-size:system: 40000000
(bootloader) partition-type:system: ext4
(bootloader) partition-size:userdata: 6ce9fa800
(bootloader) partition-type:userdata: ext4
(bootloader) partition-size:cache: 2bc00000
(bootloader) partition-type:cache: ext4
(bootloader) partition-size:persist: 1000000
(bootloader) partition-type:persist: ext4
all:
finished. total time: 0.052s

BTW you are doing me a favor Brian, and I'll appreciate that! :)
 
Upvote 0
Thank you for that! I mostly wanted to verify your bootloader state and it confirmed that it is locked. So without being able to boot into the device to enable unlocking, I'm not sure that you will be able to flash the system via fastboot...

It still sounds like you haven't tried manually flashing the images though. Rather than running: fastboot -w update "name of zip file" have you tried extracting the contents of that zip file and manually flashing each image?
fastboot flash system system.img
fastboot flash boot boot.img
fastboot flash recovery recovery.img
fastboot flash cache cache.img


Although from what you showed earlier, it looks like it is failing to write images probably due to a locked bootloader. Also note that the system.img takes some time to flash so you wouldn't want to move on unless it says it's finished in the command prompt.

Since you had a problem after an OTA update, it sounds like something went wrong during the update, unfortunately and now you are sort of in a limbo. No way to unlock the bootloader to flash factory images.

There may be some hope for you, though. Using LG Flashtool, you can flash directly to the emmc which will work even when fastboot is not an option. I've never used this method, as unlocking the bootloader is always the first thing I do, so I've always been able to flash factory images via fastboot but if you are feeling up to the challenge, you may be a perfect candidate to try using the LG Flashtool.

You can find a thorough guide, all downloads, and video tutorials in this thread HERE. It may be your only option short of sending the device in. Now that guide hasn't been updated in awhile and it looks like the firmware downloads are probably for an older version of your device. But if it gets the device up and running you could then unlock the bootloader and flash the latest factory images.
 
Upvote 0
I did try all this

"It still sounds like you haven't tried manually flashing the images though. Rather than running: fastboot -w update "name of zip file" have you tried extracting the contents of that zip file and manually flashing each image?
fastboot flash system system.img
fastboot flash boot boot.img
fastboot flash recovery recovery.img
fastboot flash cache cache.img"

but without success since the bootloader always shows locked again after reboot

Will try the LG tool


THANKS!
 
Last edited by a moderator:
  • Like
Reactions: scary alien
Upvote 0
Stuck again :(
I can't get the LG drivers going, tried on two laptops one of them didn't have any android device ever connected but the phone is still detected as MTP Android device. (Followed the instructions, holding volume up key while connecting to USB port All I get is battery charging icon)

Looks like I same problem as this guy:
http://forum.xda-developers.com/showpost.php?p=64976158&postcount=161
 
Upvote 0
Grrrrr... Can anything go right?! :p

Can you open up device manager on your computer and see if your device shows up as anything there?


Also, to be sure, you are attempting to enter download mode from a powered off state? Then holding volume+ and connecting the usb cable to your device?

Also, what version of Windows are you running? Are you using a usb 2.0 port? Have you tried using a different usb cable?
 
  • Like
Reactions: lunatic59
Upvote 0
Grrrrr... Can anything go right?! :p

Can you open up device manager on your computer and see if your device shows up as anything there?


Also, to be sure, you are attempting to enter download mode from a powered off state? Then holding volume+ and connecting the usb cable to your device?

Also, what version of Windows are you running? Are you using a usb 2.0 port? Have you tried using a different usb cable?
Yeah, tried all that, followed exactly the guide posted, in device manager only MTP Android device. Tried USB2 and USB3 ports, no difference. If I hold volume up I get only Battery charging symbol and then blank screen. All on windows 10.
 
Upvote 0
Sadly no but even the guy who did the youtube tutorial is using W8
I think the problem could be that the phone is not switching to the proper mode pushing volume up. Perhaps it was changed in the firmware after OS updates.
You are correct. After looking through the thread some more, I see that LG removed download mode in the bootloader version your phone is on. I'm running out of ideas here.

Can you still access recovery mode? It's probably a long shot, but about the only thing I can think to try at this point is to attempt a factory reset from recovery mode and hope that the device will boot up.

Before you start
If your device is running Android 5.1 or higher

To ensure that it's really you doing the reset, you'll need to enter a Google username and password associated with the device after factory reset. If you don't have this information, you won't be able to use the device at all after factory reset.

  • If you recently reset your Google Account password, wait 72 hours before performing the factory reset.
  • If you haven't added a Google Account to your device, your device isn't protected in this way and you won't need a Google username and password to use your device after factory reset.
All devices

  • Back up your data to your Google Account
    Make sure that your data is backed up to your Google Account and you're ready to restore your data.
  • Plug your device into a power source
    Performing a factory reset on your Nexus 5 may take some time. Make sure that you plug in your phone before starting the factory reset.
  • Make sure you have an Internet connection
    You'll need to be connected to sign in to your Google Account.
Reset your device
If your phone becomes unresponsive at any point during these steps, you can restart it by holding down the Power button for several seconds.

  1. If your phone is on, turn it off.
  2. Press and hold the Volume Down and Volume Up buttons, and then, while holding them, also press and hold the Power button until the phone turns on. You'll see the word "Start" with an arrow around it.
  3. Press the Volume Down button twice to highlight "Recovery."
  4. Press the Power button to start Recovery mode. You'll see an image of an Android robot with a red exclamation mark and the words "No command."
  5. Press and hold the Power button. While holding Power, press and release the Volume Up button once.
  6. Press the Volume Down button 4 times to highlight "Wipe data/factory reset," and press the Power button to select it.
  7. Press the Volume Down button once to highlight "Yes" and press the Power button to select it.
  8. After the reset is complete, press the Power button to select the option to reboot your device.
When you're done, follow these steps to restore your data.
 
Upvote 0
You are correct. After looking through the thread some more, I see that LG removed download mode in the bootloader version your phone is on. I'm running out of ideas here.

Can you still access recovery mode? It's probably a long shot, but about the only thing I can think to try at this point is to attempt a factory reset from recovery mode and hope that the device will boot up.
Tried that, it will delete everything fine but then it gets stuck on the cache error again.
Makes me wonder why they removed it.
 
Upvote 0
Hi!
This has been a huge help... lots of system image trouble with an unlocked T-mobile phone. You saved me.
I did have one hiccup... I couldn't get the command prompt to tell me I had successfully installed the radio image (Step 10). It seems to be working fine now, but thought it might be the old 5.1.1 radio image it was working off of. I then loaded up the four scripts independently...
fastboot flash system system.img
fastboot flash boot boot.img
fastboot flash recovery recovery.img
fastboot flash cache cache.img
Is there something I'm missing? Just feeling like this is going too well and that I must have missed a step.
Thanks!
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones