[TUTORIAL][GUIDE][HOW TO] Flash Factory Images || Unroot || Relock bootloader

Are you Happy buying Nexus 6 ?

  • Yes ofcourse

    Votes: 1,374 87.3%
  • Not really

    Votes: 122 7.8%
  • May be in future

    Votes: 78 5.0%

  • Total voters
    1,574
Search This thread

Mr hOaX

Senior Member
Jan 30, 2014
1,071
2,588
Heya Nexus 6 Users,

In this thread, I'll help you to flash factory images on your nexus 6. This process will wipe your device, so please BACKUP YOUR DATA before going through the flashing process.

You can backup your data from some well-known apps from Play Store

- Titanium Backup (Root)
- Super Backup (Non-root)
- Helium (Non-root) etc


I am not responsible if anything goes wrong.


Step 1 : Pre-requisite

==> Setup your workspace by following step two from this (Credits @xBeerdroiDx)

==> For MAC users, you can follow this thread (Credits @AshtonTS)

==> For Linux users, you can follow this thread (Credits @bloodychaos)


Step 2 : Downloading Factory Images

==> You can find Nexus 6(shamu) factory images from here.


Step 3 : Extracting Factory Images

==> Extract the archive you downloaded (First extract shamu-XXXXX.tgz and then extract shamu-XXXXX.tar). You can use WinRaR or 7z etc. It should look like this

XTNNqMd.png



Step 4 : Unlock the bootloader

==> Follow this thread. (Credits @xBeerdroiDx)


Step 5 : Flashing

==> Method 1 : (Short and Sweet)

- Power off your phone.

- Boot it in fastboot(bootloader mode) by pressing and holding Power Button + Volume Down at the same time.

- Connect your phone to your PC through your USB cable.

- Execute the flash-all.bat script (for Windows) or flash-all.sh(for MAC and LINUX) in the folder where you extracted the factory images.
**!!** For MAC: You'll have to edit the flash-all.sh, and add "./" before every fastboot command.

(For windows users)

h355rHW.png


- Wait for everything to flash.

- After everything finished, select "Recovery" using the volume buttons.

- When a small dead Android appears, press Power Button + Volume UP.

- Select "Wipe data/factory data reset"

- Reboot. Your phone should be stock.





==> Method 2 : (Long, but works always)

- Extract the image-shamu-XXXXXX.zip somewhere easy to access (On C:/image-shamu-XXXXXX for example).
- In the same folder, from the original archive, extract "bootloader-shamu-moto-XXXXXX.img" (rename it to bootloader.img) and "radio-shamu-XXXXXX.img" (rename it to radio.img). You will have the following files:

vWX7X5f.png


- Power off your phone.

- Boot it in fastboot(bootloader mode) by pressing and holding Power Button + Volume Down at the same time.

- Connect your phone to your PC through your USB cable.

- Open a CMD window.(By pressing shift key + right mouse click at same time)

- Type the following commands, in this order (If you have a different folder, change the path)

Code:
fastboot flash bootloader C:/image-shamu-XXXXXX/bootloader.img
fastboot reboot-bootloader
fastboot flash radio C:/image-shamu-XXXXXX/radio.img
fastboot reboot-bootloader
fastboot flash system C:/image-shamu-XXXXXX/system.img
fastboot flash userdata C:/image-shamu-XXXXXX/userdata.img 
(Note: this command will wipe your device (including /sdcard), EVEN if your bootloader is already unlocked.)

fastboot flash boot C:/image-shamu-XXXXXX/boot.img
fastboot flash recovery C:/image-shamu-XXXXXX/recovery.img
fastboot erase cache
fastboot flash cache C:/image-shamu-XXXXXX/cache.img

- After everything finished, select "Recovery" using the volume buttons.

- When a small Android appears, press Power Button + Volume UP.

- Select "Wipe data/factory data reset"

- Reboot. Your phone should be stock.

(Credits @abaaaabbbb63)

(Credits @Chirag_Galani for testing it :p )

Please consider downloading a free/paid version of my ANDROID APP

Hit thanks if you appreciate my efforts and if this thread helped you at any moment :) :D



Video Guides

Thanks Anuj Patel

For Windows:


For MAC:

 
Last edited:

Mr hOaX

Senior Member
Jan 30, 2014
1,071
2,588
>> Quick FAQs <<

Q1. Do I need to root the device before flashing?
Ans. NO

Q2. Will I loose device root status after flashing?
Ans. YES

Q3. Do I need to unlock bootloader before flashing?
Ans. YES

Q4. Can I skip any of the above steps in any method?
Ans. NO

