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

How To Install Android M on Nexus 6

steve

Developer
Administrator
Android M Developer Preview on Nexus 6

Prerequisites
  • Common understanding and experience using tools that are provided with the Android SDK such as Fastboot and ADB.
  • Fastboot and ADB installed on your system and PATH variables updated accordingly.
  • Understand that this will wipe all of your device data and that you will first need to backup any files, apps, etc that you do not want to lose!
  • You will also obviously need a Nexus 6. Do not try any images on devices they are not intended for as it will cause issues and not work!
WARNING Installing a system image on your device will remove all data from the device. Please make sure that you backup your data before you proceed. Also, keep in mind that these images are not final releases and may have bugs or unfinished features. These are Developer Previews and not meant for the average consumer.

Step 1 – Unlock your bootloader in Developer options
Please continue to the next step if you already have your bootloader unlocked. If not, or you forget whether or not it’s unlocked, I will walk you through the process.

Enable OEM unlocking (aka unlock your bootloader)
  1. Go into Settings -> Developer options on your device.
    If you do not see Developer options listed in this list, please click on About phone and keep tapping on Build number until you see “You are now a developer”. What this means is you now have a Developer options in your main Settings list. Please go to Settings -> Developer options now.
  2. Once you are in Developer options, look for OEM unlocking. This is a simple switch or checkbox that you need to enable. It will prompt you to Allow OEM unlocking and give you a warning message. Please click the enable to accept and continue.
Step 2 – Download the Nexus 6 specific image
Below is the direct link to download the Android M preview images. This is only for the Nexus 6!
Step 3 – Decompress the image file
All of the necessary image files that you will need are located in this “tgz” compressed file.

Windows Users
You will need to install a third-party tool to extract this gzip tar file and we recommend 7-zip. It’s free and works great but does NOT treat .tar.gz extract as one atomic operation. You will first extract the main .tgz file and the result will be a .tar file. Use 7-zip again to extract one more level and you will now see actual files.

If you already setup 7z as a system path variable, you can use one command in command prompt (aka cmd.exe) for this (obviously update the path and names as needed):

Code:
7z e shamu-MPZ44Q-preview-c1d6506a.tgz && 7z x shamu-MPZ44Q-preview-c1d6506a.tar

Mac and Linux Users
Using tar which is built in to OS X, open the terminal and you can extract using one command:

Code:
tar -zxvf shamu-MPZ44Q-preview-c1d6506a.tar.gz

Below is what you should see once you have files extracted.
Screen Shot 2015-06-03 at 9.57.55 PM.png


Step 4 – Reboot bootloader and flash
Assuming that you have fastboot and adb already set up and ready to use, just follow the commands below in order.

Code:
adb reboot bootloader

This will restart your phone into the bootloader mode. This will only work if your phone is connected and you have USB debugging turned on.

Code:
fastboot oem unlock

If your phone is already OEM Unlocked, you would not have to do this, but it wouldn't hurt if you are unsure.

Code:
bash flash-all.sh

This will run all of the fastboot commands needed for the complete image flash. If you are using Windows, rather than a bash script you will use the flash-all.bat (batch) file. One common issue for running fastboot, regardless of your OS, not working is that you do not have fastboot setup properly and is not set as an environment variable (a variable that works system wide).

Windows users
There are reports from some Windows users that the flash-all.bat fails. It seems that it’s a bug with the fastboot.exe and how it inefficiently allocates memory. Some users say to try a different usb port or different usb cable, which they claim doing so solved their issues. If this works for you, please let us know in the comments below. Otherwise, please follow the workaround below that KingofPing has provided that will most likely solve your issues. What this does is break down each step manually that the batch file should have automatically done for you. (if you open the batch file in a text editor, you will see these same commands)

Make sure you extract the zip file in your directory that you extract it and place it’s contents in your working directory.

After flash-all.bat errors out, please follow these instructions:

—Don’t “press any key” – that will close the window – just hit Ctrl-C.—

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

That’s it!
Once the scripts finish it will do a final reboot and the only thing left is to complete the normal Android setup wizards and enjoy. If you have any issues feel free to comment and we will help you out as needed!

Get Involved
If you are testing on your device make sure you help the Android community out and post any bugs you find. You can share your experiences here, or join the Dev community over on G+ to stay involved.

> Report Android M Issues > Android M Developer Community

src: How to install Android M on the Nexus 5, 6, 9, and Player
 
Yeah I think will wait for the official update, I would brick a $650 phone and my replacement would be a $9.99 non Android, simple flip phone
 
Yeah I think will wait for the official update, I would brick a $650 phone and my replacement would be a $9.99 non Android, simple flip phone

Fortunately, its very hard to actually brick a nexus device, since Google gives us everything we need to recover from software or "soft" bricks.

The developer preview builds have some quirks that still need to be ironed out (thats why they are previews! ;)), so I wouldn't recommend it for use as a daily driver.
 
Last edited:
I caved and flashed the new OTA to the phone. It was actually pretty easy. I've never flashed a ROM before, but followed the instructions here. My phone did NOT work with the .bat file, but doing each of the individual command line steps was a piece of cake. Thank you for your write up on this. BTW, the first phone I did took about 20 minutes (including ADB and fastboot installs). The second phone took about 5 minutes.
 
I'd like any tips from people who've done this successfully and where you got the factory image, etc.

I tried decrypting one and it didn't go well at all. Need some trusted sources for upgrading to Android 6.0 Marshmallow. I don't know when Google plans on sending me the update and as of now Lollipop 5.1.1 is buggy.
 
You can indeed sideload an OTA (over-the-air (official) update), but not a full factory image.

OTAs are typically "incremental" and you need to find the one that matches/supports/allows upgrading from the version of Android you're currently on.

Factory images are one-stop shopping and contain everything.

Take a look at this page, it's got flashing instructions at the top:


Take note of the prominent warning:

Caution: Flashing a new system image deletes all user data. Be certain to first backup any personal data such as photos.
and make sure you grab the proper image for your device.

We've also got a thread here at AF that talks about how to do this:


That might help and fill-in the gaps that the first thread assumes.

Cheers and best of luck!

:)
 
You can indeed sideload an OTA (over-the-air (official) update), but not a full factory image.

OTAs are typically "incremental" and you need to find the one that matches/supports/allows upgrading from the version of Android you're currently on.

Factory images are one-stop shopping and contain everything.

Take a look at this page, it's got flashing instructions at the top:


Take note of the prominent warning:

Caution: Flashing a new system image deletes all user data. Be certain to first backup any personal data such as photos.
and make sure you grab the proper image for your device.

We've also got a thread here at AF that talks about how to do this:


That might help and fill-in the gaps that the first thread assumes.

Cheers and best of luck!

:)
Thanks for the info. I'm slowly getting there. Just need to get Marshmallow for LMY48Y. Would LMY48T work as well or do I need to specifically find the one with Y at the end?

I feel like such a noob. Don't want to mess anything up this time.
 
Well, if you have a Nexus 6 (code name "shamu") then wouldn't you want the latest / most current version of MarshMallow?

That would be 6.0.1 (MMB29K).

The LMY48# versions were all Lollipop.

Don't be too hard on yourself...it's all new to someone / everyone at one point in time :).

How about I also move your thread over to our Nexus 6 area for you?

There are some great folks in there that can help guide you and answer any other device-specific questions you may have.

(I have a Nexus 5 and while similar, I'd want you to get the best, most appropriate advice from those that actually have first-hand knowledge with this device :)).
 
Well, if you have a Nexus 6 (code name "shamu") then wouldn't you want the latest / most current version of MarshMallow?

That would be 6.0.1 (MMB29K).

The LMY48# versions were all Lollipop.

Don't be too hard on yourself...it's all new to someone / everyone at one point in time :).

How about I also move your thread over to our Nexus 6 area for you?

There are some great folks in there that can help guide you and answer any other device-specific questions you may have.

(I have a Nexus 5 and while similar, I'd want you to get the best, most appropriate advice from those that actually have first-hand knowledge with this device :)).
Thanks. I'm now downloading the shamu mmb29k factory image.

Luckily the phone is fairly new so it won't take too long to set everything back up. I hear the 6.0 updates are limited by carriers and AT&T users haven't gotten it yet. Should have changed to Verizon...

Ok I'm so close...I think.

I'm to the last step in the command prompt when I'm supposed to enter 'adb sideload otaupdate.zip' which is what I renamed the image to.

It's saying it can't read otaupdate.zip. Ugh...lol
 
Last edited by a moderator:
Ok I'm so close...I think.

I'm to the last step in the command prompt when I'm supposed to enter 'adb sideload otaupdate.zip' which is what I renamed the image to.

It's saying it can't read otaupdate.zip. Ugh...lol

Ah, remember what I posted above...you can only sideload an OTA, but not a factory image.

You'll need to follow the "Flashing Instructions" in the Factory Images page link that I provided above and/or follow the instructions in @jhawkkw's AF Nexus flashing thread (also linked above).
 
Ok I'll redo all this tomorrow after getting some sleep. I've been following these instructions and it keeps saying it can't read the file when I type in the sideload command prompt (step #27).

http://www.androidexplained.com/nexus-6-sideload-android-6-0-marshmallow/

(btw I tried the OTA download in the above link...can't read it so I'll try the instructions here for flashing the image)

So, did you download the appropriate OTA file referenced in step #21 of that page? After you download that file, you'll rename it to otaupdate.zip (as referenced in step #24).

Reminder / note that this is a wholly different procedure than the links I provided above that use / work-with a factory image file.

Just want to make sure you're not mixing metaphors and processes / files here...

P.S. / edit: by the way, it looks like the OTA update .zip file(s) in that thread assume that you're currently on build number LMY48T (5.1.1) or a current 6.0 (MRA58K) version. If you are still on a 5.x version you must be on the LMY48T to use the files referenced in the link you gave, otherwise, the sideload install will fail with a "Package expects build fingerprint of google/shamu/shamu:5.1.1/LMY48T/2237560:user/release-keys or google/shamu/shamu:6.0/MRA58K/2256973:user/release-keys; this device has <whatever your device has>" error.
 
Last edited:
So, did you download the appropriate OTA file referenced in step #21 of that page? After you download that file, you'll rename it to otaupdate.zip (as referenced in step #24).

Reminder / note that this is a wholly different procedure than the links I provided above that use / work-with a factory image file.

Just want to make sure you're not mixing metaphors and processes / files here...

P.S. / edit: by the way, it looks like the OTA update .zip file(s) in that thread assume that you're currently on build number LMY48T (5.1.1) or a current 6.0 (MRA58K) version. If you are still on a 5.x version you must be on the LMY48T to use the files referenced in the link you gave, otherwise, the sideload install will fail with a "Package expects build fingerprint of google/shamu/shamu:5.1.1/LMY48T/2237560:user/release-keys or google/shamu/shamu:6.0/MRA58K/2256973:user/release-keys; this device has <whatever your device has>" error.
Yeah I followed those instructions exactly. I'm scrapping that now and going with the method in the developers.google link you provided.

I'm up to this step:

  1. If necessary, unlock the device's bootloader by running:
    fastboot oem unlock
    The target device will show you a confirmation screen. (This erases all data on the target device.)
  2. Open a terminal and navigate to the unzipped system image directory.
  3. Execute the flash-all script. This script installs the necessary bootloader, baseband firmware(s), and operating system.

The bootloader is unlocked and I got the confirmation screen and selected yes. I'm not sure what it means by "open a terminal and navigate to the unzipped system image directory"...then "execute the flash-all script". I tried going to the factory image then typing "flash-all" command and it said the command isn't recognized.

Thanks for being patient. I think I'm right on the edge of getting it. I did manage to wipe the phone clean (restored to factory settings). :confused:
 
Last edited:
Oh, no worries, @PoloarBlue :) -- you are indeed getting close :).

So, after you've downloaded the .tgz file (that's the factory image), you'll extract the contents (I'm assuming Windows Explorer will extract it for you--I'm currently using Winzip on Windows) to a working folder (say, c:\temp\n6 -- it can be whatever you like).

You'll probably see a main folder in there named "shamu-mmb29k" and that folder contains the "flash-all.bat" script among others.

