How to install the Marshmallow factory image on your Nexus device

android_6-0_marshmallow_mini

The much anticipated Android 6.0 Marshmallow update is here, and Google just recently posted the factory images for its supported Nexus devices. The company did announce that the OTA is rolling out, but that can take weeks, if not longer, to get to everybody. This is largely because companies roll out these updates in stages. That way if there’s something wrong, it only affects a small group of people instead of everybody with that device.

If you’re not into waiting around, we’ve got a handy guide on flashing the factory image on your Nexus device after the break!

Setting things up

One thing to keep in mind is that you will lose all of your data. Flashing Marshmallow on your device requires your bootloader to be unlocked, and in the process of unlocking the bootloader, your device will be wiped of all of its data. That said, the first and most important step to flashing Marshmallow is to ensure all of your data is backed up. If your bootloader is unlocked already, you won’t need to worry about losing any data, and we’ll detail how that’s done in this guide. Still, it’s best to backup than to have not at all. Go back up that data!

Next, you’ll need to install ADB and Fastboot to your computer in order to flash the Marshmallow factory images. If you’re on Windows, you can install the much quicker Minimal ADB and Fastboot; however, the Android SDK tools also include the Google USB drivers, which are very handy. That said, we’ll show you how to go through both.

Installing Minimal ADB and Fastboot:

  • Download Minimal ADB and Fastboot from the XDA Developer Forums
  • Open the downloaded file
  • When prompted, install to C:\android-sdk\platform-tools

Installing the Android SDK:

As mentioned earlier, the Android SDK is the more surefire way to get ADB and Fastboot, considering that you can also get the Google USB drivers at the same time. It’s a more lengthy process, but just as easy:

  • You’ll need to download the Android SDK Tools from Google. The Android Developers website primarily advertises the Android Studio package, but you can just get the Android SDK Tools at the bottom of the page for your desired operating system.
  • Follow the wizard and install to C:\android-sdk
  • Launch the SDK Manager
  • Unselect all packages except for Android SDK Platform-tools and Google USB driver
  • Install your packages.

That’s it! Now we just need the factory images.

Getting factory images

You can download the latest Marshmallow factory image from the Google Developers website. Generally, the latest version of Android will be found at the bottom of the list under each device. Just be very careful to make sure you’re downloading the correct version for your device. For example, you don’t want to attempt to install a Nexus 7 (2013) factory image on a Nexus 5. You must install the Nexus 5 factory image on a Nexus 5.

The most recent version of Android will always be at the bottom of the list, so you can go through the same process with this guide when there’s an Android 6.1 version or something of the sort.

Extracting factory images

You’ll need to download 7 Zip or use any similar program, such as WinRAR, to extract the contents of the .tgz file you just downloaded (the factory image). Once you’ve gone through the setup wizard of installing that, you can follow the following steps to extract the contents of the .tgz file:

  • Launch 7-Zip and navigate to the directory the your factory image is in.
  • Double click the .tgz file to reveal another file with a .tar file extension.
  • Open the .tar file, and you should find the folder with your devices codename (e.g. hammerhead, shamu, and so on). Open the file.
  • Select all the files that appear, and extract them. Use the destination C:\program files\(x86)androidandroid-sdkplatform-tools (if you installed the full SDK) or the directory Minimal ADB and Fastboot are installed in.

Preparing to flash

The first step is to go into your device’s Settings menu and enable USB debugging in Developer Options near the bottom of the menu. If you don’t see Developer Options anywhere in your Settings, Google has some documentation on how to make them visible:

To access these settings, open the Developer options in the system Settings. On Android 4.2 and higher, the Developer options screen is hidden by default. To make it visible, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options at the bottom.

If you went the route of installing Minimal ADB and Fastboot, you’ll need to follow this process:

  • Download the official Google USB Driver from Google Developers
  • Install the USB Drivers
  • Remember the location of the drivers after extracting the .zip file.

Now, we’re ready to plug the device in. Connect it via USB cable, and if this is the first time you’ve connected it to your computer, you might get an RSA prompt on your Nexus device. Just check the “Always allow for this computer” box, select OK, and we’re good to go.

Flashing Marshmallow on your Nexus device

Preliminary instructions for Mac users:

These instructions are intended for Windows users, however, getting them to work on a Mac is very similar. The only real differences is that you’ll need to open Terminal on Mac (as opposed to Command Prompt) and add a “./” in front of the commands you type in Terminal. Additionally, you’ll need to add the platform tools to your $PATH directory on Mac.

The process is simple:

  1. Open Terminal
  2. Type sudo nano/etc/paths
  3. Enter your password
  4. Type in the path of your platform tools directory
  5. Hit control-x on your keyboard to quit and to save changes

You should now be able to follow the flashing instructions below without any issues on Mac. Just be sure to remember to add that “./” in front of your Terminal commands.

Flashing instructions:

  1. With your computer connected to your Nexus device via USB and USB debugging enabled, you’ll need to restart in fastboot mode. You can type adb reboot bootloader (just add a ./ in front of your command on Mac) in Command Prompt to do this. Alternatively, you can use your device’s button commands.
  2. Enter fastboot oem unlock to unlock your device.
  3. Enter flash-all
  4. Your device will reboot with the latest version of Android Marshmallow.

Congrats, you have Android Marshmallow before most of the world!

If you have unlocked the bootloader already, follow these instructions below:

  1. With your computer connected to your Nexus device via USB and USB debugging enabled, you’ll need to restart in fastboot mode. You can type adb reboot bootloader in Command Prompt to do this. Alternatively, you can use your device’s button commands.
  2. You need to edit the flash-all.bat file you extracted from the factory image. Locate the file (should be in the same spot as ADB and Fastboot). Open it in any text editor and remove the -w in the line where you see fastboot -w update
  3.  Enter flash-all in Command Prompt

Congratulations! The update should begin to install, and once it’s done, all you need to reboot.

Welcome to Marshmallow!

What to do if you encounter a missing system.img error:

You will need to extract all the files in the .zip file, extracted from the factory image we downloaded from Google earlier.. The file name should begin with “image.” In this file will be many of the .img files you need, which we are going to flash individually to hopefully avoid that system.img error.

It’s pertinent you flash the following steps in an outlined order, obviously replacing “nameofyourfile” with the actual file name. Also, keep in mind the Mac instructions outlined earlier if commands aren’t working. Just enter the commands below in Command Prompt, and then you should be good to go!

  1. fastboot flash bootloader nameofyourfile.img
  2. fastboot flash radio nameofyourfile.img
  3. fastboot reboot-bootloader
  4. fastboot flash recovery recovery.img
  5. fastboot flash boot boot.img
  6. fastboot flash system system.img

If you’re flashing Marshmallow on a Nexus 9, you’ll also need to add the  fastboot flash vendorvendor.img command after step 6. 

Closing

After successfully following these steps, you should now be able to enjoy all that Marshmallow brings to your device. If Google ever releases an update, you can follow this same process with the updated factory image.

In the meantime, let us know what you think of Marshmallow in the comments below!


About the Author: Brad Ward

Brad is a tech enthusiast, writing and tinkering with all things technology since 2011. He currently bounces between the LG G3 and his beloved Moto X! His interests include reading, entrepreneurship, the gym, and of course, queso.