Development [RECOVERY] [12] [OFFICIAL] TeamWin Recovery Project

Search This thread

PTX64

Member
Jan 22, 2022
6
3
41
twrp or nand /data backup has never been reliable. You could use backup made by app like migrate, swiftbackup, etc, they should be more reliable. Unless you're backing up partition other than /data (efs, modem, etc.), twrp should be fine,
I never tried Swiftbackup and Migrate 4.0 doesn't seem to properly support anything above Android 10. I did have some issues with Migrate and restoring app data in the past on my A11 en A12 devices.

Some people want a full backup of the data, even though some things will not work, like Signal that has it keys stored into a container. TWRP can also restore all Android settings, VPN, Wifi etc connections etc.
 
  • Like
Reactions: maximum117

PTX64

Member
Jan 22, 2022
6
3
41
While running the backup itself, it doesn't produce any errors on the screen and all seems fine (screenshot attached). But when you look at the backup log ( excerpt https://pastebin.com/8vv98bRM ), you'll see many "failed to lookup fscrypt tar policy for" errors.

First, I flashed the official fastboot images of Xiaomi onto the phone: mojito_global_images_V13.0.7.0.SKGMIXM_20220418.0000.00_12.0_global

Then I did a "fastboot erase" on the metadata, userdata, misc, apdp and multiimgoem partitions.

Next, I installed this 12.1 TWRP, Magisk 25.1, NikGapps-core-arm64-12-20220421-signed.zip and lineage-19.1-20220614-UNOFFICIAL-mojito.zip in the right order.

Then I did the same erase process as above and rebooted the phone into Lineageos without issues (and without multiple user profiles).
 

Attachments

  • Screenshot_2022-06-30-05-36-10.png
    Screenshot_2022-06-30-05-36-10.png
    202.3 KB · Views: 31
Last edited:
  • Like
Reactions: maximum117

PTX64

Member
Jan 22, 2022
6
3
41
I might be related that TWRP is using TW_USE_FSCRYPT_POLICY := 2 (2 = default, while the device might be using TW_USE_FSCRYPT_POLICY := 1 ) and when it's policy is '1' it must be specified in https://github.com/nebrassy/device_xiaomi_mojito-TWRP/blob/android-12.1/BoardConfig.mk

Looking at the previous errors at pastebin, which TWRP caused to bail out in the past on backups/restores (not anymore since https://gerrit.twrp.me/c/android_bootable_recovery/+/4231 ). Now it simply continues the backup assuming nothing is wrong, but without storing the right policy for each file and/or directory.

Code:
I:addFile '/data/vendor' including root: 0
failed to lookup fscrypt tar policy for '/data/vendor' - '7778812a000000000000000000000000

But when you run a check in the TWRP shell:

Code:
sunny:/ # fscryptpolicyget /data/vendor                                                                                                                       
000000007778812a

And without backing up and restoring files without their required policies, then this should cause problems. Where it exactly lies, I don't know yet.

But looking at https://gerrit.twrp.me/plugins/giti...ery/+/refs/heads/android-12.1/libtar/append.c and searching for 'failed to lookup fscrypt tar policy for'.... I have a feeling that it looks up the wrong hex ''7778812a000000000000000000000000'' instead of the 16 hexadecimal characters of '000000007778812a'
 
Last edited:
  • Like
Reactions: maximum117

Mthw

Senior Member
May 12, 2013
225
61
HTC EVO 3D
Lenovo Vibe P1m
I just tried the linked version and it doesn't start. I did 'fastboot boot twrp.img' which did reboot me to TWRP but then it got stuck on the splash screen (?) and after a while screen started flashing like a bootloop. Did I do something wrong? I am currently on PixelOS with OrangeFox recovery.
I don't know what I did wrong but it works now with the latest version.
 

Zirila

Senior Member
Jul 31, 2015
206
90
Data restoration breakes the system. After backup and restore I get mi logo two times and recovery autostart. Rom PE a12 and PE+ a12. Stock kernel, no root or modifications.

Thank you for this 12.1 release Nebrassy. Decrypting /data works flawlessly.

But restoring a TWRP backup results into the problem described here above. Screenshot of the TWRP log here after it restarts into TWRP instead of the OS.

Been playing around with TWRP backups on this phone a year ago. You have to remove the device password/pattern in Android before you make a TWRP full backup. Then you can restore the backup. Well in theory. If i remember correctly, the best practice was to just flash the new ROM and only restore the /data partition (that was made without encryption password).

I never relied on this, though. Always make an app-wise backup as second safety option.
 
  • Like
Reactions: spider1163

PTX64

Member
Jan 22, 2022
6
3
41
Been playing around with TWRP backups on this phone a year ago. You have to remove the device password/pattern in Android before you make a TWRP full backup. Then you can restore the backup. Well in theory. If i remember correctly, the best practice was to just flash the new ROM and only restore the /data partition (that was made without encryption password).

I never relied on this, though. Always make an app-wise backup as second safety option.
I relied on my Note 10 like I did on my Linux systems, which was a very wise decision before making backups 🙃.

Asuming that the latest original firmware is used ( mojito_global_images_V13.0.9.0.SKGMIXM_20220616.0000.00_12.0_global_2e8598ffa6.tgz ), the /data partition is using a F2FS filesystem with FSCRYPT (ENCRYPTION_POLICY V2) file based encryption on top of it.

Each encrypted directory tree in /data is protected by a/the master key (per user / derived from a screenlock pin or password hashing), which may be a default master key when you've disabled the screenlock all together.

This TWRP 12.1 version can decrypt or unlock the default master key / data partition, which is fine. The only problem is that the TWRP sourcecode is unable to backup and restore the encryption policies of most or all encrypted directory trees, which is required.

To be exact, found in /vendor/etc/fstab.default when mounted in TWRP:

/dev/block/bootdevice/by-name/userdata /data f2fs noatime,nosuid,nodev,discard,reserve_root=32768,resgid=1065,fsync_mode=nobarrier,inlinecrypt latemount,wait,check,formattable,fileencryption=aes-256-xts:aes-256-cts:v2+inlinecrypt_optimized+wrappedkey_v0,metadata_encryption=aes-256-xts:wrappedkey_v0,keydirectory=/metadata/vold/metadata_encryption,quota,reservedsize=128M,checkpoint=fs
 

maximum117

Member
Jan 7, 2011
30
5
Been playing around with TWRP backups on this phone a year ago. You have to remove the device password/pattern in Android before you make a TWRP full backup. Then you can restore the backup. Well in theory. If i remember correctly, the best practice was to just flash the new ROM and only restore the /data partition (that was made without encryption password).

I never relied on this, though. Always make an app-wise backup as second safety option.
Of course I removed pass/pin etc. before making backup and restoration. And I tried restore data partition only. More of that, to the official twrp if tou make backup with the pin/pass/fingerprint, after that wiped data, after that reboot to the system and set pin/pass/fingerprint that you used when made backup and after that restore backup you can boot system and get black desktop. But! if you reboot you get full worked system :)
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 44



    Introduction:

    Team Win Recovery Project or TWRP for short, is a custom recovery built with ease of use and customization in mind. We started from the ground up by taking AOSP recovery and loading it with the standard recovery options, then added a lot of our own features. It's a fully touch driven user interface , no more volume rocker or power buttons to mash. The GUI is also fully XML driven and completely theme-able. You can change just about every aspect of the look and feel.

    Key Features:

    Touchscreen driven with real buttons and drag-to-scroll
    XML-based GUI that allows full customization of the layout true theming!
    Settings are saved to the sdcard and persist through reboots
    Ability to choose which partitions to back up and which to restore
    Ability to choose to compress backups now with pigz (multi-core processor support for faster compression times)
    Onscreen keyboard
    Easy selection of internal/external storage

    In addition to the above new features, TWRP features a scripting engine that allows an app to send commands to the recovery for the recovery to perform during startup. We call this scripting engine OpenRecoveryScript. This engine will be put to use immediately in the GooManager app. GooManager will be able to install recoveries automatically for most supported devices. The app will also let you choose to install multiple zips from within Android, wipe, and run a backup.

    We are looking for other talented developers, themers, and device maintainers if they are interested in helping with a free, open source project.

    Source Code:

    GitHub - https://github.com/TeamWin/android_bootable_recovery

    Gerrit Instance - http://gerrit.twrp.me

    If you have made your own TWRP build for an unsupported device, please let us know. We might add your build to the list of unofficial builds. Bear in mind that we are working hard to add more devices and we may add your device to our official build list later.

    Hello, this is TWRP, for Redmi note 10 Global/India (sunny/mojito)

    Installation:
    1. fastboot boot twrp.img
    2. go to Advanced > Flash Current TWRP
    3. after that is done, if you were using a custom kernel, reflash it now
    4. if you were using magisk, reflash it now

    Updating to a newer build:
    1. download new build to internal storage
    2. go to Advanced > Install Recovery Ramdisk
    4. select the new image
    5. after that is done, if you were using a custom kernel, reflash it now
    6. if you were using magisk, reflash it now

    Send me a beer: Crypto(Preferred) | PayPal

    Tree: https://github.com/TeamWin/android_device_xiaomi_mojito

    Telegram group: https://t.me/NSSFB

    Download: https://twrp.me/xiaomi/xiaomiredminote10.html

    Unofficial android 12 builds:
    https://www.pling.com/p/1836625/
    mirror: https://store.kde.org/p/1836625/
    9
    uploaded new build

    fixed more cases of flashing failing
    fixed some cases of decryption failing
    9
    Official builds have started

    8
    new build with repacking support is up, installation instructions are in the OP
    7
    3.5.2 is up

    fixed adb sideload and fastbootd
    fixed vibration
    further fixes for flashing roms
    new installation method, updated OP