Then, start-up a Windows Command Prompt (remember, the old DOS window?) and do a "cd" (change directory) to the folder where you extracted the contents of the .tgz (factory image) file to, kind of like this:

C:\>cd temp
C:\temp>cd n6
C:\temp\n6>cd shamu-mmb29k
C:\temp\n6\shamu-mmb29k>

or, if you know the whole path, "cd c:\temp\n6\shamu-mmb29k"​

Since you've got the bootloader unlocked, then you must have the proper fastboot USB drivers (excellent!). Once you're in the proper folder where you extracted the .tgz files (you'll see the flash-all.bat, bootloader-shamu-mmb29k.img, image-shamu-mmb29k.zip, etc.--I'm guessing at these file names since I haven't downloaded the factory image for your device) you can just execute the flash-all.bat file.

Don't forget that this will wipe your device (although the fastboot oem unlock already did that, too).

Make sense?
 
Oh, no worries, @PoloarBlue :) -- you are indeed getting close :).

So, after you've downloaded the .tgz file (that's the factory image), you'll extract the contents (I'm assuming Windows Explorer will extract it for you--I'm currently using Winzip on Windows) to a working folder (say, c:\temp\n6 -- it can be whatever you like).

You'll probably see a main folder in there named "shamu-mmb29k" and that folder contains the "flash-all.bat" script among others.

Then, start-up a Windows Command Prompt (remember, the old DOS window?) and do a "cd" (change directory) to the folder where you extracted the contents of the .tgz (factory image) file to, kind of like this:

C:\>cd temp
C:\temp>cd n6
C:\temp\n6>cd shamu-mmb29k
C:\temp\n6\shamu-mmb29k>

or, if you know the whole path, "cd c:\temp\n6\shamu-mmb29k"​

Since you've got the bootloader unlocked, then you must have the proper fastboot USB drivers (excellent!). Once you're in the proper folder where you extracted the .tgz files (you'll see the flash-all.bat, bootloader-shamu-mmb29k.img, image-shamu-mmb29k.zip, etc.--I'm guessing at these file names since I haven't downloaded the factory image for your device) you can just execute the flash-all.bat file.

Don't forget that this will wipe your device (although the fastboot oem unlock already did that, too).

Make sense?
It makes sense but still not cooperating. I downloaded winzip and extracted the files. Here are a couple screen caps of where I am now:

dd9w5qd.jpg


7T9yxda.jpg


When I select flash-all from the folder it's saying it's not recognized as an internal or external command.
 
It looks like your missing the fastboot utility...how did you unlock the bootloader? You would have had to have had the fastboot utility (fastboot.exe) somewhere to do the "fastboot oem unlock"?

In any case, you can download the following .zip file (our "mini-sdk") and extract that to the same directory / folder that contains the flash-all.bat file:


Then you should be able to have the fastboot utility available to the flash-all.bat script.

(double-check that you can see a file named fastboot.exe and that it is indeed in the same folder as flash-all.bat)

:)
 
It looks like fastboot is not installed (correctly). Did you install the android SDK? Try this out - on a command prompt, type fastboot and see if it returns anything (or does it tell you that fastboot command is not found)?
If it returns all the details about how to use fastboot, plug your phone into your computer, and go into bootloader (power off, and then, press Power and volume down together). Then, on command prompt, type "fastboot devices" (without quotes) and see if it returns the serial number of your phone.

Related note - I haven't ever gotten the flash-all to work right - it would not be able to flash the system.img. I suspect that's because I have an older version of fastboot/android-SDK, so I just use the individual commands to flash the files.

My guess: @PolarBlue must have downloaded fastboot into a directory, but may not have set the path variable to make fastboot.exe accessible when in a different directory.

@PolarBlue - can you elaborate on how you installed fastboot?

You have two options. unzip your factory image files into the same folder where fastboot is located, or make fastboot accessible everywhere.

