Skip to content

Instantly share code, notes, and snippets.

@scisco
Last active June 15, 2020 19:00
Show Gist options
  • Save scisco/df4c3cf0e67d8d9df26f to your computer and use it in GitHub Desktop.
Save scisco/df4c3cf0e67d8d9df26f to your computer and use it in GitHub Desktop.
How to root / unroot Nexus 5X

How to root / unroot Nexus 5X

This guide assumes that you have already unlocked the bootloader

Rooting

1- Download latest version of TWRP for Nextus 5X

2- Restart to bootloader

$ adb reboot-bootloader

3- Flash TWRP recovery image

$ fastboot flash recovery twrp-3.0.0-1-bullhead.img

4- Download latest version of SuperSu stable

5- Boot to recovery mode by select the recovery using the volume buttoms

6- Copy the download zipfile to the phone

$ adb push UPDATE-SuperSU-v2.65-20151226141550.zip /sdcard/Download/supersu.zip

7- Go to install menu on TWRP, select the supersu.zip file and swipe to confirm flash

8- Once you've installed SuperSU you'll have an option to wipe cache/dalvik and an option to reboot system. Wipe the cache/dalvik, hit the back button, and hit the reboot system button. That's it.

Done!

Unrooting

Unrooting is needed for installing OTA updates.

1- Download latest build image from here: https://developers.google.com/android/nexus/images#instructions

- Make sure to find the current build number from settings > about

2- Unzip the file

3- Restart to bootloader (USB Debugging should be enabled)

$ adb reboot-bootloader

4- Run the following commands sequentially (You have to change to path/to to the correct path and update the filenames). All the files used in these commands are found in the build image downloaded in step 1

$ fastboot flash bootloader bootloader-bullhead-bhz10k.img
$ fastboot reboot-bootloader
$ fastboot flash radio radio-bullhead-m8994f-2.6.30.0.68.img
$ fastboot reboot-bootloader
$ fastboot flash boot image-bullhead-mmb29q/boot.img
$ fastboot erase cache
$ fastboot flash cache image-bullhead-mmb29q/cache.img
$ fastboot flash recovery image-bullhead-mmb29q/recovery.img
$ fastboot flash system image-bullhead-mmb29q/system.img
$ fastboot flash vendor image-bullhead-mmb29q/vendor.img

5- Restart the device

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment