yashsingh1/xdaforums huggingface dataset:
[OnePlus 9 Pro] [GR]Frostbyte:
I got a 9 Pro about a week ago, with the sole purpose of getting LOS and TWRP onto it.

(I've been using them since my first smartphone and the days when we still had CM9)

I have to say that the first two days of attempts and experimentation were quite the experience, bricking and bootlooping the device more than 15 times in a row, while trying to make sense of this new (to me at least, coming from an OP3) A/B scheme thing.

Thankfully, with the existence of MSM, it was always possible to have a way to restore and have another go at it.

Even when I reached the point of successfully flashing and booting into LOS20 (w/ Gapps), getting TWRP properly on the device was a considerable challenge; as my inadequate knowledge at that point, made me prone to further time-consuming mistakes, that would require me to start the whole process over.

There were many hidden traps along the way, bootloops and bricks when trying to install the official TWRP (and LOS/Gapps) through any sequence or method of procedure that I could come up with (sideloading the installer zip, booting through fastboot and then using the Flash Current TWRP option, directly flashing to boot partition, etc, etc) once the officially provided install instructions (and any slight variations I could think of performing) would fail for me.

When I eventually stumbled upon this thread by chance, I managed to make everything work flawlessly.

For this I would have to say a heartfelt thank you to der_akinator and of course to everyone else who contributed their time and effort into helping bringing this TWRP to a functional state and further polishing it afterwards.

The lessons learned were to

never use a version of TWRP intended for another (especially lower) version of android

and also to

never attempt to directly flash TWRP to the boot partition

(since the days of having a separate recovery partition are long gone and partition schemes are becoming more and more complicated by the day).

I personally reckon that perusing a detailed article about how that A/B scheme works and how to work with it (also including those two "do nots" I just mentioned, in huge bold red lettering) should be an absolute prerequisite for anyone wanting to mess with flashing or rooting their phone.
[OnePlus 9 Pro] der_akinator:
One last attempt for an unified boot image for regular OP9. This time I'm a bit more optimistic, since it is a more up to date kernel, compared to the OOS 11 based one from the last attempts. Also I could figure out the exact commits that caused issues with different firmwares.

So I would be very grateful for a couple of testers. Thanks in advance.

lemonade-test - Google Drive

drive.google.com
[OnePlus 9 Pro] shadabkiani:
TWRP isn't mandatory anymore as it used to be. You can flash a particular custom ROM from it's own recovery's sideload function. Almost all ROM ask you to flash it's 3 partitions first (boot.img vendor_boot.img dtbo.img). As you might have already figured boot.img contains recovery. So then you reboot to custom ROM's recovery and sideload the ROM.

If, however, you ever feel the need to use TWRP for whatever reason, you just temporarily boot by this command fastboot boot <your_recovery_boot.img> There is no need to flash TWRP permanently
[OnePlus 9 Pro] shadabkiani:
But the folder still contains LOS12 and LOS13 images. What do you mean by unified? As I understand it, it means unified for whatever android version. Am I corect?
[OnePlus 9 Pro] [GR]Frostbyte:
Yes I am aware of all those things (as you might've guessed I am a power-user who just got a little hasty and went by heart, following past knowledge). Of course, after learning from my mistakes (and some times the only way to learn is to actually do and correct those mistakes yourself) I figured all of the stuff you mentioned already. Now, regarding to whether TWRP is a necessity or not anymore, I'd say that this falls into a matter of personal preference nowadays. Personally I don't use it to flash things as much anymore, as you said sideloading is a much preferred option nowadays. My primary usage is the reliability of it's backups, as the ability to restore to an exact point in time (akin to a vm snapshot) has saved me from many fckups in the past.
[OnePlus 9 Pro] der_akinator:
Should be both unified. One has los 20 kernel AS a base and the other los 19 kernel. I just uploaded both for testing
[OnePlus 9 Pro] Nimueh:
I beg to differ here.

A) TWRP is still the best option to make full backups, important for those of us that like to try different roms but might end up wanting to go back to the one they had.

B) TWRP is also still the best option if you get a bootloop or similar shenanigans from a Substratum theme or any other installed mod. In the case of a subs theme I can simply flash the rescue.zip, for other mode I can delete their folder. Much easier than fussing about with safe mode, which tends to reset stuff like default launcher and other defaults.

