yashsingh1/xdaforums huggingface dataset:
[Nexus 5X General] Moto G User:
Nexus 5X encryption

Hello everyone :)

I've just upgraded from a moto g 2015 to the Nexus 5x and I am wanting to root and install a custom kernel. Im familiar with the process of rooting and flashing kernels but this encryption thing is new to me

My question is that when I flash twp and then factory reset the phone to disable encryption(according to the guide), then install superSU, does the encryption remain disabled permanently? I've been reading other threads stating that you need to flash a modified boot.img which has the encryption flag disabled but this guide doesn't mention it

Any info would be appreciated.

Thanks
[Nexus 5X General] ulxerker:
encryption stays disabled as supersu is taking care of it. so make sure to flash supersu after flashing twrp before installing a kernel and booting the first time into OS. you also have to do this after updating ROM images or custom ROMS before booting into OS again. so there is no need for a modified boot.img/kernel.
[Nexus 5X General] Moto G User:
Thanks for the quick reply. Gonna flash franco kernel as soon as I get my "Usb Type C to type A" Cable.
[Nexus 5X General] ulxerker:
yep ... twrp -> supersu -> kernel (i.e. franco or EX) -> boot ... easy as that, oh and have fun with your new Nexus phone :)
[Nexus 5X General] Moto G User:
Nexus FTW :)

Slightly off topic but is there a way to remove the unlocked bootloader image which appears on the initial boot
[Nexus 5X General] ulxerker:
yep, here you go.
[Nexus 5X General] Moto G User:
Thanks for the help. Really appreciate it
[Nexus 5X General] antroid88:
Hi! Has anyone tried to flash ota updates after root with flashfire?
[Nexus 5X General] sfhub:
Root is either installed in boot or in system. Either way the differential OTAs you get over the air will fail. The FULL OTAs you get from the factory image site will work. They'll flash over anything you have.
[Nexus 5X General] antroid88:
Sorry, I'm new to this. So If I rooted the phone, I have to follow step 9 from the first post in order to update the system?
[Nexus 5X General] sfhub:
That's one way you could do it.

I usually just flash boot.img, vendor.img, and system.img (and only flash bootloader and modem if they changed, which is less often)

Alternatively, you could flash just stock boot.img (for your current release), apply the OTA using ADB sideload (or let the OTA install by itself), then reflash twrp.img and re-run SuperSU install.

Another option is to flash the FULL OTA from Google website (as opposed to differential OTA you get over the air) using adb sideload or twrp recovery, then re-root.

It seems like a lot of steps but isn't really that much after you do it once.
[Nexus 5X General] antroid88:
Thank a lot for detailed answer! Will these keep my data or I'll have to restore from a backup?
[Nexus 5X General] sfhub:
Everything I listed above would preserve your user data.

If you need to keep your user data unencrypted, you probably should stick with flashing from bootloader and making sure you never boot into Android until you first install SuperSU (which will disable encryption in the kernel)

Having said that, on the latest releases, I don't really see any practical real world difference between encrypted and unencrypted.
[Nexus 5X General] antroid88:
Thanks a lot for detailed answers!
[Nexus 5X General] Flyview:
So I'm in a similar situation. I had TWRP + SuperSU + elementalX kernel on N Preview 4, but was seeing random reboots so I decided to try the stock kernel again. I totally forgot the device would re-encrypt itself after flashing the stock boot.img, and I also lost root, TWRP, and some changes I made to the thermal config. Why did flashing boot change files in system? Does the system check itself over and revert to stock with a stock boot.img?

To make matters worse, even after re-flashing TWRP (3.0.2) it doesn't work, it freezes on the blue intro screen so I can't even flash SuperSU again to root. Is there a way to decrypt now or do I have to wipe? Is there still a difference in performance between encrypted and decrypted?
[Nexus 5X General] sfhub:
When you flash the stock boot.img unchanged, you lose the changes that disable force encryption. Thus upon first boot, you were encrypted. Also stock boot.img will do a compare and if recovery is modified from what it expects, it will reinstall stock recovery. If you made thermal changes in /system those shouldn't have been touched, but it is possible due to some SELinux permissions that got restored, it ignored your file.

As to decrypting, technically you can take a linux volume that was encrypted and revert, but you would have to piece the tools together yourself and read up on it. Unless you've done this stuff before it is probably quicker to backup apps/data, install TWRP, install SuperSU, format user from bootloader, then reinstall.

