How to Unlock and Lock the Nexus 7 Bootloader

unlocking-or-locking-the-nexus-7-bootloader

Those who are new to Android often wonder what is a bootloader and what difference does a locked or unlocked bootloader make. Locked bootloaders are the bane of customization on Android. They prevent you from installing a custom OS on your device. Any attempt to install a custom ROM with a locked bootloader is an easy way to get your device bricked. Why take the risk? Unlock the bootloader before getting a shiny new ROM for your device.

If you are wondering what the unlocking process actually does to your device, here it is. On unlocking, the device is reset to factory settings and any data, documents, photos and other files which are not backed up are completely erased. The data backups you have should be saved to the cloud or on your computer as the internal storage of the device is also erased. In simple terms, the device would reach the same state it was in when you first unboxed it except for the unlocked bootloader.

Carriers and OEMs go to lengths to prevent the unlocking of your device. Things have been improving lately as OEMs give in to the users’ demand and the new devices come with an unlocked or easily unlockable bootloader. As for Nexus devices, the simple fastboot unlocking method works well. Let’s see the basic setup and Android Debug Bridge (ADB) commands needed to unlock your device.

The basic setup before unlocking

Enable USB debugging

Go to “Settings > Developer options > Debugging” and enable USB debugging.

enable-usb-debugging-from-settings

Tip: If you do not see Developer options, you would need to enable them. Go to “About tablet” and tap on “Build number seven times.” Yes that’s the way it’s done. You need to tap seven times to enable developer options. You would get a notice that tells you that you are a certain number of taps away from becoming a developer.  On the 7th tap you will get a toast notification saying that “You are now a developer” and developer options would be available under Settings.
tap-build-number-enable-dev-options

Set up Android SDK and ADB

ADB allows you to send commands to your Android device from the command prompt and perform various actions. It comes as a part of Android SDK, which Google has made really easy for users to set up. Download the Android Development Tools (ADT) Bundle for Windows or for another platforms, unzip it at your desired location and navigate to the platform-tools folder. This folder would contain adb.exe as well as fastboot.exe files.

Shift and right-click the folder and choose “Open command window here.”
open-command-prompt-in-that-folder

Nexus 7 device drivers

I often connect my Nexus 7 to PC as a portable device and transfer data without any issue. However, I got an error saying device not found while using the adb commands. To avoid this error, you need to get the Android Composite ADB Interface driver for Nexus 7, unzip and manually install it from Windows device manager.

(Note: I am using Windows 8. You may or may not need the drivers for other editions of Windows. Please check before installing)
update-device-driver-for-nexus-7

Updating the device drivers should also solve the ‘Waiting for device’ error encountered by some users.

Unlock Nexus 7 bootloader

Connect the Nexus 7 tablet to PC via USB. If you get a popup with the computer’s RSA fingerprint and asks for permission to allow USB debugging, tap  “OK.”

Give the below command to reboot the tablet into bootloader:

adb reboot bootloader

Notice that the lock state is seen to be locked.

nexus-7-fastboot-mode-android

Type the below command to start unlocking:

fastboot oem unlock

The device then asks for confirmation before unlocking. By default, Yes is selected. Confirm by pressing the “Power button.”

Warning: Unlocking a bootloader completely resets the device.  All apps, data and files in the internal storage are removed.

confirm-bootloader-unlock-for-nexus-7

The device then takes a few moments to factory reset and unlock the bootloader. Once done, the lock state should now be unlocked.

device-lock-status-for-nexus-7

Here’s a image of the command prompt with the ADB commands we used and unlocking stages as reported by the device.

adb-commands-and-prompt-updates-while-unlocking-nexus-7

Press the “Power button” to boot and do the initial setup of the device.

Lock the Nexus 7 bootloader

If you wish to lock the bootloader of Nexus 7 after you have unlocked it, follow the below steps.

Reboot the tablet into bootloader by typing the below command:

adb reboot bootloader

Type the below command to lock the device:

fastboot oem lock

You will get  a message in the command prompt confirming that the bootloader is locked now.

adb-command-for-locking-an-unlocked-bootloader-on-nexus-7

The lock state gets updated to locked again. In the above image, you can see it was previously unlocked.

device-lock-status-for-nexus-7

Unlocking the bootloader: The need and the risks

Not everybody needs an unlocked bootloader. If you like to tinker with your device and customize to a large extent, unlocking the bootloader is the way to go. There is also the factor of voiding the device warranty when you unlock it and you are warned to that effect during the process. If you are too concerned about the warranty, you are probably better off with a locked bootloader.

Also, though this process is demonstrated on a Nexus 7 tablet, it should work with all Nexus devices.

Have you unlocked your tablet yet? Did you encounter any errors except those mentioned above? Share your thoughts and problems with us in the comments below.



  • Ste

    my bootloader will not unlock?

    I had a few issues with random shut downs and was getting concerned.

    After searches found a reset may help

    got into bootloader
    into recovery and tried a factory reset

    the unit stopped at wiping /data
    A press of buttons changed this to the android dude with a swirling tummy. Left this to no joy

    Started again. this time cleared cache. This had the same error. (just sat there)

    Then i got an error indicated the E:failed to mount /cache (invalid argument)

    So, i decided to look a bit further and unlocking the unit seemed to be the only way i was going to fix this….
    problem is it wont let me unlock my bootloader

    i get
    C:google>fastboot oem unlock

    (bootloader) erasing userdata…
    (bootloader) erasing userdata done
    (bootloader) erasing cache…
    (bootloader) erasing cache done
    (bootloader) unlocking…
    FAILED (remote: (Unknown error code))
    finished. total time: 1.614s

    the unit is still locked

    i now have a nexus 7 that will boot into bootloader, recovery
    so i can adb sideload,

    sideload gives

    E:failed to mount /cache (invalid argument)
    E:failed to set up expected mounts for install; aborting
    installation aborted
    E:failed to mount /cache (invalid argument)
    E:cant mount /cache/recovery/log
    E:cant open /cache/ recovery/log
    E:failed to mount /cache (invalid argument)
    E:cant mount /cache/recovery/last_log
    E:cant open /cache/recovery/last_log
    E:failed to mount /cache (invalid argument)
    E:cant mount /cache/recovery/last_install
    E:cant open /cache/recovery/last_install
    E:failed to mount /cache (invalid argument)
    E:cant mount /cache/recovery/log
    E:cant open /cache/ recovery/log
    E:failed to mount /cache (invalid argument)
    E:cant mount /cache/recovery/last_log
    E:cant open /cache/recovery/last_log
    E:failed to mount /cache (invalid argument)
    E:cant mount /cache/recovery/last_install
    E:cant open /cache/recovery/last_install

    can get to fastboot

    i have tried flash from fastboot etc

    i have tried formatting the cache to rebuild???

    here is what i got

    C:google>fastboot erase cache
    erasing ‘cache’…
    OKAY [ 3.071s]
    finished. total time: 3.076s

    C:google>fastboot format cache
    formatting ‘cache’ partition…
    Creating filesystem with parameters:
    Size: 464519168
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 7088
    Inode size: 256
    Journal blocks: 1772
    Label:
    Blocks: 113408
    Block groups: 4
    Reserved block group size: 31
    Created filesystem with 11/28352 inodes and 3654/113408 blocks
    sending ‘cache’ (9052 KB)…
    FAILED (remote: Bootloader is locked.)
    finished. total time: 0.304s