TWRP or other custom recoveries are still very much needed and useful imho (y) :)
[OnePlus 9 Pro] shadabkiani:
@der_akinator I have tested and both of them are working fine. I am currently running Xtended ROM v7.0 (build 20230516) based on OOS 13.

I have tested the following features on TWRP:

- Decryption

- Terminal

- File Manager

- Backup (only EFS)

- Copying files through MTP (workaround from Device Manager as you explained before)

- Changing brightness and vibration levels

Great work. Really appreciate it.
[OnePlus 9 Pro] der_akinator:
Great
[OnePlus 9 Pro] shadabkiani:
@Nimueh TWRP is indeed very useful, and I did not doubt it in the least bit. That's the reason I'm in this thread testing every new build as soon as it's up. When I said "There is no need to flash TWRP permanently", I was referring to the flashing permanently part. You can use it to it's fullest potential by just temporarily booting it. I don't know if having it permanently flashed gives any added benefits. The reason I don't feel like having it permenent is that in my opinion, it's best to leave the boot.img partition unchanged/unpatched if possible. Again, I might be ignorant to some details and more likely to be wrong in my view.
[OnePlus 9 Pro] Nimueh:
I'm rooted anyway, so my boot.img is no longer stock/unchanged. The only downside I've noticed when having TWRP installed is that I can no longer get to fastbootD ... but I only needed to use that once so far when I tried to flash that abl file to get rid of the orange state unlock warning. Instead I used Firmware Flasher and got rid of it that way lol.