In my testing, I haven't noticed any real world difference between encrypted and unencrypted running to 5x devices side-by-side. On the earlier OS releases encrypted was noticeably slower.

Your random reboots could be related to EMMC failure, so I would try and get data off your user partition and backed up as soon as possible.
[Nexus 5X General] Flyview:
Thanks! Just to be clear, I have to wipe data even if I am willing to remain encrypted, because TWRP doesn't seem to work with the encrypted partition? It freezes for me on the intro screen when I flash it now. Having said that, how would one even have a working TWRP with an encrypted phone?
[Nexus 5X General] sfhub:
TWRP does work with encrypted user partitions. If you had pattern/pin/password, TWRP would ask you for it. If it was the default encryption, it would decrypt automatically.

That TWRP is hanging leads me to believe your user partition is either corrupted or EMMC might be failing or both.

That you had earlier random reboots along with above information leads me to believe your EMMC might be in the process of failing.
[Nexus 5X General] Flyview:
Yikes! Ok let's start again slowly. When I first got the phone, I went through the same thing, whenever I flashed TWRP, it would get stuck on the blue intro screen. As soon as I wiped data, I flashed TWRP and it opened normally. Once I flashed TWRP, and rooted with SuperSU, it stopped having any issue whatsoever, TWRP would always open up just fine. I do have a pattern unlock set. Let me try no pattern and see if TWRP reacts.

EDIT: Nope, after removing pattern unlock (swipe only), TWRP still gets stuck on its intro screen when trying to open. Are you using the same version of TWRP, 3.0.2-0?

EDIT2: These people all seem to have the same problem? https://www.reddit.com/r/Nexus6P/comments/4agvpc/help_android_n_twrp_hangs_at_splash_screen/

EDIT3: Aha! Twrp 3.0.0-0 works! It now asks for a password, but I never set one, it's just the swipe security. I kind of need this to work so I can access the SuperSU file on the internal storage. Otherwise I have to do it through USB OTG?
[Nexus 5X General] sfhub:
Are you just using the 6P thread as an example of something similar on a different phone than your 5x?

Anyway, you need to password to work not just because you need to access the SuperSU file (which you could solve by adb pushing the file into one of the temp directories), but because SuperSU can't install without accessing your user partition and TWRP won't mount the user partition until it can get the decryption key, which is why it is asking for pattern/pin/password.

If you remove pattern/pin/password from Android, the user partition will still be encrypted, but the one time key will be encrypted using the default string "password" which TWRP is able to guess on its own and mount your user partition automatically.

I don't remember the changes in TWRP but there were some encryption problems with some versions of TWRP. As far as I can remember, I've been 3.0.2-0 which I know works with the latest OS versions.

EDIT: I looked back at the changelogs for TWRP and it looks like some encryption changes happened around MHC19J. It is possible prior to that 3.0.0 worked better and after that 3.0.2 is better to use.

What version of the OS are you running?

Also when you say you "flashed" TWRP, you mean you really flashed it using fastboot flash recovery twrp.img right? There is some bug in TWRP where if you just boot into TWRP using fastboot boot twrp.img, it doesn't decrypt properly.
[Nexus 5X General] Flyview:
Could you please check what version you have? I can only get past the splash screen with 3.0.0-0 and then it doesn't accept any password. I've tried a pin, I've tried no password, I've tried manually setting the password to "password".

---------- Post added at 05:16 PM ---------- Previous post was at 05:11 PM ----------

Just saw your edits. I am running whatever the automatic beta program flashed me to. Should I manually flash system to npd56n which I downloaded to get the stock boot.img? Yes, I have been doing fastboot flash recovery not just booting.
[Nexus 5X General] sfhub:
I am currently running MTC19Z, but everything would apply for the releases between MHC19J until MTC19Z. I was running decrypted prior to MHC19J.

