Development [RECOVERY][3.7.0_12-8][UNOFFICIAL][UNIFIED] TWRP with A12/A13 encryption support

Search This thread

Nimueh

Recognized Contributor
May 19, 2012
3,557
3,277
OnePlus 3
Samsung Galaxy Tab A series
There is no need to flash TWRP permanently
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) :)
 

shadabkiani

Senior Member
Mar 2, 2018
488
192
Pakistan
HTC 10
OnePlus 9
@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.
 

der_akinator

Senior Member
Mar 27, 2015
231
395
Berlin
OnePlus 3T
OnePlus 9 Pro
@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.
Great
 
  • Like
Reactions: shadabkiani

shadabkiani

Senior Member
Mar 2, 2018
488
192
Pakistan
HTC 10
OnePlus 9
@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.
 

Nimueh

Recognized Contributor
May 19, 2012
3,557
3,277
OnePlus 3
Samsung Galaxy Tab A series
@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.
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:
 

forever_lol

Senior Member
Mar 18, 2013
975
373
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 ;)
 

Nimueh

Recognized Contributor
May 19, 2012
3,557
3,277
OnePlus 3
Samsung Galaxy Tab A series
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 ;)
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. 🤷‍♀️
 
  • Like
Reactions: forever_lol

shadabkiani

Senior Member
Mar 2, 2018
488
192
Pakistan
HTC 10
OnePlus 9
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 ;)
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.
 
  • Like
Reactions: forever_lol

[GR]Frostbyte

Senior Member
Jan 9, 2012
192
75
33
Q3DM6
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:

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! :)

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 ;)
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:

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.
 
Last edited:

Nimueh

Recognized Contributor
May 19, 2012
3,557
3,277
OnePlus 3
Samsung Galaxy Tab A series
It's possible to get that orange state warning off?
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 😅

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.
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*. 😱
 

shadabkiani

Senior Member
Mar 2, 2018
488
192
Pakistan
HTC 10
OnePlus 9
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! :)
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.
 

Attachments

  • abl.img
    204 KB · Views: 7

Nimueh

Recognized Contributor
May 19, 2012
3,557
3,277
OnePlus 3
Samsung Galaxy Tab A series
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.
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:
 
  • Like
Reactions: [GR]Frostbyte

shadabkiani

Senior Member
Mar 2, 2018
488
192
Pakistan
HTC 10
OnePlus 9
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:
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.
 

Nimueh

Recognized Contributor
May 19, 2012
3,557
3,277
OnePlus 3
Samsung Galaxy Tab A series
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.
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 :)
 

Nimueh

Recognized Contributor
May 19, 2012
3,557
3,277
OnePlus 3
Samsung Galaxy Tab A series
fastbootd should work...
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 😇
 

Attachments

  • fastbootD error.jpg
    fastbootD error.jpg
    35.5 KB · Views: 25
  • Like
Reactions: galaxys

Mikefy

New member
Jan 17, 2017
4
1
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 )
 
Last edited:

der_akinator

Senior Member
Mar 27, 2015
231
395
Berlin
OnePlus 3T
OnePlus 9 Pro
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 😇
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.
 

shadabkiani

Senior Member
Mar 2, 2018
488
192
Pakistan
HTC 10
OnePlus 9
Hello everybody! Someone can put IMG file TWRP for adnroid 13.? i wanna boot TWRP but not flash . on links i see only twrp-installer-3.7.0-12.1-8-lemonadep.zip . so only installers zip files. but no IMG files. i need twrp.img for a13. someone help please )
Download link is in the first post. Here it is again:

Go inside the folders and you will see boot.img. 23-05-16 is the latest.
 
  • Like
Reactions: Mikefy

