[Q] N7 Factory Reset: Have to Unlock and Root again? - Nexus 7 Q&A, Help & Troubleshooting

Ok, I come from the Apple world where you have to restore the iPhone / iPad first to update to the latest iOS then re-jailbreak.
With the N7, if I wanted to upgrade to a newer version of Android (currently on 4.2.2, so whatever comes next), would I have to re-flash the N7 to stock 4.2.2 then re-unlock and re-root it?
What if I just want to do a factory reset to start over? Do I have to re-flash stock 4.2.2 then re-unlock and re-root in that case too?

Synomenon said:
Ok, I come from the Apple world where you have to restore the iPhone / iPad first to update to the latest iOS then re-jailbreak.
With the N7, if I wanted to upgrade to a newer version of Android (currently on 4.2.2, so whatever comes next), would I have to re-flash the N7 to stock 4.2.2 then re-unlock and re-root it?
What if I just want to do a factory reset to start over? Do I have to re-flash stock 4.2.2 then re-unlock and re-root in that case too?
Click to expand...
Click to collapse
To do an official ota yes. There are stock odexed/deodexed ROMs you can flash in the dev forums without having to go through that though.
Sent from my Paranoid 3.0 Nexus7 running M-Kernel mr1

Locking/unlocking of the boot loader is completely independent from other "rooting" activity. Under normal circumstances, it is only unlocked once and then left that way.
In Android, there are 5 principal partitions: recovery, boot, system, data, and cache. In pure stock devices, it is intended that recovery, boot, and the system partition are always used in a read-only fashion by the end user. All user changes, customizations, settings, and data are recorded into the data (sometimes also called "userdata") partition. (The cache partition is used for temporary/transient stuff)
So, the Android "factory reset" is not precisely what you are thinking of - it is a procedure which erases only the cache and data partitions. IT RESTORES NOTHING - IT ONLY DELETES.
So, if a device "rooter" comes along and alters the boot/recovery/system partition, those changes stay on the tablet/phone even when a "factory reset" procedure is performed. THOSE CHANGES CAN BREAK THE SUCCESSFUL INSTALL OF AN OTA BUNDLE, so, yes - it is generally cleaner to install a pure stock ROM for the purposes of performing an OTA upgrade... at which point you need to re-root and re-customize ( not including the boot loader unlock step).
One more thing, too: because the Nexus 7 has no physical SD card, it has an "emulated" SD card which is stored in the /data (userdata) partition. When the "stock recovery" performs a "factory reset", it erases EVERYTHING in /data - including this psuedo SD card! The newer versions of the CWM or TWRP custom recoveries define "factory reset" a little differently - they erase everything except what is stored in the /data/media/ folder - the location of the emulated SD card (usually /data/media/0). This is important to understand, as your backups will be stored in there.
HTH
PS There is no need for you to "hurry up and install an OTA" if you are using a well supported custom ROM - generally after a few weeks a ROM dev will rebase their ROM onto the new release, and you can simply "dirty flash" the replacement ROM over the top of the existing ROM. That will save you some effort if you just wait a little.

So I just unlocked and rooted my N7 last night.
Since it is unlocked and rooted, do I have to do anything different if I want or have to perform a factory reset (using the hardware buttons to go into recovery mode and use the "wipe data/factory reset" option)?
If I do this factory reset, it stays unlocked right? Does it stay rooted too?

Synomenon said:
If I do this factory reset, it stays unlocked right? Does it stay rooted too?
Click to expand...
Click to collapse
Yes and Yes.
PS. The most important skill set you can develop right now is making backups using the custom recovery. You should be 100% comfortable using the backup/restore menus of the custom recovery ... and almost as important knowing where they are stored so you can get copies of them off the tablet for safe keeping.

Thank You!
bftb0 said:
Locking/unlocking of the boot loader is completely independent from other "rooting" activity. Under normal circumstances, it is only unlocked once and then left that way.
In Android, there are 5 principal partitions: recovery, boot, system, data, and cache. In pure stock devices, it is intended that recovery, boot, and the system partition are always used in a read-only fashion by the end user. All user changes, customizations, settings, and data are recorded into the data (sometimes also called "userdata") partition. (The cache partition is used for temporary/transient stuff)
So, the Android "factory reset" is not precisely what you are thinking of - it is a procedure which erases only the cache and data partitions. IT RESTORES NOTHING - IT ONLY DELETES.
So, if a device "rooter" comes along and alters the boot/recovery/system partition, those changes stay on the tablet/phone even when a "factory reset" procedure is performed. THOSE CHANGES CAN BREAK THE SUCCESSFUL INSTALL OF AN OTA BUNDLE, so, yes - it is generally cleaner to install a pure stock ROM for the purposes of performing an OTA upgrade... at which point you need to re-root and re-customize ( not including the boot loader unlock step).
One more thing, too: because the Nexus 7 has no physical SD card, it has an "emulated" SD card which is stored in the /data (userdata) partition. When the "stock recovery" performs a "factory reset", it erases EVERYTHING in /data - including this psuedo SD card! The newer versions of the CWM or TWRP custom recoveries define "factory reset" a little differently - they erase everything except what is stored in the /data/media/ folder - the location of the emulated SD card (usually /data/media/0). This is important to understand, as your backups will be stored in there.
HTH
PS There is no need for you to "hurry up and install an OTA" if you are using a well supported custom ROM - generally after a few weeks a ROM dev will rebase their ROM onto the new release, and you can simply "dirty flash" the replacement ROM over the top of the existing ROM. That will save you some effort if you just wait a little.
Click to expand...
Click to collapse
Thank you bftb0:good::good:

Related

This is probably a stupid question, but I'll ask anyway...

OK so, I was getting ready to flash to a new rom. I performed a factory reset, wiped cache, data, dalvic, etc...twice. But not paying attention, I accidentally selected reboot system before flashing a different rom...
...it rebooted normally, except as a fresh install. So by wiping the system, I'm really only clearing user data? How do I get rid of the rom entirely? Let's say the new rom I try to flash is considerably smaller with a lot less bloat. Wouldn't simply overwriting old rom still leave behind all of that extra data?
Is it possible to completely wipe the system partition and flash a new rom with cwm and have it boot?
Sent from my Amazon Kindle Fire using xda premium
new roms usually format the system partition - so nothing is left behind
In addition to what b63 said (which is correct), I think you're just getting hung up on some of the terminology. Doing a factory reset only wipes out userdata (data, cache, .android_secure) and doesn't touch your system partition. The ROM itself is still completely intact after a factory reset.
If you want to manually wipe your system partition you can do that, but you usually don't need to. In CWM go to "Mounts and Storage" and then select "Format /system" to do it. TWRP has an equivalent that I can't remember offhand, but it's something to the same effect (might be under "Advanced" or something). If you flash a ROM after you format /system manually it will boot fine, but obviously it won't boot if you format and reboot without installing a new ROM.
You're right, I just misspoke. The rom is only contained in the system folder, correct? I just couldn't understand why it would boot if I presumably wiped everything.
Sent from my Amazon Kindle Fire using xda premium
yes - if you look into the zip file of a rom you'll see there is mainly the system folder - that is /system
some have a data folder also - that are additional preinstalled apps in /data/apps
if your question is answered please mark the subject of the topic (edit first post) with [Solved]
Yes, the ROM's applications and binaries all live on the system partition, which is why it has no trouble booting after a factory reset. The data partition is basically reserved for user settings, apps, and other files.

[Q] flashing ROM, lost SD card contents

This has been bugging me and I can't seem to find anything on here to explain it.
I have installed custom ROMs on my N7. Problem is most ROM instructions say to do a full wipe/factory reset. When I do that, the downloaded ROM that was sitting on the SDCard gets wiped out as well.
I then have to go back and search for info on how to reset/restore the N7 and start all over, because the recovery (both CWM and TeamWin) don't let me mount the SD card to copy the needed zip over.
How can I do the recommended data wipe without losing the sd card contents?
Failing that, what's easiest way to get the ROM zip back on the N7 when the recovery won't allow it?
Thanks
dont wipe data...
just do a 'factory reset' in custom recovery...then flash a rom
I use TWRP & don't wipe everything, just System & Factory (to delete installed apps).
This is after wiping Cache & Dalvik Cache.
Unless I'm missing something a data wipe will wipe everything except recovery.
I don't think we have the option to exempt the media folder like on other devices.
(you type faster than me PG)
I appreciate the suggestions, and I've done the factory wipe. It wiped out the /SDcard folder contents where the zips were.
How do I get zips back on the N7? tried ADB, tried sideload from TWRP, nothing works.
Having many more problems than the last time I did this.
jneg123 said:
I appreciate the suggestions, and I've done the factory wipe. It wiped out the /SDcard folder contents where the zips were.
How do I get zips back on the N7? tried ADB, tried sideload from TWRP, nothing works.
Having many more problems than the last time I did this.
Click to expand...
Click to collapse
factory reset in TWRP doesnt touch /data/media
are you sure you are on the most recent version of recovery?
updated to latest recovery version, that seemed to be my issue. sd card now untouched.
Pirateghost said:
factory reset in TWRP doesnt touch /data/media
Click to expand...
Click to collapse
Pirateghost speaks the truth.
The stock recovery however, wipes everything with it's "factory reset".
It's a little bit unfortunate that the identical terminology is used. No doubt new folks will occasionally get bit by assuming they are the same.
I haven't used cwm yet; not sure what it means by "factory reset" - or even if it uses that terminology.

How to flash a Rom on a Nexus 7

I have flashed many a Rom in my day, but the Nexus 7 is a unique beast. How do you flash a ROM and how do you go about erasing the internal storage without losing all the data on the device. I.e. what you are flashing the TWP back ups and the Titanium back ups.
IF THIS HAD BEEN POSTED BEFORE I AM SORRY I AM ON MY NEXUS I DON'T HAVE A WAY TO SEE OLD POSTS.
Sent from my Nexus 7 using xda app-developers app
Unlock the bootloader. (THIS WILL ERASE EVERYTHING - PERFORMS A FACTORY RESET).
(So perform a backup first using either adb pull or Carbon (available on PlayStore)).
Fastboot flash a custom recovery, (CWM or TWRP).
Reboot into that recovery...
Flash the ROM of your choice.
Rgrds,
Ged.
No no I already did that. Like on my S3 I need to wipe cache/delvik factory reset. Doing the factory reset erases the internal storage, since that is where the ROM is being flashed from and where the twp back ups are those could get erased. Which can brick a device. So what do I do to flash a ROM cleanly. Every time I flash a ROM it bootloops.
waffleb051 said:
No no I already did that. Like on my S3 I need to wipe cache/delvik factory reset. Doing the factory reset erases the internal storage, since that is where the ROM is being flashed from and where the twp back ups are those could get erased. Which can brick a device. So what do I do to flash a ROM cleanly. Every time I flash a ROM it bootloops.
Click to expand...
Click to collapse
factory reset on the nexus devices, DO NOT WIPE /data/media which is where your 'sdcard' data is.....
waffleb051 said:
No no I already did that. Like on my S3 I need to wipe cache/delvik factory reset. Doing the factory reset erases the internal storage, since that is where the ROM is being flashed from and where the twp back ups are those could get erased. Which can brick a device. So what do I do to flash a ROM cleanly. Every time I flash a ROM it bootloops.
Click to expand...
Click to collapse
I'm a little vague about what you're asking here...
Haven't used CWM for a while (I forget the details), but in TWRP, having pressed WIPE...
...you can then select (In the wipe menu) CACHE, DALVIK CACHE, FACTORY RESET all with relative impunity... even SYSTEM ('Wipe System? This will wipe your ROM') can be wiped, if you have NANDROID BACKUPS or flashable ROMs to fall back on in internal storage.
The options to wipe EXTERNAL STORAGE, INTERNAL STORAGE and FORMAT DATA, however should be treated with EXTREME CAUTION... as you may be left only with a custom recovery (if you have wiped SYSTEM beforehand)... and then you'll have either have to adb push a NANDROID (or flashable ROM) from your computer or fastboot flash back to stock.
(As an aside by the way, you aren't really 'bricked'... you just have no usable ROM on your system; but that really isn't a problem if you know how to use adb or fastboot).
------
FACTORY RESET in TWRP doesn't wipe the internal storage... if that is what you're alluding to...
Rgrds,
Ged.
That is exactly what I was wonder thank you for both your answers

[Q] re-enable OTA updates Nexus 7

Hi all,
I have a nexus 7 running Android 4.1.2 stock w/ root. Some months ago, I disabled the OTA update notification - but I can't seem to remember how!
I want to now re-enable OTA updates so that I can update to the latest android version, and not lose my installed apps.
I've searched the device for FOTAKill.apk inside /system/app, and its not found
I've also searched for frozen / hidden apps using Titanium Backup Pro... nothing
When I enter Settings -> About Tablet -> System Updates... it says I'm up to date... but I'm not, considering I'm running 4.1.2.
Any help or pointers in re-enabling OTA is appreciated!!
- make a full nandroid backup.
- using fastboot, flash the system.img file from the 4.2.2 factory image to the system partition.
- using your custom recovery, reflash a SuperSU root kit bundle.
- using the custom recovery, wipe cache and dalvik-cache.
If you don't like the result, restore the nandroid backup and proceed in a different fashion. It will probably break things like stickmount and any other changes that you caused in /system.
Note the above method is for use by lazy and sloppy users. A better approach is to make TiBu backups of only your market apps, bite the bullet, and start from scratch with a flash & (new) configuration of a pure stock ROM. In any case, every conceivable procedure should start with making a full nandroid backup and getting it copied to a safe place off the tablet.
I will also say that unless odd problems crop up, the portions of the factory install procedure (using fastboot) that deal with erasure or flashing of the userdata partition should be skipped, as these steps completely wipe your /data storage - including your /sdcard area in /data/media/0 and any CWM/TWRP nandroid backups!
It's not really clear why these steps would be needed unless the /data ext4 filesystem in the userdata partition got corrupted somehow. A more sly approach would be to use the custom recovery's "factory reset" procedure to clean up /data - either before or after flashing the factory ROM - and completely skip anything that touches the userdata partition in the factory install instructions.
good luck

(Yet Another) Question on Encryption

So, I've been reading ad nauseum on this topic with regards to flashing new ROMs on my 6t and getting locked out due to decryption.
Among other threads and places across the interweb, I've read all of these:
https://forum.xda-developers.com/search/forum/8259?query=Encryption
During my travels I've discovered that the s**t doesn't really hit the fan until "data" is wiped via TWRP. I see that the recommend process for flashing new ROMs goes like this:
Boot on twrp
Flash ROM
Flash twrp installer
Reboot to twrp
Factory reset
Reboot to system
Am I understanding this correctly that if I transpose steps 4 and 5, then I shall plan on losing all of my data, but if I reboot from TWRP (right back into TWRP) before step 5 (aka data wipe), I shouldn't loose my data?
Assuming that is correct, does it matter if I leave a lock screen password enabled before rebooting to TWRP from the soon-to-be replaced ROM? I ask this because removing the lock screen password did not seem to reduce my chances of encountering permananly encrypted data.
Thanks!
notorious.dds said:
So, I've been reading ad nauseum on this topic with regards to flashing new ROMs on my 6t and getting locked out due to decryption.
Among other threads and places across the interweb, I've read all of these:
https://forum.xda-developers.com/search/forum/8259?query=Encryption
During my travels I've discovered that the s**t doesn't really hit the fan until "data" is wiped via TWRP. I see that the recommend process for flashing new ROMs goes like this:
Boot on twrp
Flash ROM
Flash twrp installer
Reboot to twrp
Factory reset
Reboot to system
Am I understanding this correctly that if I transpose steps 4 and 5, then I shall plan on losing all of my data, but if I reboot from TWRP (right back into TWRP) before step 5 (aka data wipe), I shouldn't loose my data?
Assuming that is correct, does it matter if I leave a lock screen password enabled before rebooting to TWRP from the soon-to-be replaced ROM? I ask this because removing the lock screen password did not seem to reduce my chances of encountering permananly encrypted data.
Thanks!
Click to expand...
Click to collapse
Yes. For the love of god. Someone please clear up how we can flash on the go. I don't always have access to a computer with Adb/fastboot.
Every time I try to switch roms, upon rebooting to TWRP, my folders encrypt. Then I have to format data and voila, no fricking ROM to flash and I'm stuck
idkwhothatis123 said:
Yes. For the love of god. Someone please clear up how we can flash on the go. I don't always have access to a computer with Adb/fastboot.
Every time I try to switch roms, upon rebooting to TWRP, my folders encrypt. Then I have to format data and voila, no fricking ROM to flash and I'm stuck
Click to expand...
Click to collapse
Yeah A/B partition are a nuisance when it comes to flashing. I'd recommend you to do a clean flash of the ROM. Follow these steps.
1. Download the Latest Stable OOS from OnePlus's Website. Download the ROM ZIP of your Choice as well as the latest TWRP Installer. Transfer these to your phone and also copy them to a Laptop as you might have to Format Data.
2. Now Reboot to Recovery and flash OOS ZIP and TWRP Installer. Let it finish. Once it's done Reboot to Recovery from Within TWRP.
3. Again flash OOS and TWRP Installer. If for some reason your folders are messed up (as you posted in the image earlier) just go to Wipe and Format Data. And transfer the OOS and TWRP Installer to Internal and Flash them. Let it finish.
4. Once that's done, now again Reboot to Recovery and now flash ROM and TWRP Installer. After that's done, again Reboot to Recovery.
5. Again, flash ROM and TWRP Installer. Once done, Reboot to Recovery.
6. Now flash Gapps of your Choice. Stock are Recommend while anything above Nano will work. AROMA won't work. Once Gapps are flashed now go to Wipe and do a Factory Reset (Swipe to Factory Reset). Once that's Done, hit Reboot System and wait for the ROM to Load.
7. After the Initial Setup, Reboot to Recovery and flash Magisk and Custom Kernel if you want.
Personally I Format Data after flashing Gapps to get a "clean install". But that's not necessary. Also if you want to flash ROMs often I'd suggest investing in Swift Backup. It's an excellent app for Backups and can Backup almost Anything. Hope this helps.
This is what I do. Occasionally I get the Encrypted Folders but if followed correctly all is smooth. I can flash any ROM without Encryption. Except maybe stock OOS.
Thanks Mannan.
However, what I'm really looking for is someone to explain the following:
1. Which action or actions is it that triggers the phone to be encypted without a way to decrypt when flashing a new rom? My suspicion is that if the phone was encrypted while having been boot from slot A, then wiping data while in slot A results in data loss. By extension, rebooting into slot B and then wiping data allows slot B to now hold the encryption key. I'm sure this theory has got some errors, but it's the best I can come up with having no intrinsic knowledge on the topic.
2. Are there any means of mitigating data loss should the phone become encrypted? I.e. If possible, can I back up data (minus /data/media) and then restore that when I can't get access to /data/media?
With regards to question #1, I developed my "suspicion" after lossing ambition to test it. When I get my ambition back to fight this issue, I'll try again. I'm just getting sick of transfering 25+ gigs of data via adb every time the data gets encrypted and I can't get it decrypted.
notorious.dds said:
Thanks Mannan.
However, what I'm really looking for is someone to explain the following:
1. Which action or actions is it that triggers the phone to be encypted without a way to decrypt when flashing a new rom? My suspicion is that if the phone was encrypted while having been boot from slot A, then wiping data while in slot A results in data loss. By extension, rebooting into slot B and then wiping data allows slot B to now hold the encryption key. I'm sure this theory has got some errors, but it's the best I can come up with having no intrinsic knowledge on the topic.
2. Are there any means of mitigating data loss should the phone become encrypted? I.e. If possible, can I back up data (minus /data/media) and then restore that when I can't get access to /data/media?
With regards to question #1, I developed my "suspicion" after lossing ambition to test it. When I get my ambition back to fight this issue, I'll try again. I'm just getting sick of transfering 25+ gigs of data via adb every time the data encryption kicks in.
Click to expand...
Click to collapse
You're not that far off, actually. And while I'm no developer I suspect that Encryption kicks in when
a). You flash stock OOS. No matter what ROM you are on, when you flash OOS it's possible you can get encrypted. I'm not sure about this but if a developer could confirm that'd be great. This one time, I flashed OOS Stable while on Beta and it Encrypted my Storage. So I had to retransfer with a computer to flash it the required two times. So basically avoid flashing OOS when on a Custom ROM. Even when switching ROMs.
b). Just as you said, when you Wipe Data within TWRP and then Reboot to TWRP it also Encrypts the Device. So I usually Wipe Data after flashing ROM & Gapps. Otherwise if you Wipe Data after flashing ROM it will Encrypt you.
And to answer that last Question the app I personally use is called Swift Backup. It's an amazing app and although it costs $5.49 it can Backup Apps and Data. It can also backup the Files in Android/obb. Give it a go.
Mannan Qamar said:
You're not that far off, actually. And while I'm no developer I suspect that Encryption kicks in when
a). You flash stock OOS. No matter what ROM you are on, when you flash OOS it's possible you can get encrypted. I'm not sure about this but if a developer could confirm that'd be great. This one time, I flashed OOS Stable while on Beta and it Encrypted my Storage. So I had to retransfer with a computer to flash it the required two times. So basically avoid flashing OOS when on a Custom ROM. Even when switching ROMs.
Click to expand...
Click to collapse
I've been fiddling around with OOS and The Pixel Experience (aka TPE) ROM. I've yet to need to flash OOS in order to loose my ability to decrypt. Flashing TPE screws everything up quite nicely as well. That said, I have gotten into the situation where TWRP (booted from either slot) has got everything encrypted. However, in one case, I was able to get the data back by recreating the boot_a partition as it existed before I wiped data. I think there may be something to be learned here. However, subsequent attempts to use this method have not been successful. In other words, I'm not sure what I actually learned.
Mannan Qamar said:
And to answer that last Question the app I personally use is called Swift Backup. It's an amazing app and although it costs $5.49 it can Backup Apps and Data. It can also backup the Files in Android/obb. Give it a go.
Click to expand...
Click to collapse
I'm still using Titanium Backup (paid version as well). It works quite well and I'm happy with it. That said, it's still a much bigger pain in the butt to restore vs performing a nandroid restore of the data. It's apples and oranges though. In order for the nandroid to provide any real value, you pretty much have to do right before need it... unless you never do anything on your phone. It also only works with the ROM from which it was created... obviously. Since my current nandroid backup of /data is > 22 gb, its fairly cumbersome.
notorious.dds said:
I've been fiddling around with OOS and The Pixel Experience (aka TPE) ROM. I've yet to need to flash OOS in order to loose my ability to decrypt. Flashing TPE screws everything up quite nicely as well. That said, I have gotten into the situation where TWRP (booted from either slot) has got everything encrypted. However, in one case, I was able to get the data back by recreating the boot_a partition as it existed before I wiped data. I think there may be something to be learned here. However, subsequent attempts to use this method have not been successful. In other words, I'm not sure what I actually learned.
I'm still using Titanium Backup (paid version as well). It works quite well and I'm happy with it. That said, it's still a much bigger pain in the butt to restore vs performing a nandroid restore of the data. It's apples and oranges though. In order for the nandroid to provide any real value, you pretty much have to do right before need it... unless you never do anything on your phone. It also only works with the ROM from which it was created... obviously. Since my current nandroid backup of /data is > 22 gb, its fairly cumbersome.
Click to expand...
Click to collapse
I dunno if it will work but when you get Encrypted try booting the TWRP image. Maybe that'll work.
Doesn't this problem occur with backups and restore from twrp as well?.... This A/B stuff I'm not used to but I'll keep reading and hopefully something in my brain will kick in lol...
Mannan Qamar said:
I dunno if it will work but when you get Encrypted try booting the TWRP image. Maybe that'll work.
Click to expand...
Click to collapse
Yeah, that I defintitely tried. No dice. However, I just backed up everthing and I'm about to start blowing the thing up with ROM flashes. Consider it a stress test. I'll report back.
What I've got so far...
Coming from OOS 9.0.14 running on slot B with a lock screen pattern enabled, I boot into TWRP on slot B.
I then flashed The Pixel Experiance ROM via it's .zip file. (The flash is then applied to slot A because it goes to the inactive slot).
Flashed the TWRP install .zip
Changed active slot to A
Reboot to recovery (aka TWRP) ... now in slot A.
wiped data (minus storage)
Flashed magisk
Reboot system
This got me into the new ROM with data intact. However, when rebooting to recovery (still slot A), it would ask for a pattern but yet wouldn't accept the pattern to decrypt. Rebooting back into Pixel Experience the data was decrypted. So, even the data would decrypt when booted into system, I could no longer get to the data from within TWRP. I then changed the lock pattern from within Pixel Experience and reboot to TWRP, it still couldn't decrypt the data. Rebooting back to system succeeded in that it actually boot, but I could no longer unlock the phone (stuck on "phone is starting"). My presumption at this point was that Pixel Experience could no longer decrypt the data.
I then:
Reboot to TWRP (slot A still)
Flashed OOS
Flashed TWRP
Set active slot to B
Reboot to recovery (aka TWRP)
wiped data (minus storage)
reboot to system
At this point OOS failed to boot and I was returned to TWRP. Data was still not able to be decrypted. I then did a factory reset plus wiped storage (aka data, dalvik, and internal storage) and tried to boot to system... still failed and sent me back to TWRP. This time, although data was empty, it was decrypted. I tried to reboot system again. It failed again and sent me back to TWRP.
So, at this point , I've wiped data and internal storage but I cannot get stock OOS to boot. So, I reboot to bootloader and executed:
Code:
fastboot -w
My understanding is that this should do the same this as performing a factory reset from within TWRP. However, rebooting to system succeeded this time.
So, the new questions are:
1. How is it that I can decrypt data when booted into Pixel Experience on slot A, but I cannot decrypt the data via TWRP?
2. If I removed the lock screen pattern from OOS before flashing PixelExperience, would I have been able to decrypt the data in both the ROM and within TWRP?
3. Why is factory resetting via fastboot effective when doing so in TWRP is not?
notorious.dds said:
What I've got so far...
Coming from OOS 9.0.14 running on slot B with a lock screen pattern enabled, I boot into TWRP on slot B.
I then flashed The Pixel Experiance ROM via it's .zip file. (The flash is then applied to slot A because it goes to the inactive slot).
Flashed the TWRP install .zip
Changed active slot to A
Reboot to recovery (aka TWRP) ... now in slot A.
wiped data (minus storage)
Flashed magisk
Reboot system
This got me into the new ROM with data intact. However, when rebooting to recovery (still slot A), it would ask for a pattern but yet wouldn't accept the pattern to decrypt. Rebooting back into Pixel Experience the data was decrypted. So, even the data would decrypt when booted into system, I could no longer get to the data from within TWRP. I then changed the lock pattern from within Pixel Experience and reboot to TWRP, it still couldn't decrypt the data. Rebooting back to system succeeded in that it actually boot, but I could no longer unlock the phone (stuck on "phone is starting"). My presumption at this point was that Pixel Experience could no longer decrypt the data.
I then:
Reboot to TWRP (slot A still)
Flashed OOS
Flashed TWRP
Set active slot to B
Reboot to recovery (aka TWRP)
wiped data (minus storage)
reboot to system
At this point OOS failed to boot and I was returned to TWRP. Data was still not able to be decrypted. I then did a factory reset plus wiped storage (aka data, dalvik, and internal storage) and tried to boot to system... still failed and sent me back to TWRP. This time, although data was empty, it was decrypted. I tried to reboot system again. It failed again and sent me back to TWRP.
So, at this point , I've wiped data and internal storage but I cannot get stock OOS to boot. So, I reboot to bootloader and executed:
My understanding is that this should do the same this as performing a factory reset from within TWRP. However, rebooting to system succeeded this time.
So, the new questions are:
1. How is it that I can decrypt data when booted into Pixel Experience on slot A, but I cannot decrypt the data via TWRP?
2. If I removed the lock screen pattern from OOS before flashing PixelExperience, would I have been able to decrypt the data in both the ROM and within TWRP?
3. Why is factory resetting via fastboot effective when doing so in TWRP is not?
Click to expand...
Click to collapse
Well starting from the way you flashed the ROM, the rule of thumb is that you NEVER manually change slots. Now since you are on stock follow the instructions I posted earlier to flash PE or any other ROM for that matter. I think when you manually set the slot it somehow messed up Decryption. Next, after flashing OOS from TWRP when you are on a Custom ROM, you must always Format Data. The command you ran via Fastboot (fastboot -w) does just that.
So I just flashed Bootleggers from Stock OpenBeta 11. These are the steps I followed. I was successfully able to flash and was able to keep my Data intact. These are the steps I followed.
Starting from OpenBeta 11 I flashed ROM (Bootleggers) and then TWRP Installer. Then go to Reboot and Select Recovery. Once in Recovery, again flash ROM and TWRP Installer. Once done, reboot to Recovery. Flash Gapps and then go to Wipe and do a Swipe to Fa Tory Reset. This will Delete all your Data except Internal Storage. This is a necessary step when flashing a ROM. Once done, reboot to System. After this I was able to boot up Successfully with my Internal Storage as it was before flashing. After that I restored my backup. Everything is working and I can enter and Decrypt TWRP without error.
This thread should be pined as a guide because instalation notes in ROM threads are so basic.
A couple of things come to mind reading this thread in reference to encryption
1) if security patches dont match on A/B, it seems to trigger a lockout with encryption. i may be wrong.
2) if internal storage isnt wiped, i.e.-if you use the "factory reset' option in twrp, your data is still there and that in itself post-flash can trigger encryption error as the data is still there.
I think about it like this, despite it being A/B partitions, the data is like a middle layer that isnt individualized to one partition or the other. so a trigger/failure for secure boot encrypts it all.
kitcostantino said:
A couple of things come to mind reading this thread in reference to encryption
1) if security patches dont match on A/B, it seems to trigger a lockout with encryption. i may be wrong.
2) if internal storage isnt wiped, i.e.-if you use the "factory reset' option in twrp, your data is still there and that in itself post-flash can trigger encryption error as the data is still there.
I think about it like this, despite it being A/B partitions, the data is like a middle layer that isnt individualized to one partition or the other. so a trigger/failure for secure boot encrypts it all.
Click to expand...
Click to collapse
I'm pretty sure, that if you flash anything with a security patch earlier than the one you're currently using your data will get encrypted.
Which is why it happens with going back to OOS from custom, because they're always late with security patches compared to custom roms.
The hardest thing for.me coming from an A only device (Axon 7) has been learning order of operations. as long as one flashes rom followed by twrp and then a reboot into recovery, followed by installing magisk, things usually go okay. Going from aosp to aosp went okay, but like you said moving from OOS to AOSP or vice versa always yielded encryption lock. maybe we could make a merged security patch or something of the sort to bridge the gap. im no dev, so im sure someone who knows more than i can tell us why that wouldnt work. it would be really cool for One Plus to gain a better foothold in custom OS before the majority of crack flashers and devs swear off. Dont get me wrong, OOS is amazing and i feel with the inherent features, is superior to any other stock rom, but android is all about choice.
i really and truly wish someone would make a version of TWRP that had a dual boot set up vs A/B. I have had devices (looking at you, Droid Bionic) that never had proper root/bl unlock and had amazing rom communities bc of safestrap/dual boot/etc. i am more than willing to give up internal storage space to duplicate/clone /data and anything else that is on both systems. i also wish recovery had its own partition again, but that one is beyond our control at this point as it resides in boot now.
Maybe its conceivable. Who knows.
I have no issues. I don't lose anything when I flash ROMs. I boot to twrp, factory reset(not wipe storage), flash ROM, flash twrp installer....boot ROM, reboot twrp, flash gapps, custom kernel. Then I factory reset again (not wipe storage) and then install magisk..done....no issues. It will fail boot once and then boot fine because of this process but only after you do this. So if you reboot later you are fine...I keep all my stuff
First off, I want to thank all of you who contributed to this thread. I'm defintely gaining a better understanding of some of the pitfalls associated with A/B devices and encryption. Thanks!
Mannan Qamar said:
Well starting from the way you flashed the ROM, the rule of thumb is that you NEVER manually change slots. Now since you are on stock follow the instructions I posted earlier to flash PE or any other ROM for that matter. I think when you manually set the slot it somehow messed up Decryption.
Click to expand...
Click to collapse
So, my understand is that flashing a new ROM from within TWRP flashes it to the inactive slot. Therefore, my assumptions as to the reasoning behind rebooting from TWRP back into TWRP before wiping data were that:
Any modifiations made to the boot partition intended to affect the new ROM need to be made to the boot partition that shares the same slot as that of the new ROM, and
Wiping data while booted into image of TWRP which shares the same slot as the new ROM has some magical effect on preserving the ability to decrypt data vs wiping data while booted into the image of TWRP that resides in the slot of the ROM to be replaced.
It is these assumptions (combined with my execution of the basic recipe failing to prevent encryption lock-out) which led me to manually changing slots. I will say this... after flashing PE and TWRP.zip from within TWRP on slot B, simply rebooting to recovery brought me right back to TWRP on slot B. If PE is now on slot A, how does installing magisk, etc. do me any good while in slot B? Also, are my assumptions misguided as to the "why" rebooting to TWRP before installing magisk, wiping data, etc is necessary?
Mannan Qamar said:
Next, after flashing OOS from TWRP when you are on a Custom ROM, you must always Format Data. The command you ran via Fastboot (fastboot -w) does just that.
Click to expand...
Click to collapse
Lightbulb status: on
Thanks!
kitcostantino said:
If security patches dont match on A/B, it seems to trigger a lockout with encryption. i may be wrong.
Click to expand...
Click to collapse
Is this why in Mannan Qamar's earlier post he appears to be flashing the new ROM to BOTH slots before trying to boot into system?
ebproject said:
I'm pretty sure, that if you flash anything with a security patch earlier than the one you're currently using your data will get encrypted.
Which is why it happens with going back to OOS from custom, because they're always late with security patches compared to custom roms.
Click to expand...
Click to collapse
I'm assuming that flashing OOS to BOTH slots as is mentioned earlier with regards to flashing a custom ROM won't help when going back to OOS given the old vs new issue. Has anyone verified that yet?
It's my understanding that the sure security patch is applied to the system partition, correct? Is part of that patch included in boot, or no?
jamescable said:
I have no issues. I don't lose anything when I flash ROMs. I boot to twrp, factory reset(not wipe storage), flash ROM, flash twrp installer....boot ROM, reboot twrp, flash gapps, custom kernel. Then I factory reset again (not wipe storage) and then install magisk..done....no issues. It will fail boot once and then boot fine because of this process but only after you do this. So if you reboot later you are fine...I keep all my stuff
Click to expand...
Click to collapse
I notice that the FIRST thing you do is "factory reset". That's definitely not standard with the install threads I've read. Hmmmmm, interesting.
Also, why do you boot the ROM before flashing gapps, and kernel? It seems unnecessary since you're just factory resetting again. I'm sure I'm missing something on this one.
notorious.dds said:
I notice that the FIRST thing you do is "factory reset". That's definitely not standard with the install threads I've read. Hmmmmm, interesting.
Also, why do you boot the ROM before flashing gapps, and kernel? It seems unnecessary since you're just factory resetting again. I'm sure I'm missing something on this one.
Click to expand...
Click to collapse
Booting to ROM solved the encryption issues
idkwhothatis123 said:
Yes. For the love of god. Someone please clear up how we can flash on the go. I don't always have access to a computer with Adb/fastboot.
Every time I try to switch roms, upon rebooting to TWRP, my folders encrypt. Then I have to format data and voila, no fricking ROM to flash and I'm stuck
Click to expand...
Click to collapse
If you stuck on encrypted storage ever, reboot to system and after you see the setup screen, reboot to recovery again. Voila, your storage is decrypted now.
It happened to me all the time when I flash OOS and this way I am able to decrypt my internal storage.

Categories

Resources