I know you are just grasping at straws but there is no need to set the password to "password". If you change the screen lock to swipe or none, Android will automatically do that (and I'm not quite sure setting your password to "password" does the same thing as what Android does by default since they might add some "salt" into your user-entered password)

So I think your current problem is why doesn't TWRP 3.0.2 get to the point where it asks you for your password to decrypt the user partition.

Have you tried adb into TWRP even though it appears hung, then look in the log file directory to see if tells you something. I forget where TWRP keeps it log, it is in something like the cache directory but I'm not next to my PC right now to try it.

---------- Post added at 02:19 PM ---------- Previous post was at 02:18 PM ----------

Ok, that explains it. TWRP doesn't work with encrypted user partition on Android N. My bad, you did mention that way back in the beginning, I just missed it and it never came up again. Sorry for the confusion.

I think you are going to need to back up your data and wipe/install SuperSU/format
[Nexus 5X General] Flyview:
Aha! So that does explain it then. Fresh wipe for me :( So on N preview, you pretty much have to make sure you never let the system re-encrypt or you lose your custom recovery and have to wipe userdata to get it back.
[Nexus 5X General] Gabriel1495:
So number 9 in first post's guide is not necessary? Can we use this faster way? Should we reinstall any mod?

Sorry, but here I have some problem...it seems much faster easy and without need to reinstall mod, but I should have misunderstandig one step.

I am stock, rooted, with twrp and on MTC19V build. I had downloaded this factory image, extracted boot.img and flashed it throught fastboot, then reboot. I have lost root and thatìs ok, OTA update ask me if I want to install it, I say ok, it reboot, but enter in twrp without do anything. I restart devices from twrp, but I have no more root, still V build and the SO tell me that I have already the leatest upgrade.

Sorry for all this doubt, but I have bought my first Nexus in December and I am still learning this wonderfull modded world :)

Thanks
[Nexus 5X General] sfhub:
Since it seems you already downloaded the factory image, I think the easiest for you would be to:

1) fastboot flash boot boot.img

2) fastboot flash vendor vendor.img

3) fastboot flash system system.img

4) fastboot flash recovery twrp.img

5) optional flash bootloader and radio if they changed

6) FROM bootloader, press volume down until it says boot to recovery, and press power to choose that option

6) from TWRP, install SuperSU from /sdcard

As to what you actually did, when the system downloads the differential OTA over the air, it places the file in some cache directory then reboots into recovery and has recovery do the install.

Also if you ever boot with a stock boot.img it will overwrite your recovery with stock recovery. If you install root PRIOR to booting with stock boot.img, it won't do that, because the root process modifies boot.img and the process to overwrite recovery with stock recovery will fail an integrity check.

This process is tested on stock recovery. It is possible TWRP doesn't listen to the hints from the OS that it should install the differential OTA recovery, in which case you'd need to either manually install the OTA zip by navigating the cache directory until you find it or to adb sideload it.

Alternatively you could flash stock boot.img and stock recovery.img and have the OTA process work normally.

I think your easiest route is to just do everything from bootloader. That's what I do, instead of jumping through hoops to put things back in a way that the OTA expects, when in the end, it will accomplish the same thing as just flashing everything from bootloader explicitly.
[Nexus 5X General] Gabriel1495:
This time I have done in this way :)

I have thought to flash differential OTA with TWRP, but I don't know where is that cache directory

After have flashed stock boot.img, I haven't installed root, but it doesn't work, so if I haven'y misunderstood, should I first of all unroot, than flash stock boot.img, reboot, install differential OTA normally and only than reflash TWRP and reroot?

In this way can I don't care about unrooting?

Ok, I think you are right, at the same time I try to learn always more :)

One last questions: is it normal that every time every single app is updated? (I thought yes, beacuse I follow guide in first page, where said to wipe dalvick cache after root's installation)

Everyway thanks a lot for your fast answer :)
[Nexus 5X General] sfhub:
If you search the logcat output you can see where the downloader placed the OTA zip file. It is in something like /cache but I forget over so many versions of Android on various vendors.

Once you install stock boot.img, you've effectively unrooted. The only changes SuperSU install made that would be relevant for a differential OTA are contained in boot.img. system.img wasn't changed, vendor.img wasn't changed. recovery.img is not relevant for the differential OTA, and the other files in the user partition don't have any bearing on the differential OTA either.

Even if you don't wipe dalvik-cache on latest android it will re-optimize your apps, so you can probably skip the wipe dalvik-cache step. I've done it on older systems but never on the 5x.
[Nexus 5X General] fvisagie:
Just checking a few things before I unlock and start modding, it seems this issue might have been fixed? According to the TWRP 3.0.2.0 changelog:

Also this post:

Can anyone confirm?

@Heisenberg, thanks for the awesome guide :)

---------- Post added at 10:45 ---------- Previous post was at 10:37 ----------

That's a real pity, thanks for pointing it out.

Are the developers aware of it? It doesn't seem to be listed under the github issues, at least not for bullhead.
[Nexus 5X General] Gabriel1495:
Ok, thanks a lot for everything, now I know a bit more than before ☺

Is left only one things not clear (sorry).

If is important just flash boot.img and reboot (this should be enough for classic OTA differential update), what could have I made bad?
[Nexus 5X General] bedobela:
DELETED. Issue was fixed. Thanks for the great thread
[Nexus 5X General] SlimSnoopOS:
Nah, it's still not fixed. You still have to remove your lockscreen before making a TWRP backup.

This is the only solution that I am aware of that should work.
[Nexus 5X General] sfhub:
You discovered that TWRP does not accept the OS hint to install the OTA update. It is less a problem with what you did than with TWRP note doing something that stock recovery would have done, either by design or by bug, I don't know.

If you had flashed stock boot.img and stock recovery.img your differential OTA would have worked (assuming you hadn't made changes to /system, which it sounds like you probably didn't)
[Nexus 5X General] fvisagie:
Thanks, esp. for pointing to that solution.
[Nexus 5X General] sebowow:
I've had mine rooted since February and wanting to unroot but was told the bootloader was updated in the March or April patch. Is this true and if so would it mean I need to unroot and flash the on the February patch then update to newer patches after?
[Nexus 5X General] fvisagie:
Yes, if you mean flashing the one from the factory image of your current Android version.

