• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[REF][GUIDE][11/03/2012] Unlocking the Bootloader

Search This thread

TheDarkDefender

Senior Member
Aug 5, 2012
4,092
6,434
30
Reston, VA
-This guide is going to help you with step-by-step instructions that will get you an unlocked bootloader on your Nexus 4.

-Keep in mind that unlocking the bootloader will erase all the data on your phone (every single thing, including internal storage), hence it is preferable to unlock the bootloader when the phone is new, as then you don’t have to go through the hassle of re-installing everything.

Compatibility

This guide is applicable only for the LG Nexus 4. Do not try this on any other device.

Warning!

The methods and procedures discussed here are considered risky and you should not attempt anything if you don’t know completely what it is. If any damage occurs to your device, I won’t be held liable.

How to Unlock Bootloader on Nexus 4

1. Backup everything on your phone, including the data on the internal storage, as unlocking the bootloader will erase every single thing on the phone.

2. Download and install the Android SDK → from here. This will install the necessary drivers for the phone on your computer. ( The drivers for your phone can be installed manually by other methods too, they are mandatory ) For the fastboot driver to install (and for fastboot commands to work), your device must be booted in fastboot mode.

3. Download Fastboot, which will be used for unlocking the bootloader.
Download Fastboot here .

4. Extract the Fastboot.zip file on your computer to get a folder named Fastboot with four files inside it. To keep things easy, extract the Fastboot folder to your C: drive.

5. Turn off your Nexus 4. Then, boot into fastboot mode by holding down the Volume down and Power buttons together till the screen turns on and shows “Start” written in big green letters.

6. Then, connect your Nexus 4 to the computer with your USB cable, then wait for Windows to finish installing the drivers (drivers will be installed only the first time). For reliability, ensure that you use a USB port at the back if you are using a desktop computer, as the front panel ports can be loose and cause problems.

7. Click on Start menu » All Programs » Accessories » right-click on Command Prompt and click on Run as administrator. If you are using Windows 8, this can be done by right-clicking on the extreme bottom left corner of the taskbar, then selecting “Command Prompt (admin)”

8. Now, perform the following steps in the command prompt to unlock the bootloader (check the screenshot after step 8.3 for reference)
8.1. Navigate to the Fastboot folder which you obtained in step 4. For example, if the Fastboot folder is in drive C on your computer, enter cd C:\Fastboot in command prompt (and press Enter) to navigate to the folder.
8.2. Then, enter fastboot devices. If your Nexus 4 has been detected properly, you will see a device ID show up in command prompt. If nothing comes up, make sure you have installed the drivers (step 2).
8.3. Finally, to unlock the bootloader, enter fastboot oem unlock in command prompt. You will get a prompt on the phone asking whether you want to unlock the bootloader. Just select Yes. Remember that this will wipe all your data, so make sure you took a backup.

nexus-4-bl-unlock-ss.jpg

9. The phone will then reboot, and once it starts up, you can set up your phone.

10. To re-lock the bootloader, simply follow the entire procedure again from step 5 to 8, but in step 8.3, enter fastboot oem lock. This will re-lock the bootloader.


The bootloader on your Nexus 4 is now unlocked, and you can start installing custom ROMs and make other modifications to the phone. Have fun!

SOURCE
 
Last edited:

ZeDestructor

Senior Member
Apr 12, 2011
333
59
-This guide is going to help you with step-by-step instructions that will get you an unlocked bootloader on your Nexus 4.

-Keep in mind that unlocking the bootloader will erase all the data on your phone (every single thing, including internal storage), hence it is preferable to unlock the bootloader when the phone is new, as then you don’t have to go through the hassle of re-installing everything.

Compatibility

This guide is applicable only for the LG Nexus 4. Do not try this on any other device.

Warning!

The methods and procedures discussed here are considered risky and you should not attempt anything if you don’t know completely what it is. If any damage occurs to your device, I won’t be held liable.

How to Unlock Bootloader on Nexus 4

1.Backup everything on your phone, including the data on the internal storage, as unlocking the bootloader will erase every single thing on the phone.

2.Download and install the Android SDK → from here. This will install the necessary drivers for the phone on your computer.

3.Download Fastboot, which will be used for unlocking the bootloader.
Download Fastboot here

4.Extract the Fastboot.zip file on your computer to get a folder named Fastboot with four files inside it. To keep things easy, extract the Fastboot folder to your C: drive.

5.Turn off your Nexus 4. Then, boot into fastboot mode by holding down the Volume down and Power buttons together till the screen turns on and shows “Start” written in big green letters.

6.Then, connect your Nexus 4 to the computer with your USB cable, then wait for Windows to finish installing the drivers (drivers will be installed only the first time). For reliability, ensure that you use a USB port at the back if you are using a desktop computer, as the front panel ports can be loose and cause problems.

7.Click on Start menu » All Programs » Accessories » right-click on Command Prompt and click on Run as administrator. If you are using Windows 8, this can be done by right-clicking on the extreme bottom left corner of the taskbar, then selecting “Command Prompt (admin)”

8.Now, perform the following steps in the command prompt to unlock the bootloader (check the screenshot after step 8.3 for reference)
8.1.Navigate to the Fastboot folder which you obtained in step 4. For example, if the Fastboot folder is in drive C on your computer, enter cd C:\Fastboot in command prompt (and press Enter) to navigate to the folder.
8.2Then, enter fastboot devices. If your Nexus 4 has been detected properly, you will see a device ID show up in command prompt. If nothing comes up, make sure you have installed the drivers (step 2).
8.3Finally, to unlock the bootloader, enter fastboot oem unlock in command prompt. You will get a prompt on the phone asking whether you want to unlock the bootloader. Just select Yes. Remember that this will wipe all your data, so make sure you took a backup.

nexus-4-bl-unlock-ss.jpg

9.The phone will then reboot, and once it starts up, you can set up your phone.

10.To re-lock the bootloader, simply follow the entire procedure again from step 5 to 8, but in step 8.3, enter fastboot oem lock. This will re-lock the bootloader.


The bootloader on your Nexus 4 is now unlocked, and you can start installing custom ROMs and make other modifications to the phone. Have fun!

SOURCE

Exact same as Nexus S and GNex: Go to bootloader, run "fastboot oem unlock"
 
  • Like
Reactions: K'Tag

killman2659

Senior Member
Mar 26, 2012
923
225
Illinois, USA
I'm going to be doing this as soon as I get my N4. Hopefully they get sold out so I can wait a few days and CM will be released so I won't have to worry about setting everything up coming from stock :)
 

wngmv

Senior Member
Sep 9, 2009
670
95
I'm going to be doing this as soon as I get my N4. Hopefully they get sold out so I can wait a few days and CM will be released so I won't have to worry about setting everything up coming from stock :)

How can you be sure that the CM devs got their phones? I don't think they have special channels do they? :D

On a separate note,