Q5. Do I need to tick USB Debugging in Developer options before flashing?
Ans. NO (Answer corrected by @samersh72)

Q6. My device is not detected in my PC. What should I do?
Ans. Reinstall the drivers properly.

Q7. Can I root my device after flashing process?
Ans. YES

Q8. Which method is recommended for me?
Ans. Method 2 if you are not expert in flashing.

Q9. What will be my device status after flashing?
Ans. Stock Android with bootloader unlocked

Q10. My device is taking time to boot up. What should I do now?
Ans. Wait for 10-15 mins before thinking of reflashing.

Q11. My phone has 3GB RAM, can I flash factory images directly without using PC?
Ans. NO

Q12. How many times can I flash my device?
Ans. More than 0

Q13. Will I loose my data after flashing?
Ans. YES

Q14. I have some other query...
Ans. Please post it in Q&A section.

Q15. I am noob in all this. I am flashing for the very first time. Can you provide me support online via any software?
Ans. Follow each step as mentioned in first post. You'll be 100% successful.

Q16. What will be status of bootloader after flashing?
Ans. Unlocked

Q17. What is fastboot mode?
Ans. Bootloader mode.

Q18. Can I take screenshot of my bootloader mode using power+volume down?
Ans. NO

Q19. Any other easy way to flash?
Ans. If there was, I would have mentioned it.

Q20. Do you recommend me using toolkits to do this job?
Ans. NO

Q21. Can I connect my device over the air and flash it from PC?
Ans. NO

Q22. I don't have my device USB right now. Can I flash using other compatible USB cable?
Ans. YES

Q23. I have installed the drivers properly, still it's not recognized by my PC?
Ans. Use other USB port

Q24. How do I relock bootloader after flashing? (For 5.0.X)
Ans. Follow this. (Credits @BRKotucs)

Q25. I am having problems with unzipping the file. Can you help me?
Ans. Read this (Credits @av8rdude)

Q26. I am unable to get into stock recovery, what should I do?
Ans. Read this (Credits @jj14 and @WMguy)

Q27. It shows 32GB storage for 64GB storage device after flashing, where is my 32GB lost ?
Ans. Read this (Credits @efrant)

Q28. I need some information on adb and fastboot, what are those commands ?
Ans. Read this (Credits @rootSU)


Q29. Will I get OTA updates from Google after successfully completing any of the above methods ?
Ans. YES (Do not root or alter any system files)

Q30. I want to relock the bootloader after flashing? (For 5.1.X)
Ans. Follow this. (Credits @Evolution_Freak)

Q31. Can I flash back to Android version 5.0.1 if I'm on Android version 5.1?
Ans. NO
 
Last edited:

abaaaabbbb63

Senior Member
Nov 19, 2011
3,896
3,425
Somewhere Over The Rainbow
Hi!

I have a suggestion. Instead of constantly updating the thread for every factory image that might be released in the future, you might want to replace things like "lrx21o" to a more universal name, so users aren't confused about it.

Also, try using this link for the factory images. It links directly to the shamu ones:
https://developers.google.com/android/nexus/images#shamu

Anyways, good job!
 
  • Like
Reactions: Mr hOaX

njd.sina

Senior Member
May 18, 2011
92
16
My Sprint Nexus 6 has a submenu in settings for updating profile and PRL. Would this still be there if I use the Factory Images or is that an addition Sprint made to their phones? Thanks
 

bdubs4200

Senior Member
Oct 18, 2010
1,721
265
when i get to the dead android power+VOL UP doesnt do anything... it just reboots and has been booting for the last 10 mins. i had to do the long method also, the flash all file stopped at system.img also
 

bajasur

Retired Forum Moderator
Sep 19, 2012
4,042
10,523
San Clemente
when i get to the dead android power+VOL UP doesnt do anything... it just reboots and has been booting for the last 10 mins. i had to do the long method also, the flash all file stopped at system.img also

+1

I fixed this by following instructions above, replacing recovery.img with latest twrp then booting into twrp to do factory reset.

After doing factory reset power off phone and then reboot. Fixed my issue
 
Last edited:

veritas2884

Senior Member
Mar 1, 2011
70
11
Baltimore
Can you flash the stock firmware onto the Att branded version with the bloat ware and effectively make it a google play edition?
 

BinarySauce

Senior Member
Oct 20, 2012
58
3
Vancouver
Kind of a neat freak here:
I know dalvik is dead, but are there still any caches to wipe to make things perfectly clean after flashing?
 

jae2014

Senior Member
Apr 16, 2014
98
13
The archive for the Nexus 6 I downloaded looks different. When I unpacked the tar file I only have this file shamu-lrx21o-factory-e028f5ea

