I've unlocked my Nexus 5 by using CF-Auto-Root. I want to undo my actions and return the device to its original state: unrooted and locked.

How can I do this?

4 Answers 4


You'll need to use fastboot, which is provided in the CF-Auto-Root zip file, and also available standalone and packaged with lots of other software. It's part of the Android SDK Tools / Platform Tools, which can be installed on Windows, OSX, or Linux.

Note: If you've installed a custom ROM or kernel on top of rooting, you'll want to flash the necessary stock versions from the Nexus 5 stock image with fastboot or possibly through TWRP/ClockWorkMod Recovery.

In order to re-lock the bootloader:

  1. Reboot your phone to Bootloader Mode
  2. Connect the USB Cable to your computer.
  3. Open a Command Prompt (Terminal on Linux or OSX)
  4. Navigate to the platform-tools directory inside the unzipped CF-Auto-Root directory.
  5. Use the following command, depending on your OS.

    • Linux: ./fastboot-linux oem lock
    • OSX: ./fastboot-mac oem lock
    • Windows: fastboot-windows.exe oem lock
  • 1
    Would this process work for other phones or just the Nexus 5 due to it being 'unlockable'? (in my case SGS2).
    – Scotty.NET
    Commented Jan 9, 2014 at 10:23
  • 2
    @Scotty.NET It works for many phones, but I doubt it would work on the SGS2. One of Samsung's many modifications has been removing Fastboot and replacing it with Odin. Although some Samsung phones to have minimal Fastboot compatibility.
    – dotVezz
    Commented Jan 9, 2014 at 12:27
  • 6
    Quick update: for the newer versions of platform-tools, fastboot oem lock does not work. They have changed the command to fastboot flashing lock. Commented Oct 27, 2016 at 18:55
  • 1
    showing <waiting for any device> and nothing happens. However I connected my device(moto g) via datacable. Commented Nov 8, 2016 at 8:48
  • 1
    @AdamHurwitz - Yes, I believe that it will wipe the phone data.
    – dotVezz
    Commented Nov 3, 2019 at 19:07

On a rooted device, you can use BootUnlocker to re-lock the bootloader without using fastboot. You can also use it to unlock the bootloader again without wiping data. I use it to keep my bootloader locked most of the time, but unlock it prior to installing a system update or doing anything else that might require re-rooting via fastboot flash.

  • Currently unavailable for my Nexus 5X (running N from the latest OTA).
    – philo
    Commented Mar 9, 2017 at 17:36

You can now do it direct online with Google via PC/Mac. https://flash.android.com/welcome


First of all there is no need to relock bootloader on a Nexus device as their specialty is that they have a unlocked bootloader by default. So maybe u can talk about unrooting.

Refer here : http://en.m.wikipedia.org/wiki/Google_Nexus

  • 10
    The bootloader isn't unlocked by default. It's unlockable, but not unlocked. Beyond that, this doesn't seem particularly helpful. Relocking has its merits in terms if helping to keep your device secure, and the link to Wikipedia doesn't seem to address the question in any way at all. Commented Dec 24, 2013 at 23:47
  • 4
    From the Wikipedia page you linked, emphasis mine: "Devices in the Nexus series do not have manufacturer or wireless carrier modifications to Android (such as customs graphical user interfaces), and have an unlockable bootloader". Also, your assertion that all devices have unlockable bootloaders is just flat out incorrect. That's why it's one of the major specs listed (and a very attractive one for many) of the Nexus line, which is probably why the Wikipedia page points it out specifically. Did you read it? How does it answer the question about relocking the bootloader? Commented Dec 25, 2013 at 14:14
  • 1
    @coolhz - Many devices have an unlockable bootloader, but not all devices. In the case of Nexus phones, they do not come unlocked. I'm pretty sure eldarerathis has done his research - he's both a highly respected member of the community and a moderator.
    – dotVezz
    Commented Dec 26, 2013 at 15:29
  • 1
    Here is a brief sampling of devices with no official bootloader unlock: Droid Ultra, Droid Mini and Droid Maxx (unless you get the "Dev edition" Maxx). The HTC One on Verizon. The Galaxy S4 on AT&T and Verizon (an exploit was found, but there is no out of the box official method; you must rely on a bug in the lock). Commented Dec 26, 2013 at 17:15
  • 1
    And at this point, I think I've said all I really can, so I'm going to leave this be. You can continue to argue your points, but I'd suggest at least finding some sources that support you, aside from the single Wikipedia entry you seem to have either misread or misquoted. I tried to explain what was wrong in the answer as clearly as I could, and the voting seems to support me (as do the references I'm linking to), so I don't think there is anything more I can add. Commented Dec 26, 2013 at 17:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .