Questions regarding locked bootloaders, custom recoveries and encryption - OnePlus 5T Questions & Answers

- Did I understand correctly that locking the bootloader automatically prevents custom ROMs from booting? Just out of curiosity, you would have to keep the bootloader unlocked when using custom ROMs.
- Will locking the bootloader erase /data and /cache or will only unlocking do it?
- If I choose to use TWRP, OxygenOS apparently overwrites it on boot. Is there a way to prevent it or will custom kernels automatically prevent it. I do know that OTA updates will restore the stock recovery but I'd like to keep TWRP at least for every boot.
- Which type of encryption is used in OxygenOS. I read that there are issues with FBE restores in TWRP but does that affect the OnePlus 5T? Is there a way of restoring TWRP backups if the system was encrypted before or what is the exact issue here? I always read FBE has been introduced in Android 7.0 Nougat which I already use on my Nexus 6P with LineageOS 14.1 but I never had any restore issues in TWRP despite having it encrypted since the beginning.
Thanks in advance! :good:

Macusercom said:
- Did I understand correctly that locking the bootloader automatically prevents custom ROMs from booting? Just out of curiosity, you would have to keep the bootloader unlocked when using custom ROMs.
- Will locking the bootloader erase /data and /cache or will only unlocking do it?
- If I choose to use TWRP, OxygenOS apparently overwrites it on boot. Is there a way to prevent it or will custom kernels automatically prevent it. I do know that OTA updates will restore the stock recovery but I'd like to keep TWRP at least for every boot.
- Which type of encryption is used in OxygenOS. I read that there are issues with FBE restores in TWRP but does that affect the OnePlus 5T? Is there a way of restoring TWRP backups if the system was encrypted before or what is the exact issue here? I always read FBE has been introduced in Android 7.0 Nougat which I already use on my Nexus 6P with LineageOS 14.1 but I never had any restore issues in TWRP despite having it encrypted since the beginning.
Thanks in advance! :good:
Click to expand...
Click to collapse
Not sure about booting custom ROMs when bootloader locked again. Never tried it. Never found any need to try.
About Android reinstalling stock recovery. Often it is because of /system/bin/install-recovery.sh ...
You can rename /system/recovery-from-boot.p to, say, /system/recovery-from-boot.bak.
Either from booted into system when rooted or from booted into TWRP (and mounting system partition manually).
I have already restored 1+5T from TWRP backup and never altered encryption. Before restore I remove screen lock as suggested somewhere. Not sure what would happen otherwise.
Have a nice day.

Just as a follow up, here's what I figured out:
- Locking the bootloader with any modification results in being unable to boot. You can't alter anything and lock it again.
- Locking the bootloader wipes /data and /cache including the internal storage.
- TWRP automatically prevents the stock recovery from being reinstalled. Very handy!
- As I'm only using OxygenOS for now, I can't comment on other encryption systems. Hopefully, I will be able to use LineageOS 15.1 without wiping the internal storage to maintain images etc. we'll see.

Related

Failed Boot after Flashing SuperSU

I finally got around to rooting my 5x this last weekend. I flashed the latest version of the SuperSU update zip. After flashing I used the SafetyNet Helper to check if my phone successfully jumps through all of Google's hoops. I failed the test, so I went back to recovery and restored my boot partition from my nandroid backup, which I created immediately after flashing and booting to TWRP. When I tried rebooting system I got a message my software was corrupt and phone got stuck on boot screen (Google logo with annoying padlock to indicate bootloader is unlocked). Went back to TWRP and tried restoring both boot and system but it was still getting stuck on the boot screen. So I downloaded the factory images, flashed everything but userdata, and phone was working again.
After some digging I found that I failed to read the fine print for the newer versions of SuperSU, stating that if you want the systemless install you have to write a couple of settings to a file in /data that the installer checks. Did this and root worked and passed the SafetyNet checks and I was happy. Then I installed AdAway and flashed systemless hosts and I'm even happier. But I'm still wondering why it was saying my software was corrupted, even after I restored my nandroid backup. Any ideas?
jgummeson said:
I finally got around to rooting my 5x this last weekend. I flashed the latest version of the SuperSU update zip. After flashing I used the SafetyNet Helper to check if my phone successfully jumps through all of Google's hoops. I failed the test, so I went back to recovery and restored my boot partition from my nandroid backup, which I created immediately after flashing and booting to TWRP. When I tried rebooting system I got a message my software was corrupt and phone got stuck on boot screen (Google logo with annoying padlock to indicate bootloader is unlocked). Went back to TWRP and tried restoring both boot and system but it was still getting stuck on the boot screen. So I downloaded the factory images, flashed everything but userdata, and phone was working again.
After some digging I found that I failed to read the fine print for the newer versions of SuperSU, stating that if you want the systemless install you have to write a couple of settings to a file in /data that the installer checks. Did this and root worked and passed the SafetyNet checks and I was happy. Then I installed AdAway and flashed systemless hosts and I'm even happier. But I'm still wondering why it was saying my software was corrupted, even after I restored my nandroid backup. Any ideas?
Click to expand...
Click to collapse
In general, phones get messed up after flashing backups or changing through multiple ROMs. The backups like nandroid backup are primarily meant for immediate resolution and a full fresh install is always recommended for any device (be it a desktop, laptop or any mobile device). Its always better to find the best suited ROM as per your needs and stick with it rather than messing up by flashing different zips through TWRP. Cheers :good:
ultraquantum said:
In general, phones get messed up after flashing backups or changing through multiple ROMs. The backups like nandroid backup are primarily meant for immediate resolution and a full fresh install is always recommended for any device (be it a desktop, laptop or any mobile device). Its always better to find the best suited ROM as per your needs and stick with it rather than messing up by flashing different zips through TWRP. Cheers :good:
Click to expand...
Click to collapse
Right. Nandroid can quickly get you out of the most common sticky situations by restoring the most commonly messed with partitions (system, boot, data). There are a bunch of other partitions that can mess things up. The only things flashed though were TWRP and SuperSU (non-systemless by mistake). I'm just trying to understand what might've gone wrong. Something outside of system/boot must have been modified and broke the boot, only after restoring the boot partition. Think I figured it out though - I looked at the update script for SuperSU and it looks like it could be messing with the vendor partition (at least for non-systemless installs). When I flashed back the stock boot image a change in the vendor partition must have tripped dm-verity, which the SuperSU installer had disabled when it updated the boot image.

[Q] [HELP] Everything deleted/wiped after flashing custom rom

Hi there,
I have a big problem. I run a OP3 with TWRP 3.1.1.2. After flashing a custom ROM e.g. Resurrection Remix, all my data on the internal storage + apps are lost and my OS seem except for the google account like factory resetted.
My phone is also encrypted. Can it be a problem with permissions on the sd-card?
Thanks in advance
PS: Is there a tool with which I can recover my non meida data like zip files and so on? DiskDigger works mostly for photos.
Flashing blu_spark TWRP seemed to fix it. Found it out after some research.
Try new approach to flash RR5.4.8, but nandroid backup first
- Ensure TWRP is 3.1.1-2, turn power off and after switch on enter TWRP (do not start recovery from OS or TWRP)
- Flash OB22 Firmware and Modem; then Boot patch for dm-verity to remove storage encryption
- Flash Resurrection ROM and GAPPS, Whenever you take nandroid backup make sure Secuity=None to avoid restoration issues
- Even if this approach won't maintain your apps (it could be the reason that original storage is encrypted as dm-verity not disabled),
i suggest using this approach for flashing any custom ROM. Since had started this approach all RR and Nadorid issue just vanished
Hope to have helped you ?

How do I update my device's OS when I'm rooted?

Currently I'm using a OnePlus 3 on 6.0.1 (OOS 3.1.1) but I would like to update to Oreo (OOS 5.0). How do I do this when my device is rooted?
I've downloaded the latest OS off the oneplus website. Is it as simple as uninstalling SuperSU and then flashing the latest OS through recovery?
I also have TWRP recovery and Xposed installed.
Would appreciate any help.
Just flash the new OS in recovery, no need to unroot as it will get overwritten anyways. You'll need to root again after updating, of course.
Sent from my OnePlus 3 using Tapatalk
Explorer23 said:
Just flash the new OS in recovery, no need to unroot as it will get overwritten anyways. You'll need to root again after updating, of course.
Sent from my OnePlus 3 using Tapatalk
Click to expand...
Click to collapse
The full zip of oxygen OS will overwrite the TWRP recovery with the stock one?
I can update with the zip in the recovery and root whenever i want or i have to do this at the same time?
Explorer23 said:
Just flash the new OS in recovery, no need to unroot as it will get overwritten anyways. You'll need to root again after updating, of course.
Sent from my OnePlus 3 using Tapatalk
Click to expand...
Click to collapse
It's as easy as that? It's not a problem that I have xposed installed or anything?
What should I wipe before I install the new OS?
Sorry for all the questions, newbie here.
@Edo 91
I'm not sure about overwriting recovery, it's been a long time since I've used OOS (currently on PA, before than on LOS). If I remember correctly the recovery should stay if you DON'T boot into system right after flashing. So, flash the ROM, reboot into recovery first, then boot into system. Can't say if anything changed with Oreo, but that's how I remember it from Nougat and Marshmallow. You can however flash recovery again right after ROM, just to be sure.
You can root later down the road, no need to do everything at once.
@scalliant
Generally yes, it as easy as that. Xposed and root methods modify system partition - and that gets overwritten when you flash new ROM. That's why those modifications have to be flashed again after every update (some custom ROMs are exception, but rest assured the stock one will nuke all mods).
Anyways, we're talking about Android version upgrade here and not just a minor system update, so I'd recommend a clean installation (but you can try dirty first and then do a clean one in case you experience issues).
First of all, make a full nandroid backup (check everything except "system image" in TWRP). Copy all of your media content (pictures, videos, music ... whatever you don't wanna lose) to another device - better safe than sorry. Optionally, backup apps with Titanium or something similar.
To do it clean: wipe /system, /data and /cache. That means losing all apps and settings, but you'll keep stuff that was stored on the phone. After successfully booting into system you can restore app backups or install them and set up everything again.
To do it dirty: wipe just /system and /cache. You'll lose just system settings, but will keep apps and everything else. Less hassle, but higher chance of something going south.
Explorer23 said:
@Edo 91
To do it clean: wipe /system, /data and /cache. That means losing all apps and settings, but you'll keep stuff that was stored on the phone. After successfully booting into system you can restore app backups or install them and set up everything again.
Click to expand...
Click to collapse
I thought you loose everything when you do a clean install. So photos and files are preserved using this method? I assume text messages will be lost?
shobuddy said:
I thought you loose everything when you do a clean install. So photos and files are preserved using this method? I assume text messages will be lost?
Click to expand...
Click to collapse
Media is on a (virtually) separate partition and is preserved unless while internal storage is formated. Still, it's never a bad idea to have a backup.
Yes, text messages are lost if not backed up. There are many apps that do that (and can be set to upload to cloud regularly).
Sent from my OnePlus 3 using Tapatalk

Restore a TWRP backup with A/B system slots!

CHANGED: You must flash the dm-verity.zip on ROM install to use the backup/restore feature of TWRP. It won't work if /data is encrypted. I jumped the gun when making this thread.
EDIT2: I had also flashed dm-verity on install so /data wasn't encrypted.
Which Dm Verity did you use which version??
Does this mean even today with the latest versions of twrp and magisk you cant restore the backups made of an encrypted phone? I just got a new Moto G7 Power and got it setup with those two things and made a backup - havnt tried restoring yet. Does your solution of flashing the dm-verify.zip thing mean the phone will be unencryped then? Because I cant have that, I rather not have backups. What about the old "adb backup" type command line does that still work?
I've had my phone since the day they were available at metro and I can't and don't even try to backup or restore anything anymore. On roms it always has broken lockscreen where you cannot secure phone. Because of this I stay encrypted and setup my **** all over again when I change roms.
flash713 said:
I've had my phone since the day they were available at metro and I can't and don't even try to backup or restore anything anymore. On roms it always has broken lockscreen where you cannot secure phone. Because of this I stay encrypted and setup my **** all over again when I change roms.
Click to expand...
Click to collapse
I see, too bad it's a nice function to backup/restore I guess I'll just backup my important data individually and try not to mess up my Rom.
TaZeR369 said:
I see, too bad it's a nice function to backup/restore I guess I'll just backup my important data individually and try not to mess up my Rom.
Click to expand...
Click to collapse
Check this out. I haven't used it yet but I'm about to try it. Join «Migrate - Custom ROM Migration Tool» on Telegram: https://t.me/migrateApp
https://forum.xda-developers.com/android/apps-games/app-migrate-custom-rom-migration-tool-t3862763
There's a new add-on for it on telegram link
TaZeR369 said:
I see, too bad it's a nice function to backup/restore I guess I'll just backup my important data individually and try not to mess up my Rom.
Click to expand...
Click to collapse
Me too. I haven't a bit of luck with encrypted stock restores. I was told it would work if you don't restore /data, but when I made a backup without /data, it failed to restore. I HAVE been able to restore unencrypted customs though. I only backed up system, data, and boot when I succeeded. It's been a while. I think you have to wait a long time for the 1st boot after the restore, as if it were rebuilding ART or something. Haven't had any luck stopping stock from encrypting either. I hate not messing up my ROM. Boring.....
Perhaps I am missing a critical detail, but I just successfully restored my latest LOS(lineage-17.1-20200524-UNOFFICIAL-ocean) & older CRD(crDroidAndroid-10.0-20200405-ocean-v6.4) backups(*) using TWRP(twrp-installer-3.3.1-2-ocean).
SELinux is NOT enforced, but "Trust"(lulz) claims the phone is encrypted.
My methodology requires installing the same base f/w I used when originally installing the ROM(former newest RETAIL for CRD & newest RETUS for LOS), root, flash copy partitions zip, flash>factory reset>1st boot of the original ROM zip, enable debug, install TWRP, boot into TWRP, wipe all & restore backup(*).
I just restored successfully 2x's on my xt1955-5.
I loaded LOS 10 & 3rds from scratch, made all my settings tweaks & made Titanium b/u(JIC), made TWRP b/u(*) then restored my previous CRD daily install using steps above. Then I repeated the above steps(again) to go back to my new, fresh LOS. It is annoying to have to reload f/w, et al, but def easier than reloading & retweaking the OS & all 3rds from scratch... Titanium fails to restore most settings + other nits.
To restore a backup(*) of a ROM I am currently running, I just boot to TWRP, wipe all & restore.
*: To make the original TWRP backup, I will run it & it will fail. I open the log file and find the last file/folder that "error"ed, delete the offender & re-run backup(boot, data & system). It works for me, no DM-verity flash required.
As always, YMMV.
Edit: PS: The problems seem to be stemming from beta testing the new "Trust"(lulz) framework, on all 10 ROMs(?). Would be nice to get that ironed out. A new Recovery wouldn't hurt, either. AFAIK, these problems exist in OFR, too.
googleverifysux said:
Perhaps I am missing a critical detail, but I just successfully restored my latest LOS(lineage-17.1-20200524-UNOFFICIAL-ocean) & older CRD(crDroidAndroid-10.0-20200405-ocean-v6.4) backups(*) using TWRP(twrp-installer-3.3.1-2-ocean).
SELinux is NOT enforced, but "Trust"(lulz) claims the phone is encrypted.
My methodology requires installing the same base f/w I used when originally installing the ROM(former newest RETAIL for CRD & newest RETUS for LOS), root, flash copy partitions zip, flash>factory reset>1st boot of the original ROM zip, enable debug, install TWRP, boot into TWRP, wipe all & restore backup(*).
I just restored successfully 2x's on my xt1955-5.
I loaded LOS 10 & 3rds from scratch, made all my settings tweaks & made Titanium b/u(JIC), made TWRP b/u(*) then restored my previous CRD daily install using steps above. Then I repeated the above steps(again) to go back to my new, fresh LOS. It is annoying to have to reload f/w, et al, but def easier than reloading & retweaking the OS & all 3rds from scratch... Titanium fails to restore most settings + other nits.
To restore a backup(*) of a ROM I am currently running, I just boot to TWRP, wipe all & restore.
*: To make the original TWRP backup, I will run it & it will fail. I open the log file and find the last file/folder that "error"ed, delete the offender & re-run backup(boot, data & system). It works for me, no DM-verity flash required.
As always, YMMV.
Edit: PS: The problems seem to be stemming from beta testing the new "Trust"(lulz) framework, on all 10 ROMs(?). Would be nice to get that ironed out. A new Recovery wouldn't hurt, either. AFAIK, these problems exist in OFR, too.
Click to expand...
Click to collapse
Have u tried the new 3.5 twrp
Lol...and here it is a couple years later and I'm still searching whether a force-encrypted twrp backup of stock has been figured out how to restore...Pulled up my own thread. Lol.
i miss being able to backup android properly. it made me behave completely differently with my phone. it was a toy instead of just some tool. i'd just install every single rom, kernel modem operating system i could find or i'd just plagiarize the hell out of you guys for sh*ts and giggles and man i loved android so much back then but now its my cell phone. :\ i just liked the colorful language, i wasn't signing anybody else's code.
it's such a tedious thing now, even compared to before and i suppose that's their intention perhaps.

Question How does restoring work in this phone?

For context, I want to clear up a few things before trying to root so I don't end up bricking the phone.
So after reading a few threads it seems even recovering via twrp is messed up in this phone. Can someone shed some light on this matter?
Can I restore system, data, and boot partitions via twrp in case something goes wrong (while staying on official miui roms everytime, I don't intend to install custom roms) and I have to revert the phone back to the state it was in at the time of a backup?
It feels like at the very least we would be required to re-flash the entire firmware via mi flash tool and then restore whatever is needed via twrp later. Will this work?
Also I hear using twrp to install the official firmware is not a good idea, what's that about?
I know long post and a lot of questions, so please bear with me.
Thanks.
Custom ROMs and Stock ROMs differ in one aspect, which partitions are left untouched. Since stock ROM is a lot more invasive and formats all partitions, official flash method is recommended.
When you mess things up, mi flash tool is safest option. Its safe to experiment, backup, restore on boot+system+data in TWRP across ROM installs but don't mess up recovery partition. Remember to format data between ROM installs unless dirty flashing on same android version
miravision said:
Custom ROMs and Stock ROMs differ...
Click to expand...
Click to collapse
I see. Thank you for the reply!

Categories

Resources