Top Liked Posts

  • There are no posts matching your filters.
  • 9
    still no official twrp version for android 13 ?
    A couple of other devs and I are working on a TWRP build based on A13 sources. But progress is slow, mainly due to the fact that it will not bring much benefit compared to A12.

    Some updates about the state of official OP9 (A12) builds:
    The latest device-specific changes have been uploaded and are mostly reviewed. A new point release is planned for the near future, so official builds will be available soon. I don't see much benefit in having official nightly builds, because this is what you can get here, or builds from 3.7.0 sources that are missing some bug fixes.
    5
    Hello! Please help! What TWRP should be put on android13? Phone OnePlus 9 Pro LE 2127
    OOS users should make a backup of boot before installation. Otherwise incremental updates can't be applied.
    Installation overwrites all boot partition changes done previously (e.g. by Magisk or custom kernel). So you have to reflash all zips that change the boot partition after TWRP is installed.
    For permanent installation, you have three options depending on your current system.
    1. Option for rooted devices:
    1. Download the twrp-installer zip
    2. Flash it with Magisk manager or some other kernel flash utility
    3. Reflash your custom kernel and Magisk.apk if previously installed (see example of how to install with Magisk manager below). Or alternatively flash zips in TWRP.
      1. Don't reboot
      2. Rename downloaded Magisk.apk to Magisk.zip
      3. Open Magisk app
      4. Select Modules tab
      5. Click "Install from storage"
      6. Select Magisk.zip
    2. Option for users with other custom recoveries but without root:
    1. Download the twrp-installer zip
    2. Reboot to recovery
    3. Flash it with "adb sideload twrp-installer*.zip"
    4. Reboot to recovery
    5. Reflash your custom kernel and Magisk.apk if previously installed
    3. Option is universal:
    1. Download boot.img
    2. Reboot to bootloader
    3. Run "fastboot boot boot.img" with the TWRP boot image on your PC
    4. Go to Advanced > Flash Current TWRP
    5. Reflash your custom kernel and Magisk.apk if previously installed
    4
    Thank you! But which version of TWRP needs to be installed? On android 12 I installed 3.7.0_11-0-emonadep.zip. Is this version suitable for android 13 or not?
    3.7.0_12 is fine for A12 and A13.The old 3.7.0_11version has issues with encryption
    For LE 2127, you have to make a backup of your boot partition. Otherwise you can get problems when you try to update.
    3
    If it is not difficult. Tell me how to create on OnePlus 9 Pro backup boot partition ?
    the backup is only important, if you are using OOS (stock ROM). For that you can also follow "Try without installation" and use the backup feature. You can either make a full backup or just select "boot" an make a backup.
    3
    still no official twrp version for android 13 ?
    The 12 branch decrypts 13 just fine.
  • 55
    This is an unofficial build of TWRP, based on the Android 12.1 branch, that supports encryption used by Android 12 and 13 ROMs. This build is tested on OP9 pro, but it was confirmed to work on regular OP9 too.

    As always I'm not responsible for any bricked device or data loss resulting from the use of this TWRP builds. You use this at your own risk.

    For ROMs using FBEv1 encryption aka A11 encryption, please use the official builds by
    @Nebrassy from:

    Download:


    Installation:

    Permanent installation is not possible with TMO 12 stock ROM installed. With TMO 13 stock it's possible, but it was reported that uninstalling causes issues.

    OOS users should make a backup of boot before installation. Otherwise incremental updates can't be applied.

    Installation overwrites all boot partition changes done previously (e.g. by Magisk or custom kernel). So you have to reflash all zips that change the boot partition after TWRP is installed.

    For permanent installation, you have three options depending on your current system.

    1. Option for rooted devices:
    1. Download the twrp-installer zip
    2. Flash it with Magisk manager or some other kernel flash utility
    3. Reflash your custom kernel and Magisk.apk if previously installed (see example of how to install with Magisk manager below). Or alternatively flash zips in TWRP.
      1. Don't reboot
      2. Rename downloaded Magisk.apk to Magisk.zip
      3. Open Magisk app
      4. Select Modules tab
      5. Click "Install from storage"
      6. Select Magisk.zip
    2. Option for users with other custom recoveries but without root:
    1. Download the twrp-installer zip
    2. Reboot to recovery
    3. Flash it with "adb sideload twrp-installer*.zip"
    4. Reboot to recovery
    5. Reflash your custom kernel and Magisk.apk if previously installed
    3. Option is universal:
    1. Download boot.img
    2. Reboot to bootloader
    3. Run "fastboot boot boot.img" with the TWRP boot image on your PC
    4. Go to Advanced > Flash Current TWRP
    5. Reflash your custom kernel and Magisk.apk if previously installed

    Try without installation:
    1. Download boot.img
    2. Reboot to bootloader
    3. Run "fastboot boot boot.img" with the TWRP boot image on your PC

    Uninstall:

    Just flash the boot partition with your current ROMs boot image with the following steps.
    Replace "YOUR ROM BOOTIMAGE" with the filename of the extracted boot image of your current ROM.
    1. Reboot to bootloader
    2. Run "fastboot flash boot_a YOUR ROM BOOTIMAGE"
    3. Run "fastboot flash boot_b YOUR ROM BOOTIMAGE"
    Alternatively you can flash your currently installed OTA zip, which overwrites boot on the unused slot, but not on the currently used one.

    Collection of OOS boot images:

    TWRP Updates:
    1. Download and flash the twrp-installer zip
    2. After that reflash your custom kernel and Magisk if previously installed

    ROM Updates:

    Please follow the official update instructions for your ROM!

    If they give an option to update via recovery you have to substitute adb sideload commands with zip installations. Also use the "Automatically reflash TWRP after flashing a ROM" option, if you are going to install a ROM zip to preserve TWRP installation.

    In case your ROM does not provide a recovery update instruction you can try to update via recovery but you are on the safe side if you follow the official instructions. They always have a reason for their particular update instructions!

    Instructions that work for me (on LOS based ROMs):
    1. Flash ROM zip with "Automatically reflash TWRP after flashing a ROM" checked
    2. Flash your previously installed zips (custom kernel, Gapps, Magisk, etc)
    3. Reboot to system
    4. If Gapps packages keep crashing:
      1. Reboot to TWRP
      2. Flash Gapps again
      3. Reboot to system
    OOS full OTA updates should work out of the box.
    For incremental OOS updates, you have to flash the original boot image. Your can follow this short guide and use the boot image from link in the uninstall section.

    About backups/restore:

    Restore data only WITHOUT pin/pattern set.

    If you restore a backup made from another ROM, then the currently installed, you may have to format data. So please manually copy all contents from /sdcard to a PC or flash drive.

    Backups can be made with or without pin/pattern set. It is always good practice to copy your backups to your PC or an USB drive. Also after you restored your data partition you have to reboot to system and do a second reboot to get a working system.
    To make first boot faster and eliminate the need to reboot again, additionally use the step mandatory for OOS users.

    If you want to copy your backup to PC, but it doesn't show up, flash change_backup_selinux_context.zip, which is available in download folder.

    For OOS users:
    When data is restored, you have to delete "/data/system/users/0/package-restrictions.xml" before rebooting to system.

    In case you restore a backup with pin/pattern set or have some other issues I have a guide that works for me:

    How to use MTP, adb and fastbootD:

    Windows:
    Install official Google USB drivers and select the right USB drivers. For MTP and adb, the WinUSB driver is sufficient on Windows 11. For fastbootD, Google drivers (Android Bootloader interface) has to be chosen.
    You may have to select WinMTP for MTP and Google USB drivers for adb, if you run Windows 10.

    To use adb on Windows, MTP has to be disabled with "Mount->Disable MTP" in TWRP.

    Steps for choosing a specific driver (no the exact wording):
    1. Connect phone in specific mode
    2. Open device manager
    3. Right click on phone either under "Android device" or "USB device", depending on mode
    4. Select "update driver"
    5. Select 2. option "browse my computer"
    6. Select "pick from available drivers"
    7. Pick driver according to above description
    Linux:
    1. Intall the fastboot and adb packages for your distribution
    2. Set udev rules. There might be a package for your distro or use this gh repo: https://github.com/M0Rf30/android-udev-rules
    3. Add user to the group used in udev rules. Most common are "plugdev" and "adbusers"

    Source Code:

    Bugs:
    • Permanent installation alongside TMO stock isn't possible
    • Error message regarding vendor_dlkm in fastbootD for OOS users (just cosmetic and not problematic)
    • In case you notice anything else please let me know.
    If you encounter any bug, please give me description with logcat.txt and recovery.log output attached. You can copy those to your data folder in TWRP, if you go to Advanced->Copy Logs.

    Thanks to:
    • @Nebrassy for the original device tree
    • @osm0sis for the zip installer
    • TWRP team
    • LineageOS
    13
    Update
    • /data/fonts/* is excluded from backups (has to be verified by someone with backup errors)
    • screen turns completely off now
    • updated firmware files from LE2125_11.C.63 (maybe this helps with OOS13 problems)
    • initial installation is now possible without flashing vendor_boot (I tested a few combinations of installation methods and initial system configurations. So hopefully nothing is broken this time.)
    Have a happy New Year tomorrow!

    11
    Update
    • add vendor_boot and dtbo to backup targets
    • add CPU temperature output
    • fix vibration (still doesn't work in fastbootd mode)
    I tested this build on LOS 19.1 (OOS 12 firmware) and crdroid 13 (OOS 13 firmware). Also keep in mind that you have to use the boot image according to your installed firmware, if you want to install/test via fastboot.

    10
    Update
    • improve vibration support
    • fix kernel modules loading in fastbootd mode for custom roms (might result in an error message regarding vendor_dlkm for OOS users, but it's just cosmetic)
    Tested on LOS 19.1 (OOS 12 firmware) and crdroid 13 (OOS 13 firmware).

    10
    Good new for OOS users. One of the TWRP devs found a workaround for data restore on OOS. Just delete "/data/system/users/0/package-restrictions.xml", after data is restored. I will exclude this file by default in a future build, but for existing backups, the file must always be removed manually.

    Edit:
    This is also useful for custom ROMs, because it makes first boot faster and eliminates the need to reboot again.