How do I flash it? I'm a noob at adb commands
 

stas333

Senior Member
Feb 2, 2008
1,672
469
i followed the instructions in this thread. went back to stock, then when i rooted again. the bootloader was still unlocked and the phone was still rooted. how can i completely go back to stock. im having issues with the phone and need to take it to the store.
thanks
 

BRKotucs

Senior Member
Feb 3, 2011
5,896
13,951
Houston, Tx
i followed the instructions in this thread. went back to stock, then when i rooted again. the bootloader was still unlocked and the phone was still rooted. how can i completely go back to stock. im having issues with the phone and need to take it to the store.
thanks

What exactly did you do?

Flashing the images is good enough to go back to stock, then relock the boot loader to finish up the task.

Sent from my Nexus 7 using Tapatalk
 

Top Liked Posts

  • There are no posts matching your filters.
  • 198
    Heya Nexus 6 Users,

    In this thread, I'll help you to flash factory images on your nexus 6. This process will wipe your device, so please BACKUP YOUR DATA before going through the flashing process.

    You can backup your data from some well-known apps from Play Store

    - Titanium Backup (Root)
    - Super Backup (Non-root)
    - Helium (Non-root) etc


    I am not responsible if anything goes wrong.


    Step 1 : Pre-requisite

    ==> Setup your workspace by following step two from this (Credits @xBeerdroiDx)

    ==> For MAC users, you can follow this thread (Credits @AshtonTS)

    ==> For Linux users, you can follow this thread (Credits @bloodychaos)


    Step 2 : Downloading Factory Images

    ==> You can find Nexus 6(shamu) factory images from here.


    Step 3 : Extracting Factory Images

    ==> Extract the archive you downloaded (First extract shamu-XXXXX.tgz and then extract shamu-XXXXX.tar). You can use WinRaR or 7z etc. It should look like this

    XTNNqMd.png



    Step 4 : Unlock the bootloader

    ==> Follow this thread. (Credits @xBeerdroiDx)


    Step 5 : Flashing

    ==> Method 1 : (Short and Sweet)

    - Power off your phone.

    - Boot it in fastboot(bootloader mode) by pressing and holding Power Button + Volume Down at the same time.

    - Connect your phone to your PC through your USB cable.

    - Execute the flash-all.bat script (for Windows) or flash-all.sh(for MAC and LINUX) in the folder where you extracted the factory images.
    **!!** For MAC: You'll have to edit the flash-all.sh, and add "./" before every fastboot command.

    (For windows users)

    h355rHW.png


    - Wait for everything to flash.

    - After everything finished, select "Recovery" using the volume buttons.

    - When a small dead Android appears, press Power Button + Volume UP.

    - Select "Wipe data/factory data reset"

    - Reboot. Your phone should be stock.





    ==> Method 2 : (Long, but works always)

    - Extract the image-shamu-XXXXXX.zip somewhere easy to access (On C:/image-shamu-XXXXXX for example).
    - In the same folder, from the original archive, extract "bootloader-shamu-moto-XXXXXX.img" (rename it to bootloader.img) and "radio-shamu-XXXXXX.img" (rename it to radio.img). You will have the following files:

    vWX7X5f.png


    - Power off your phone.

    - Boot it in fastboot(bootloader mode) by pressing and holding Power Button + Volume Down at the same time.

    - Connect your phone to your PC through your USB cable.

    - Open a CMD window.(By pressing shift key + right mouse click at same time)

    - Type the following commands, in this order (If you have a different folder, change the path)

    Code:
    fastboot flash bootloader C:/image-shamu-XXXXXX/bootloader.img
    fastboot reboot-bootloader
    fastboot flash radio C:/image-shamu-XXXXXX/radio.img
    fastboot reboot-bootloader
    fastboot flash system C:/image-shamu-XXXXXX/system.img
    fastboot flash userdata C:/image-shamu-XXXXXX/userdata.img 
    (Note: this command will wipe your device (including /sdcard), EVEN if your bootloader is already unlocked.)
    
    fastboot flash boot C:/image-shamu-XXXXXX/boot.img
    fastboot flash recovery C:/image-shamu-XXXXXX/recovery.img
    fastboot erase cache
    fastboot flash cache C:/image-shamu-XXXXXX/cache.img

    - After everything finished, select "Recovery" using the volume buttons.

    - When a small Android appears, press Power Button + Volume UP.

    - Select "Wipe data/factory data reset"

    - Reboot. Your phone should be stock.

    (Credits @abaaaabbbb63)

    (Credits @Chirag_Galani for testing it :p )

    Please consider downloading a free/paid version of my ANDROID APP

    Hit thanks if you appreciate my efforts and if this thread helped you at any moment :) :D



    Video Guides

    Thanks Anuj Patel

    For Windows:


    For MAC:

    22
    >> Quick FAQs <<

    Q1. Do I need to root the device before flashing?
    Ans. NO

    Q2. Will I loose device root status after flashing?
    Ans. YES

    Q3. Do I need to unlock bootloader before flashing?
    Ans. YES

    Q4. Can I skip any of the above steps in any method?
    Ans. NO

    Q5. Do I need to tick USB Debugging in Developer options before flashing?
    Ans. NO (Answer corrected by @samersh72)

    Q6. My device is not detected in my PC. What should I do?
    Ans. Reinstall the drivers properly.

    Q7. Can I root my device after flashing process?
    Ans. YES

    Q8. Which method is recommended for me?
    Ans. Method 2 if you are not expert in flashing.

    Q9. What will be my device status after flashing?
    Ans. Stock Android with bootloader unlocked

    Q10. My device is taking time to boot up. What should I do now?
    Ans. Wait for 10-15 mins before thinking of reflashing.

    Q11. My phone has 3GB RAM, can I flash factory images directly without using PC?
    Ans. NO

    Q12. How many times can I flash my device?
    Ans. More than 0

    Q13. Will I loose my data after flashing?
    Ans. YES

    Q14. I have some other query...
    Ans. Please post it in Q&A section.

    Q15. I am noob in all this. I am flashing for the very first time. Can you provide me support online via any software?
    Ans. Follow each step as mentioned in first post. You'll be 100% successful.

    Q16. What will be status of bootloader after flashing?
    Ans. Unlocked

    Q17. What is fastboot mode?
    Ans. Bootloader mode.

    Q18. Can I take screenshot of my bootloader mode using power+volume down?
    Ans. NO

    Q19. Any other easy way to flash?
    Ans. If there was, I would have mentioned it.

    Q20. Do you recommend me using toolkits to do this job?
    Ans. NO

    Q21. Can I connect my device over the air and flash it from PC?
    Ans. NO

    Q22. I don't have my device USB right now. Can I flash using other compatible USB cable?
    Ans. YES

    Q23. I have installed the drivers properly, still it's not recognized by my PC?
    Ans. Use other USB port

    Q24. How do I relock bootloader after flashing? (For 5.0.X)
    Ans. Follow this. (Credits @BRKotucs)

    Q25. I am having problems with unzipping the file. Can you help me?
    Ans. Read this (Credits @av8rdude)

    Q26. I am unable to get into stock recovery, what should I do?
    Ans. Read this (Credits @jj14 and @WMguy)

    Q27. It shows 32GB storage for 64GB storage device after flashing, where is my 32GB lost ?
    Ans. Read this (Credits @efrant)

    Q28. I need some information on adb and fastboot, what are those commands ?
    Ans. Read this (Credits @rootSU)


    Q29. Will I get OTA updates from Google after successfully completing any of the above methods ?
    Ans. YES (Do not root or alter any system files)

    Q30. I want to relock the bootloader after flashing? (For 5.1.X)
    Ans. Follow this. (Credits @Evolution_Freak)

    Q31. Can I flash back to Android version 5.0.1 if I'm on Android version 5.1?
    Ans. NO
    14
    So, after following instructions fully, not skipping any step from method 2, my 64Gb shows up as a 32Gb. Any ideas?
    Reboot into the bootloader and type this:

    fastboot format userdata
    fastboot format cache
    fastboot reboot

    That will obviously wipe all your data again, but it should return back to 64GB
    9
    //Reserved

    If you want me to include anything in OP or in second post, please quote me on this thread with needed information.
    6
    HOW DO I LOCK THE BOOTLOADER?

    Before you get started you need to make sure Android boots properly then go to.... Settings / Developer Options / to "ENABLE" OEM Unlocking



    Lock The Bootloader
    • Turn the phone off. Then boot it into the bootloader/fastboot mode by holding volume down + power.

    • Plug the phone into your PC, then open a command prompt window and type:
      Code:
      cd Desktop/android-sdk-windows/platform-tools
      Code:
      fastboot devices
      This command will list the connected devices. If your phones serial number shows up you are good to go and may continue. If the phone is NOT listed this indicates that your drivers are not installed correctly. In order for you to continue you must fix your drivers so that your phone is listed under fastboot devices.

    • If the phone has been recognized by the command above, proceed to locking the bootloader with the following command:
      Code:
      fastboot oem lock

    • After the above command has finished executing, run the following command.
      Code:
      fastboot reboot

      Done.
    • Close the command prompt window.

    Sent from my Nexus 6 using Tapatalk