To make fastboot available everywhere, (Assuming you are running Windows,) try this

  • Press Win + R on your keyboard to bring up the Run dialog. and type in sysdm.cpl and hit Enter:
  • The System Properties panel should open; go to the Advanced tab:
  • Click on Environment Variables:
  • At the Environment Variables window find Path under System variables, click on it, and click the Edit button:
  • In the edit system variable window that pops up, type in ;C:\foldername (wherever your fastboot.exe is located) at the very end and hit OK: Note: Do not delete what is already there - type the ;C:\foldername at the end (don't forget the ";" at the beginning)
  • Click ok/ok...
Now, fastboot command can be executed from anywhere on your computer

Edit: Don't try to execute flash-all from windows explorer by double clicking on it. Open a command prompt to the correct directory and then type in flash-all to execute it.
 
Last edited by a moderator:
Ok I moved fastboot.exe to the same folder as flash-all.

The flash-all command is recognized now, but it says adbwinapi.dll is missing from my computer. I tried putting adb.exe in the same folder, and it still says adbwinapi.dll is missing. Now I need to fix this problem and hopefully it'll take off.

This is driving me crazy. haha. Hope it's worth it.
 
Downloaded adbwinapi.dll and put it in the same folder with everything. Executed flash-all. Now it said "waiting for device" and nothing's happening.

Is this normal? It's in the fastboot screen and says it's unlocked connected to USB.
 
4xLlWv8.jpg


Well it's trying to go through. It gets to this point, the phone goes to a blank screen twice, then says "package is missing system.img" in the command window and prompts me to exit.

It appears system.img is right there. I tried downloading everything and trying again. Same thing. Does it look like I'm missing something in the folder?

Edit: If I click on system or userdata, it says the files are corrupted. I tried deleting them and downloading again. Still says corrupted. When I was downloading the factory image from google it stopped towards the end and said "failed" every time I tried, so maybe that caused it?

I think I'll have to wait for AT&T to allow the freakin official update before I pull my hair out. I've tried this so many ways and nothing seems to work. Maybe there's something wrong with my computer.
 
Last edited:
That error message you got is exactly what I get when I tried to use flash-all.
Here's my suggestion. Extract all the zip files into the folder.
Open the command prompt, (connect phone in bootloader to PC, and first verify that "astboot devices" returns the serial #

Once you verify that, run the following commands in the command prompt (assuming that all the image files are in the same directory as fastboot. Execute the first command, wait for it to complete, and check to see that it was successful (check command prompt window and phone). Then, run the next one.

  • fastboot flash bootloader bootloaderxxxxxxxxxxxx.img (replace bootloaderxxxxxxxxxxxx by the actual long filename)
  • fastboot reboot-bootloader
  • fastboot flash radio radioxxxxxxxxxxxx.img (replace radioxxxxxxxxxxxx by the actual long filename)
  • fastboot reboot-bootloader
  • fastboot flash system system.img
  • fastboot flash boot boot.img
  • fastboot flash recovery recovery.img
  • fastboot format cache
  • fastboot flash cache cache.img
Edit: just noticed you had some download issues - redownload the file - you should not get any errors during the download, else, you risk messing your phone up. You can check the MD5 checksum on the file you downloaded, and verify that it matches what Google provides on their factory image site
 
@PolarBlue , i put a step-by-step for flashing a factory image together for another member here. You've already completed most of it, but you might want to read through it anyway, just make sure you haven't missed something. If you jump to step 6 you'll see the contingency for when things don't work from flash-all bat. FWIW, it never worked for me either except on a Nexus 4.
 
I'll leave this in your very capable hands :).
Capable - LOL! (Not at all... lol!) - now that's scary :)

i put a step-by-step for flashing a factory image together for another member here.
I totally forgot about this exhaustive guide you had!!! :( @PolarBlue - I second that suggestion. That guide is really very detailed, and absolutely everyone who is new to flashing factory images should read it once thru' at least.

The archive does not contain boot.sig and recovery.sig message is all too familiar - fairly confident that using the manual steps will fix that. As @lunatic59 said, you are almost done (the prep work is the complicated part). The actual flashing is just a couple of minutes at the most.

Before doing any of this though. do verify that your factory image downloaded correctly. See the guide that Lunatic59 linked to, to see how to verify MD5.
 
Back
Top Bottom