Awesome. First thing to do when I get that thing delivered. (and hopefully don't brick it.)
 

eep2378

Senior Member
Aug 12, 2010
6,337
2,209
MA
Correct me if I'm wrong, but you can root without unlocking the bootloader, right? If so, why the need?
 

FISKER_Q

Senior Member
Feb 25, 2009
437
115
An example being.....? I guess I'm just looking for clarification. Why not just root then flash custom roms, kernels, etc? I've never owned a Nexus device so never really needed to unlock bootloader.

To get root you need root access, this does not come standard with Android, therefor the only supported way to get root access is by unlocking the bootloader, flashing an insecure boot image and installing the superuser files manually. A locked bootloader should prevent flashing of the insecure boot image, and Linux should prevent unauthorized users from becoming root, in the case of Android that means everybody.

However that is of course far from the reality, there are various vulnerabilities in the Linux Kernel and Android that can allow elevation which in turn then allows installation of the superuser binaries and the superuser android app. That in turn will usually allow flashing of custom recoveries, but a properly locked/secure bootloader can actually prevent changes to those partitions regardless of root access, i believe there's been a few of such devices in the past.
 

eep2378

Senior Member
Aug 12, 2010
6,337
2,209
MA
That's what I figured. Thanks. My current device(s2) there was no need to unlock bootloader to gain root access.
 
Oct 30, 2012
35
1
What do you suggest I backup with? I thought a full nandroid backup could only be done once rooted?

Sent from my Galaxy Nexus using xda premium
 

Top Liked Posts

  • There are no posts matching your filters.
  • 74
    -This guide is going to help you with step-by-step instructions that will get you an unlocked bootloader on your Nexus 4.

    -Keep in mind that unlocking the bootloader will erase all the data on your phone (every single thing, including internal storage), hence it is preferable to unlock the bootloader when the phone is new, as then you don’t have to go through the hassle of re-installing everything.

    Compatibility

    This guide is applicable only for the LG Nexus 4. Do not try this on any other device.

    Warning!

    The methods and procedures discussed here are considered risky and you should not attempt anything if you don’t know completely what it is. If any damage occurs to your device, I won’t be held liable.

    How to Unlock Bootloader on Nexus 4

    1. Backup everything on your phone, including the data on the internal storage, as unlocking the bootloader will erase every single thing on the phone.

    2. Download and install the Android SDK → from here. This will install the necessary drivers for the phone on your computer. ( The drivers for your phone can be installed manually by other methods too, they are mandatory ) For the fastboot driver to install (and for fastboot commands to work), your device must be booted in fastboot mode.

    3. Download Fastboot, which will be used for unlocking the bootloader.
    Download Fastboot here .

    4. Extract the Fastboot.zip file on your computer to get a folder named Fastboot with four files inside it. To keep things easy, extract the Fastboot folder to your C: drive.

    5. Turn off your Nexus 4. Then, boot into fastboot mode by holding down the Volume down and Power buttons together till the screen turns on and shows “Start” written in big green letters.

    6. Then, connect your Nexus 4 to the computer with your USB cable, then wait for Windows to finish installing the drivers (drivers will be installed only the first time). For reliability, ensure that you use a USB port at the back if you are using a desktop computer, as the front panel ports can be loose and cause problems.

    7. Click on Start menu » All Programs » Accessories » right-click on Command Prompt and click on Run as administrator. If you are using Windows 8, this can be done by right-clicking on the extreme bottom left corner of the taskbar, then selecting “Command Prompt (admin)”

    8. Now, perform the following steps in the command prompt to unlock the bootloader (check the screenshot after step 8.3 for reference)
    8.1. Navigate to the Fastboot folder which you obtained in step 4. For example, if the Fastboot folder is in drive C on your computer, enter cd C:\Fastboot in command prompt (and press Enter) to navigate to the folder.
    8.2. Then, enter fastboot devices. If your Nexus 4 has been detected properly, you will see a device ID show up in command prompt. If nothing comes up, make sure you have installed the drivers (step 2).
    8.3. Finally, to unlock the bootloader, enter fastboot oem unlock in command prompt. You will get a prompt on the phone asking whether you want to unlock the bootloader. Just select Yes. Remember that this will wipe all your data, so make sure you took a backup.

    nexus-4-bl-unlock-ss.jpg

    9. The phone will then reboot, and once it starts up, you can set up your phone.

    10. To re-lock the bootloader, simply follow the entire procedure again from step 5 to 8, but in step 8.3, enter fastboot oem lock. This will re-lock the bootloader.


    The bootloader on your Nexus 4 is now unlocked, and you can start installing custom ROMs and make other modifications to the phone. Have fun!

    SOURCE
    13
    This is not just directed at the OP:

    I think people should wait until they get a hold of the device before posting guides and directing others on what to do. Unless you actually try something and it works, I wouldn't be posting any guides.

    Just to clarify some mis-information in this thread:

    1) You do not need to install the SDK (and you do not need it to install the driver) -- the SDK is just a bunch of stuff that, unless you are developing, you will never need;
    2) The driver for the N4 may not even be included in the SDK -- the GNex driver certainly wasn't;
    3) For the fastboot driver to install (and for fastboot commands to work), your device must be booted in fastboot mode;
    4) USB Debugging is a feature of Android, and to use it, you have to be booted into Android -- it has nothing to do with the bootloader;
    5) Currently, there is no exploit to gain root on any build of Android higher than 4.1.1, so, there is no way to gain root without unlocking the bootloader at this time.
    9
    An example being.....? I guess I'm just looking for clarification. Why not just root then flash custom roms, kernels, etc? I've never owned a Nexus device so never really needed to unlock bootloader.

    To get root you need root access, this does not come standard with Android, therefor the only supported way to get root access is by unlocking the bootloader, flashing an insecure boot image and installing the superuser files manually. A locked bootloader should prevent flashing of the insecure boot image, and Linux should prevent unauthorized users from becoming root, in the case of Android that means everybody.

    However that is of course far from the reality, there are various vulnerabilities in the Linux Kernel and Android that can allow elevation which in turn then allows installation of the superuser binaries and the superuser android app. That in turn will usually allow flashing of custom recoveries, but a properly locked/secure bootloader can actually prevent changes to those partitions regardless of root access, i believe there's been a few of such devices in the past.
    4
    [snip]

    I will unlock the bootloader as soon as I open it out of the box.
    :good:

    1) After unlocking the bootloader, will that change the default(stock) apps/ widgets which comes on the phone
    No.

    2) Do I still have to flash the super user and recovery (TWRP/ CWM) in order to do nandroid backups?
    Root is not required, but you need to flash (or boot) a custom recovery like CWM or TWRP to do a nandroid.

    If yes- I presume there would be some guide later on in this thread?
    As I mentioned earlier, have a look at the links in my signature. They are for the Galaxy Nexus, but for all intents and purposes, they will be the same for the Nexus 4. I will "port" them over here once I get the device.
    4
    Has this been tested and verified to work on an N4 ? Or is it just guesswork based on previous devices, and therefore a little premature ? (E.g. the discussion about whether USB debugging is necessary is a prime example).

    Sent from my HTC Vision using xda premium

    It is the same for all nexus devices.

    The USB debugging is only neccessary for using adb to reboot the phone, which is technically an optional step on all of the devices.

    So all it boils down to is whether you:

    1. Reboot the device into the bootloader manually. (I.e. the combo of the physical buttons + power on)
    2. Issue the "fastboot oem unlock" command.
    3. Following onscreen directions on the phone.

    or

    1. Enable USB debugging.
    2. Reboot the device into the bootloader by issuing the "adb reboot bootloader" ccommand
    3. Issue the "fastboot oem unlock" command.
    4. Following onscreen directions on the phone.