If I have TWRP installed then I don't need to worry about being near a PC when I try a new theme or Magisk mod. So having it permanently does have it's advantages :cool:
[OnePlus 9 Pro] forever_lol:
If I may, which partitions are to be chosen to back up? (When switching between custom roms, let's say the same firmware base) It used to be system, data and boot. I guessmuch has changed since nexus/HTC times ;)
[OnePlus 9 Pro] Nimueh:
I have this post with the instructions bookmarked from my 8P. I haven't seen a similar post for the 9P but I hope it would be the same. 🤷‍♀️
[OnePlus 9 Pro] shadabkiani:
On newer phones like OnePlus 9, there is a dynamic partition called /super and it contains /system /product /odm /vendor and a few others depending on ROM. Backing up would work fine. However, restoring would only be useful if your current OS was on slot_a. If it was on slot_b, restoring would not be useful as phone would just not boot up although restore would be successful. I tried that so many times, with stock firmware. It just wouldn't work ever with slot_b, no matter what I did. You can read about my detailed experience here. OnePlus 8 is different though because I read somewhere that is has separate super_a and super_b partitions.

So my suggestion is to not to reply on backup partitions alone. Have a 2nd backup your personal data on PC too.
[OnePlus 9 Pro] [GR]Frostbyte:
It's exactly that. I 100% agree with what has been described here. Flashing may no longer be mandatory, but provides ease of use and portability (i.e. not having to carry a cable and laptop around, just to do a quick "safety" backup before something that you feel may cause a screwup); and if you're rooted anyways, nothing much changes in terms of stock/unchanged-ness.

You can still get to fastboot with the key combo I reckon, no? (vol-up + vol-down + pwr, long press)

It's possible to get that orange state warning off? I would like to inquire further information about this via PM good sir, thank you! :)

I have personally concluded to "super", "boot", "vendor_boot" and "data (exl. storage)".

I'm still pretty fresh to this A/B wizardry and dynamic partitions, so I would say that others like Nimueh and shadabkiani are way more qualified to answer.

In any case, if you're unsure, just take a backup of everything, as your first starting point; then you do have everything you need, should you ever need to restore it (knock on wood).

A good read on the topic is this one as well:

What should I back up in TWRP?

The default backup options in TWRP are system, data, and boot. For most cases, this is sufficient for backing up a ROM. (Note that in some rare cases, boot i...

twrp.me

Just make sure that any backups you take, you also keep them on multiple other locations (and ideally different storage mediums as well), for data safety.
[OnePlus 9 Pro] Nimueh:
Yea - there's some abl file to flash in fastbootD, but I used Firmware Flasher instead since fastbootD is broken when you have TWRP installed.

Simply download the correct firmware for your device (they should all be linked in that Github), flash in TWRP/other custom recovery and follow the prompts. Took like 10-15 seconds, no data lost, nothing wiped - you simply don't see the orange warning any more when booting up. You DO see the black screen longer than before though, which was definitely a scary sight the 1st time it booted after flashing it 😅

Oh no, I'm still not used to this a/b crap lol. While I have had the OP 7 and 8P before I never had the courage to flash a custom rom on either of them. I sold the the 7 a while ago, but I still have my 8P and keep it on OOS 11.

I specifically bought this 9P (used and fairly cheap) a couple of weeks ago and want to flash a custom rom on it. So far I still haven't mustered the courage though, and since our Bliss Rom maintainer is without a device for a bit and updates delayed that gives me a good excuse for waiting 😇

A/B partitions are scary, flashing instructions for it sounds complicated and at over 60 years of age I have a hard time getting used to new things. I still have an old OP 3 and 5T as well - the 3 spends most of it's time hibernating in my desk drawer. But the 5T has been lots of fun with different roms, I wish a/b was as easy to flash (and make nandroids of) as the old system *sigh*. 😱
[OnePlus 9 Pro] shadabkiani:
Yes, you can get rid of that annoying Orange State Warning. That warning is contained in abl.img. It wasn't there in OOS11, OOS12 and even the early builds of OOS13 too, but then I guess in F.16 or later (not quite sure) they added this warning. So you can flash abl.img from earlier OOS13 builds (again I don't know which versions exactly), or as I do it, flash from an earlier build of LOS 20. Mind you that newer builds of LOS20's abl.img also contain that warning. But I managed to get the abl.img from the last build it did not have that warning (attached below).

You need to flash from FastbootD mode though, as well as you need to have critical flashing unlocked, since it is a critical partition. As you mentioned before, you have TWRP permanently patched to your boot.img, I guess you can't get to FastbootD mode anymore. But as @Nimueh suggested, you can use firmware flasher. I think you can edit the firmware flasher file, and add my abl.img and remove other images from zip. That way only abl.img would be flashed I think.

Note: I use FastbootD mode, and I haven't tried flashing abl through firmware flasher though.
[OnePlus 9 Pro] Nimueh:
He doesn't need to edit in your abl file if he uses the Firmware Flasher. I'm not sure what exactly that flashes, but we end up with the same firmware on both slots (which I think is good for when we want to go to a custom rom?) AND without that warning. So 2 birds with 1 stone so to speak - but no editing/modifying anything is needed :cool:
[OnePlus 9 Pro] shadabkiani:
Getting the same firmware to both slots? That doesn't make the orange state go away, does it? You have to flash the right abl.img.

Or, the firmware you are flashing has the abl.img without warning? That might be the case.

This is a very useful guide and it has more than one way to safely flash abl.img without hassle if you are rooted.
[OnePlus 9 Pro] Nimueh:
It does make the orange state go away, I'm guessing it has the correct abl.img included already? And it's really simple too - just flash it from (custom) rcovery and that's it, no hassle at all.

For all those who have TWRP installed (like me lol), which means no more fastbootD, it's the simplest solution :)
[OnePlus 9 Pro] osm0sis:
fastbootd should work...

Also you can also flash abl while booted if you are rooted and want to do it manually, like `dd if=/sdcard/abl.img of=/dev/block/bootdevice/by-name/abl_a`

Same works in TWRP Terminal/adb shell.
[OnePlus 9 Pro] Nimueh:
But it didn't, and the smart folks in the OP 9 Telegram group said that's because fastbootD is broken in TWRP. I always ended up with that error and no matter if I tried to get to fastbootD via fastboot command or TWRP, I always ended up in the same spot again. I was told I should restore stock boot.img and then root + install TWRP again after flashing that abl file, but that seemed like a lot of hassle when using the Firmware Flasher achieved the same thing and was so simple 😇
[OnePlus 9 Pro] Mikefy:
Hello everybody! Someone can put TWRP.IMG for adnroid 13.? i wanna "boot"(run) TWRP but not "flash" . On links here i see only twrp-installer-3.7.0-12.1-8-lemonadep.zip . so only "installers.zip" files. but no "IMG" format TWRP files. i need "twrp.img" for a13. someone help please )
[OnePlus 9 Pro] der_akinator:
That error is related to kernel module loading. All custom roms install kernel modules to vendor_dlkm, but OOS does not. It uses vendor and vendor_dlkm doesn't exist. So this error isn't nice, but just cosmetic.

I tested fastbootd under windows and linux without any issues. You just have to make sure to install google usb drivers and select them to use fastboot with windows. I updated OP with a section related to mtp, adb and fastbootd and how to select the right drivers.
[OnePlus 9 Pro] shadabkiani:
Download link is in the first post. Here it is again:

twrp-lemonadep - Google Drive

Go inside the folders and you will see boot.img. 23-05-16 is the latest.
[OnePlus 9 Pro] Mikefy:
i saw that. so u wanna to say boot.img its Recovery.img? boot and recovery imgs it's a different things ))

i need exactly recovery.img not boot.img to run TWRP )
[OnePlus 9 Pro] filjusz:
There is nothing like recovery.img for this device. Why you just cant do what he said?
[OnePlus 9 Pro] shadabkiani:
I understand your confusion. We all shared the same confusion when coming to OnePlus 9 with dynamic A/B partitioning. All modern phones are now like this. :ROFLMAO:

There is no dedicated recovery partition anymore. Recovery now resides inside boot partition sharing the same kernel. So yes, boot.img contains recovery. That is why you don't flash it. You just boot it with command fastboot boot <your_recovery_boot.img> and then from TWRP you install/patch it permanently if you want (although permanent is not needed and I won't recommend). Just temporarily boot it and use it for whatever reason.
[OnePlus 9 Pro] Mikefy:
OH SHOOT :ROFLMAO::ROFLMAO: now i get it....right new system with A\b....OMAGOD. iam so exuse for my stupid

u right. boot.img from link work like TWRP .thx for explane! I appreciate it
[OnePlus 9 Pro] shadabkiani:
Yeah. Just another bit of information that if you flash a custom ROM like LineageOS, you would notice it might ask you to download recovery.img, but keep it mind that it is essentially boot.img, even though it is named recovery.img. (That was the case in early builds, I don't know if they still have one of the required files named as recovery).
[OnePlus 9 Pro] PartyZone:
I need your help guys so much! I am desparate.

OP9 pro, unlocked, rooted.

I was so stupide to set the pattern, never used it before in my life. So I forgot it.

Now the device doesn't wants any of fingerprint or the pincode, or gmail, or 2FA, nothing but the f.. pattern.

Fastboot is recognized. adb "no devices"

When loading from TWRP the data can't be mounted, it's 0kb.

When tried to restore the backup on another device, it's still asking for a pattern.

Please help, if it's even possible not to loose everything.

Thanks guys!
[OnePlus 9 Pro] der_akinator:
There can't be done much, if you forgot you pattern. For the adb issue you have to use Mount-> disable MTP. If you have your backup stored on PC or a flash drive, you can factory reset data and restore the backup. Keep in mind the backup only includes apps and settings ando so on, but NOT pictures, downloads and everything that is stored under /sdacrd.
[OnePlus 9 Pro] PartyZone:
OMG. So I did managed how to push files to device and install it with twrp. So you are saying despite this, nothing can't be done? Even not google backup restore after reset?

2nd questiom

Does it count's the pattern tryes when trying to decrypt inside the twrp?

I also can see the data size now instead of 0.

Thanks
[OnePlus 9 Pro] der_akinator:
Google (cloud) backup and so should work, if you have enabled it and it's synced. I never used restricted login attempts, so I'm not sure if twrp has any effect on that counter.

I would suggest to pull the contents of /sdcard, if you can access it. The other stuff in /data is already in the backup, that is hopefully on you PC or any other storage media.
[OnePlus 9 Pro] PartyZone:
No, I don't have any twrp backup. Also as I said for the google full backup to restore the device it still demands the pattern. So it's lost i guess.
[OnePlus 9 Pro] der_akinator:
You can try to use you normal google password for the backup, but it's not really clear what exactly is used to encrypt those backups.

Back up or restore data on your Android device - Android Help

You can back up content, data, and settings from your phone to your Google Account.

support.google.com
[OnePlus 9 Pro] PartyZone:
Sorry, I don't really understand what do you mean. Beacause google asks for the pattern in order to restore backup. Not the pin, not the google password or 2fa, Nothing.Only the pattern is all it knows in this world. I am frustrated.
[OnePlus 9 Pro] PartyZone:
My logic is simple. If TWRP knows what is the right pattern, then it's at some file inside the system, not a cloud or something.

So if we determine what the file this is, then we can decrypt the numeric to 3x3 pattern.

I have an access to the files beacause of an unlocked and rooted device. So why not to find the file which storing the pattern?
[OnePlus 9 Pro] filjusz:
Good luck in finding it.
[OnePlus 9 Pro] der_akinator:
The link states that google either uses google password or phone pin for backups. So it seems you don't have luck.

TWRP essential does the same as default android, and there is no password stored. That would defeat the whole purpose of encryption. I'm not sure about the internals, but broadly speaking the system tries to decrypt with your provided pattern and if the result doesn't make sense, you get an error.
[OnePlus 9 Pro] PartyZone:
Absolutelly. It's such nonsence. But it asked for the pattern on a new phone when tried to setup the phone using backup stored at google account which I loged-in. And no any other option!!!
[OnePlus 9 Pro] TheGhost1951:
When I use to enable Google backup....it was done based on my Gmail account. If I re-did my phone and needed to restore everything from Google, during phone setup I would log into my Gmail account after connecting to wifi and everything was restored (usually) as part of phone setup. However, since Google is not totally reliable, I have gone to SwiftBackup (rooted) and currently testing oandbackup (not rooted).
[OnePlus 9 Pro] TheGhost1951:
Oandbackup requires root, last but not least there is Helium for non-root backup of apps and data. But I would still rather have a rooted phone just for the possibilities!
[OnePlus 9 Pro] shadabkiani:
Lock settings are stored in /data/system/locksetting.db and other files with filenames locksettings. Now since /data/ is encrypted, you cannot access it without decrypting. And, even if you decrypt phone by entering correct pattern, and then you delete those files, that would make the entire /data useless and forever encrypted because there would be no way to decrypt it anymore.

On my HTC 10, I have custom ROM installed and /data isn't encrypted by default, unlike OnePlus 9. You have to manually encrypt from Settings > Security if you want. So, if I don't have encryption, I can go to TWRP and simply delete /data/system/locksettings.db and phone lock would just go away. However, if encryption is enabled, and I go to TWRP, decrypt with correct lock code, then delete the same files, it would not work. The phone will boot up and would be stuck after bootanimation. I would have to format data and only then it would work again.

Ain't no way you can bypass encryption. You either enter the correct lock code, or just get super lucky and try again again through brute forcing.
[OnePlus 9 Pro] [GR]Frostbyte:
I would also like to add my own two cents, as a senior UNIX/Linux system administrator, to these already helpful excerpts of information.

@PartyZone

Even if the stars could align and a decrypted version of the file that the pattern/pin is stored in could be found, one could never get the actual pattern/pin out of it; the reason being that the actual pattern/pin is being hashed (with blowfish/bcrypt being the latest trend) and usually salted too.

This means that when one enters a password/pattern/pin, the input is being hashed once more and compared against the stored hash. Hashing is typically considered to be a one-way process, which cannot be reversed (while in theory it technically could, it would require immeasurable processing power to do so).

As you also might've guessed, an added salt makes the possibility of a successful decryption even more unfathomable. (Further details and explanation can be found here)

As @der_akinator most eloquently and accurately put; an encryption process which could be reversed (at least not without an insurmountable cost), would defeat it's whole purpose and existence in the first place.
[OnePlus 9 Pro] Nhatlienhoan:
I cannot flash OOS full zip with TWRP can I?
[OnePlus 9 Pro] immortalwon:
You can, just move it to internal storage and flash or use OTG storage or even adb sideload.
[OnePlus 9 Pro] Nhatlienhoan:
Can't. Errorcode:: kDownloadManifestparseError.
[OnePlus 9 Pro] TheGhost1951:
Maybe a corrupt download of file. Try downloading again.
[OnePlus 9 Pro] Nhatlienhoan:
I redownloaded LE2115_F17.zip and installed but still failed with the same error...
[OnePlus 9 Pro] immortalwon:
You are not being specific. How are you trying to flash the zip? Boot into TWRP, move the zip using a simple name like ota.zip in platform tools folder and go to twrp sideload.

In an admin command prompt from the same directory as the platform tools and ota, use this without quotes:

adb sideload ota.zip

make sure it's the right firmware.
[OnePlus 9 Pro] Nhatlienhoan:
I tried using TWRP flash and failed. Tried TWRP adb sideload and failed too. I think I have A12 firmware in slot A (I'm currently in slot B with lastest firmware 13.1) so I want to flash 13.0 F17 to slot A, but neither methods worked. Is it impossible to upgrade android version via TWRP?
[OnePlus 9 Pro] TheGhost1951:
In TWRP switch to slot A, try to sideload again, if it fails, switch back to slot B and reboot back to system. From what I am seeing you are on A13.1 and wanting to downgrade back to A13.0.....there could be an issue there in that procedure with downgrading!