Also make sure any other modifications other than data are removed before installing OTAs, otherwise at least some of the pre-update validity checks will fail. Alternatively, follow the guide for updating to new builds in the original post, although I'm sure you know about that ;).
[Nexus 5X General] daddylonglegs:
Hi, if I buy a 5X today, will it be rootable? I am assuming the newest bootloader update makes unlocking the bootloader impossible? Or is that not the case? Thank you; the OP is from 2015 so I just want to make sure.
[Nexus 5X General] SlimSnoopOS:
Nothing has changed. The monthly releases are just security updates. Root can be attained the same way. Likely it'll be this way until the next version of Android is fully released.
[Nexus 5X General] daddylonglegs:
Awesome. Thanks so much. So I will just update the phone as soon as I get it and unlock the bootloader then? If so, great.
[Nexus 5X General] SlimSnoopOS:
Yes, just follow the steps in the first post and you will be unlocked in no time. It's not exactly the same as older Nexus devices.
[Nexus 5X General] antroid88:
Decided to give a shot Flash Fire today. Of course, ota has failed (actually, wasn't able to try because app warned me about potential failure). But was able to update to Z build with factory image. Lost twrp, but bootloader is unlocked still, so super su and all my data are in place. Really nice app if you prefer to run everything from the phone.
[Nexus 5X General] Cjalmighty:
Scrolling though all of this looks kind of intimidating for someone like me who's only rooted a phone and that was like 3 years ago, but I'll sit down and make sure I read everything right next week when I get my 5X. Got the 32GB at an awesome price at $235 on Newegg.
[Nexus 5X General] ulxerker:
good catch with that price! the process of unlocking and rooting is really easy, just follow the steps of OP and you're done in a few minutes :)
[Nexus 5X General] sfhub:
Whenever you write things in detail it looks more intimidating. Essentially root boils down to:

android settings oem unlock

fastboot oem unlock

fastboot flash recovery twrp.img

install SuperSU zip file
[Nexus 5X General] antroid88:
Any idea, where 5x stores ota?
[Nexus 5X General] sfhub:
On other platforms it was in /cache but I have never received OTA on this device so can't tell you for sure. You can usually find it searching through your logcat logs.
[Nexus 5X General] aboaboit:
So far, with my previous N5, I used Flashfire apply the OTAs.

My question is more a curiosity: if I do that, will I have to reinstall / reconfigure some apps or will the system be just like before, only difference being the new security patch?

---------- Post added at 10:55 AM ---------- Previous post was at 10:47 AM ----------

There is a helper to work around that issue, if you're interested.

See here.
[Nexus 5X General] defffizz:
my n5x is recognized but not authorized when typing "adb devices" in command prompt.. never had such a problem, little box always comes up on the device and asks to be authorized, but now nothing... im on paranoid android and want to go full stock. done this thousand times, no problem. i tried restarting adb by typing adb kill server and adb start server but nothing. Anyone can help? Thanks
[Nexus 5X General] :
I have restored from TWRP backups multiple times with my lockscreen intact, no problem. Both stock and with modifications.
[Nexus 5X General] Exile1975:
As long as you don't wipe data you should be fine. I just updated to the latest security patch by downloading the full ota, selecting that to flash in flashfire as well as supersu, all in one go. I also deselected everroot. Wipe cache and dalvik, and your good to go

Edit: anything you've installed to system will be gone. Example: if you installed viper4Android as a system app, as well as busybox if installed to system
[Nexus 5X General] fvisagie:
Have you tried to wipe and recreate authorisation by doing Developer options.Revoke USB debugging authorisations and connecting from scratch?

Also do the usual eliminations like USB cable, port etc.
[Nexus 5X General] agarciagonz:
OTA unencrypted Nexus 5x

Hi

A couple of weeks ago, I unencrypted my nexus 5x.

To do so I followed these steps:

I unlocked the Bootloader

An then I flashed a modified version of the boot image for MTC19V

No Custom Recovery and no ROOT

http://www.droidorigin.com/decrypt-nexus-5x/

The thing is that now I cannot upgrade my Nexus with the last OTA (MTC19Z). It is my understanding that this is becasue I have a modified version of the boot image.

At this point, I see in the FAQ the following ( http://xdaforums.com/showpost.php?p=62924122&postcount=2)

4. How do I take an OTA or update if I have root or other system modifications on the stock ROM?

You can't take an OTA update while you have root or any system modifications. You'd need to use fastboot to flash the system, boot, and recovery images. It's much easier to just flash the newer build with fastboot, see section 9 of this guide for full instructions.

But, Shouldn´t I use a modified version of the boot image for MTC19Z instead of the one downloaded form developers.google.com?

I am afraid that if I follow the previous steps, my phone will be encrypted again.
[Nexus 5X General] SlimSnoopOS:
Yes. Doing any of these three steps will keep you decrypted:

-create then flash a modified July OTA boot.img OR wait until Tigerstown makes a new one in his modified boot.img thread in this General section

-flash SuperSU after using fastboot to manually update

-install a July based custom kernel after manually updating via fastboot
[Nexus 5X General] antroid88:
+++

FlashFire won't affect your apps and data if you don't chose it. I've just updated to Z build last week using FlashFire and full factory image. Only TWRP was gone, but again, you can keep it if you uncheck Recovery image.

http://nexus5.wonderhowto.com/how-t...thout-losing-root-no-computer-needed-0168428/
[Nexus 5X General] Exile1975:
That's what I thought I said...
[Nexus 5X General] aboaboit:
Hmm, I got another answer before yours that basically said just the opposite :)

I'm not worried about system, I do not touch it. I worry about apps and settings.

I'll keep the "full OTA" tip in mind and at the next chance first another fastboot backup and then I'll try :)

Thanks.
[Nexus 5X General] Exile1975:
Yeah, it's pretty sad that bad info is passed around so frequently by people who supposedly know better. Rest assured I did this two days ago myself and it went just as I've said.
[Nexus 5X General] antroid88:
Yes, just wanted to support your post. Because for some reasons in this topic, people are posting wrong information about Flash Fire. I received wrong answers too.
[Nexus 5X General] sfhub:
I don't know about flashfire specifically, but OTAs generally don't wipe user data (Android N beta OTAs might behave differently)

Differential OTAs you get over the air require boot, vendor, and system to be stock (not just in terms of files but all the meta-data for the partition, so mounting system r/w without making any file changes can cause the system to no longer be stock)

Full OTAs (found on the nexus factory image site) contain full copies of boot, vendor, and system (and other files) so they do not require what you have to be stock, they just write over what you have. They also generally do not overwrite your userdata.

Factory images that are meant to be flashed with fastboot by default will overwrite your userdata because of the -w command line option used in the batch/script file included. This can be easily changed by end-user by simply eliminating the -w from the script.
[Nexus 5X General] bajong:
hi folks after flashing this ROM with gapps ...why cant see the camera app?