Unable to backup using TWRP - Moto G6 Plus Questions & Answers

Hi. I have a Moto G6 Plus (evert) phone and I currently have LineageOS 17.1-20201117 installed on it. Everything works perfectly, however, there are some updates that I'd like to install. I'm not sure whether this will remove/corrupt Magisk (or break something else), so I wanted to back up all partitions using TWRP (3.5.1) just to be on the safe side. When I first booted into TWRP, I noticed that it didn't ask for a password, which it did before I had LineageOS on my phone. But now, nothing. If I attempt to do a backup, I get an error: createtarfork() process ended with error 255. I did some googling and apparently, this could be caused because TWRP can't read some partitions. I tried an older version of TWRP (3.4), but that didn't help.
Here's the recovery.log created while trying to back up:
I:Error adding file '/data/vendor/MFYxVGEouF4EC,7Sj90vJA/JjO3E2T3tbuQVW,frUXMWA' to '/external_sd/TWRP/BACKUPS/ZY322V6SQC/2021-03-13--16-49-49_lineage_evert-userdebug_10_QQ3A200805001_e3/data.ext4.win000'
Error creating backup.
I:ERROR tarList for thread ID 0 Error creating backup.
I:InfoManager saving '/external_sd/TWRP/BACKUPS/ZY322V6SQC/2021-03-13--16-49-49_lineage_evert-userdebug_10_QQ3A200805001_e3/data.info'
createTarFork() process ended with ERROR: 255 Backup Failed. Cleaning Backup Folder.
Looks like TWRP failed to back up /data/vendor/MFYxVGEouF4EC,7Sj90vJA/JjO3E2T3tbuQVW,frUXMWA. The name looks weird. I booted back into the system and opened Total Commander, navigated to /data/vendor/, and the directory looked "normal" with "normal" subdirectories and everything. So it seems like TWRP is not decrypting the data partition.
I can also see some other errors above this one.
I:Setting up '/data' as data/media emulated storage.
I:mount -o bind '/data/media' '/sdcard' process ended with RC=0
I:mount -o bind '/data/media/0' '/sdcard' process ended with RC=0 libc: Unable to set property "ro.crypto.state" to "encrypted": error code: 0xb libc: Unable to set property "ro.crypto.type" to "file": error code: 0xb
However, I'm not sure what this means exactly.
Here's the full log: https://pastebin.com/z8cQWQ21
I'm still kinda confused about TWRP not asking for a password. Before I had LineageOS (I was using the stock ROM with encryption enabled) TWRP was asking for a password. I also tried removing the password, but the backup failed anyway (same error). Most likely because encryption is still enabled regardless of whether there's a password/PIN/pattern set up.

br0kenpixel said:
Hi. I have a Moto G6 Plus (evert) phone and I currently have LineageOS 17.1-20201117 installed on it. Everything works perfectly, however, there are some updates that I'd like to install. I'm not sure whether this will remove/corrupt Magisk (or break something else), so I wanted to back up all partitions using TWRP (3.5.1) just to be on the safe side. When I first booted into TWRP, I noticed that it didn't ask for a password, which it did before I had LineageOS on my phone. But now, nothing. If I attempt to do a backup, I get an error: createtarfork() process ended with error 255. I did some googling and apparently, this could be caused because TWRP can't read some partitions. I tried an older version of TWRP (3.4), but that didn't help.
Here's the recovery.log created while trying to back up:
I:Error adding file '/data/vendor/MFYxVGEouF4EC,7Sj90vJA/JjO3E2T3tbuQVW,frUXMWA' to '/external_sd/TWRP/BACKUPS/ZY322V6SQC/2021-03-13--16-49-49_lineage_evert-userdebug_10_QQ3A200805001_e3/data.ext4.win000'
Error creating backup.
I:ERROR tarList for thread ID 0 Error creating backup.
I:InfoManager saving '/external_sd/TWRP/BACKUPS/ZY322V6SQC/2021-03-13--16-49-49_lineage_evert-userdebug_10_QQ3A200805001_e3/data.info'
createTarFork() process ended with ERROR: 255 Backup Failed. Cleaning Backup Folder.
Looks like TWRP failed to back up /data/vendor/MFYxVGEouF4EC,7Sj90vJA/JjO3E2T3tbuQVW,frUXMWA. The name looks weird. I booted back into the system and opened Total Commander, navigated to /data/vendor/, and the directory looked "normal" with "normal" subdirectories and everything. So it seems like TWRP is not decrypting the data partition.
I can also see some other errors above this one.
I:Setting up '/data' as data/media emulated storage.
I:mount -o bind '/data/media' '/sdcard' process ended with RC=0
I:mount -o bind '/data/media/0' '/sdcard' process ended with RC=0 libc: Unable to set property "ro.crypto.state" to "encrypted": error code: 0xb libc: Unable to set property "ro.crypto.type" to "file": error code: 0xb
However, I'm not sure what this means exactly.
Here's the full log: https://pastebin.com/z8cQWQ21
I'm still kinda confused about TWRP not asking for a password. Before I had LineageOS (I was using the stock ROM with encryption enabled) TWRP was asking for a password. I also tried removing the password, but the backup failed anyway (same error). Most likely because encryption is still enabled regardless of whether there's a password/PIN/pattern set up.
Click to expand...
Click to collapse
Your current ROM uses File-based Encryption (FBE) and apparently your TWRP build does not support this. Are you using an official TWRP build? Have you seen if in the TWRP thread for your device there are other users with the same problem?

Related

[Resolved] [Q] Error when doing backup in TWRP

I tried doing a backup and it fails each time on backing up system (either that or finishes it and fails straight after)
The log is attached. (I deleted previous backup info from it so it will fit the allowed size for upload, if its important tell me i'll divide the file)
The error message reads:
E:tar_open error opening ''
E:Error creating tar '' for thread 0
I:ERROR tarList for thread ID 0
E:Error creating backup.
I:createTarFork() process ended with ERROR=255
Click to expand...
Click to collapse
How can I fix this?
[edit]
 @xanthrax gave me the solution: enable compression

createTarFork() process ended with ERROR: 255 on backup

Hiya XDA, So i'm trying to back up my phone (Running CM13) to my memory stick, and it worked before, but now it seems to have broken and I don't know what the issue is. My log (adb pull /tmp/recovery.log) is below
Heres what I've tried
Reflashing TWRP
Going to a slightly older version (3.0.2-1)
Enabling and disabling encryption
with and without compression
Skipping MD5 and leaving it on
[BACKUP STARTED]
* Backup Folder: /usb-otg/TWRP/BACKUPS/ENU7N15A10005575/2016-12-10--16-58-06_cm_angler-userdebug_6.0.1_MOB30Z_b4fbca03c0/
Backing up Boot...
I:Reading '/dev/block/mmcblk0p34', writing '/usb-otg/TWRP/BACKUPS/ENU7N15A10005575/2016-12-10--16-58-06_cm_angler-userdebug_6.0.1_MOB30Z_b4fbca03c0/boot.emmc.win'
Iartition Backup time: 4
Backing up System...
Error opening: '/system/addon.d' (Not a directory)
I:Error in Generate_TarList!
Error creating backup.
I:InfoManager saving '/usb-otg/TWRP/BACKUPS/ENU7N15A10005575/2016-12-10--16-58-06_cm_angler-userdebug_6.0.1_MOB30Z_b4fbca03c0/system.info'
createTarFork() process ended with ERROR: 255
Backup Failed. Cleaning Backup Folder.
I:Copying file /tmp/recovery.log to /usb-otg/TWRP/BACKUPS/ENU7N15A10005575/recovery.log
I:Set page: 'action_complete'
Iperation_end - status=1
E:error opening '/usb-otg/LOST.DIR' -- error: No such file or directory
E:error opening '/usb-otg/TWRP' -- error: No such file or directory
Looks as though your memory stick isn't formatted correctly. Try Fat32 or possibly EXT4
It is Fat32?
frap129 said:
Looks as though your memory stick isn't formatted correctly. Try Fat32 or possibly EXT4
Click to expand...
Click to collapse
I don't have access to a Linux machine, but I could format it in my phone?
I'll try that. and will post any updates.
UPDATE:
Formatted it in Android, still same error
UPDATE 2:
Tried a different USB stick, same error.
The USB sticks I am using are:
amazon.com/SanDisk-Cruzer-Orbit-Drive-SDCZ58-032G-B35/dp/B00BPHTH4C
and
amazon.com/SanDisk-Ultra-Flair-Performance-SDCZ73-064G-G46/dp/B015CH1NAQ/
Remove /system/addon-d in twrp ?
Will my phone work properly after doing that?
UPDATE:
Renamed it to addon-dee in my prefered Filemanager (ES) and it's backing up now.
(thank god I decided to use a USB3 stick this time)
UPDATE 2:
Phone backed up and now is working fine! thanks.
I was having the same error until I updated TWRP to the unofficial 3.0.2-3
I have this problem and l have 17g free space in my internal storage but receive error 255 and i don't find addon in my storage plz help me for fixing this error
Sent from my Le X820 using XDA-Developers mobile app
m890 said:
I have this problem and l have 17g free space in my internal storage but receive error 255 and i don't find addon in my storage plz help me for fixing this error
Sent from my Le X820 using XDA-Developers mobile app
Click to expand...
Click to collapse
Should be under /system/ . Are you rooted? I don't know if you can see that part of system if you're not rooted.
My device is rooted but this file isn't there.
Sent from my Le X820 using Tapatalk
m890 said:
I have this problem and l have 17g free space in my internal storage but receive error 255 and i don't find addon in my storage plz help me for fixing this error
Sent from my Le X820 using XDA-Developers mobile app
Click to expand...
Click to collapse
It's not always the same file. Look at your log to see which file/dir is problematic.
SOLVED createTarFork() process ended with ERROR=255
SOLUTION
This solution worked on my Zenfone 3, running lineage Android 7.1.2.
I tried many other things, like flashing different versions of TWRP, deleting the recovery directory, renaming files and all the like.
You may deselect compression, change the TWRP-date / time : nothing works !
You need an PC / Notebook with adb installed.
- start your phone in recovery-mode (TWRP)
- connect to PC and get the recovery.log with following adb command
adb pull /tmp/recovery.log
You will find a copy of the file recovery.log in the directory, from which you started the command
- open an editor or choose your favourite file viewer to open recover.log
- search for the last entry of the word "Error"
- in the line before that, the recovery.log states the name of the file that causes the problem
(in my case it was /system/addon.d)
- disconnect phone from PC.
- restart your phone in "normal" restart (do NOT boot to recovery mode)
- use a root file browser (I used ES-explorer with root enabled) and navigate to that directory/file
- delete the file (which I did not do - I tried some other steps)
- restart phone
This took 3-4 minutes, but I did not delete the file addon.d right away. Instead, I did this:
step 1
navigated to /system/addon.d and copied addon.d to SD-card
step 2
in /system/ , I renamed addon.d "addon_BU.d".
This was successful. In /system/ , the only file visible was now "addon_BU.d"
step 3
tried to create a directory named addon.d inside /system/ because my recovery.log said quote\ ... system/addon.d (not a directory) ... \unquote
FAILED. The directory could not be created by ES-explorer
step 4
copied my backup file addon.d from SD-card back into its original location /system/.
This, I though, would work just fine, because I had renamed the original addon.d to addon_BU.d.
So after restoring addon.d , the only thing left to do would be delte addon_BU.d.
ES-explorer reported no error, but - surprise - there was no file "addon.d" present in /system/
The only file still there was "addon_BU.d"
well, let's go to
step 5
rename addon_BU.d back to it's original name "addon.d" using ES-explorer
FAILED.
addon_BU.d could not be renamed - this file really was screwed up big time !!!
I ended up with no addon.d - so I could have deleted it right away istead of starting my trial with step 1 ...
step 6
Anyway. Shut dowm my phone.
Rebooted my phone normally (not to recovery mode !!!)
This took considerably longer than normal - my heart rate had began to increase slightly if not to say I began to feel like a squirrel on red bull...
After roughly 3 minutes, I had a successful reboot to my OS (lineage Android 7.1.2)
step 7
Reboot again, this time to recovery mode (=TWRP)
and: backups work again.
Don't ask me why this worked and if it will work for you, but hey, give it a triy and let me know...
TheLMGN said:
Hiya XDA, So i'm trying to back up my phone (Running CM13) to my memory stick, and it worked before, but now it seems to have broken and I don't know what the issue is. My log (adb pull /tmp/recovery.log) is below
Heres what I've tried
Reflashing TWRP
Going to a slightly older version (3.0.2-1)
Enabling and disabling encryption
with and without compression
Skipping MD5 and leaving it on
[BACKUP STARTED]
* Backup Folder: /usb-otg/TWRP/BACKUPS/ENU7N15A10005575/2016-12-10--16-58-06_cm_angler-userdebug_6.0.1_MOB30Z_b4fbca03c0/
Backing up Boot...
I:Reading '/dev/block/mmcblk0p34', writing '/usb-otg/TWRP/BACKUPS/ENU7N15A10005575/2016-12-10--16-58-06_cm_angler-userdebug_6.0.1_MOB30Z_b4fbca03c0/boot.emmc.win'
Iartition Backup time: 4
Backing up System...
Error opening: '/system/addon.d' (Not a directory)
I:Error in Generate_TarList!
Error creating backup.
I:InfoManager saving '/usb-otg/TWRP/BACKUPS/ENU7N15A10005575/2016-12-10--16-58-06_cm_angler-userdebug_6.0.1_MOB30Z_b4fbca03c0/system.info'
createTarFork() process ended with ERROR: 255
Backup Failed. Cleaning Backup Folder.
I:Copying file /tmp/recovery.log to /usb-otg/TWRP/BACKUPS/ENU7N15A10005575/recovery.log
I:Set page: 'action_complete'
Iperation_end - status=1
E:error opening '/usb-otg/LOST.DIR' -- error: No such file or directory
E:error opening '/usb-otg/TWRP' -- error: No such file or directory
Click to expand...
Click to collapse
1gnc said:
SOLUTION
This solution worked on my Zenfone 3, running lineage Android 7.1.2.
I tried many other things, like flashing different versions of TWRP, deleting the recovery directory, renaming files and all the like.
You may deselect compression, change the TWRP-date / time : nothing works !
You need an PC / Notebook with adb installed.
- start your phone in recovery-mode (TWRP)
- connect to PC and get the recovery.log with following adb command
adb pull /tmp/recovery.log
You will find a copy of the file recovery.log in the directory, from which you started the command
- open an editor or choose your favourite file viewer to open recover.log
- search for the last entry of the word "Error"
- in the line before that, the recovery.log states the name of the file that causes the problem
(in my case it was /system/addon.d)
- disconnect phone from PC.
- restart your phone in "normal" restart (do NOT boot to recovery mode)
- use a root file browser (I used ES-explorer with root enabled) and navigate to that directory/file
- delete the file (which I did not do - I tried some other steps)
- restart phone
This took 3-4 minutes, but I did not delete the file addon.d right away. Instead, I did this:
step 1
navigated to /system/addon.d and copied addon.d to SD-card
step 2
in /system/ , I renamed addon.d "addon_BU.d".
This was successful. In /system/ , the only file visible was now "addon_BU.d"
step 3
tried to create a directory named addon.d inside /system/ because my recovery.log said quote\ ... system/addon.d (not a directory) ... \unquote
FAILED. The directory could not be created by ES-explorer
step 4
copied my backup file addon.d from SD-card back into its original location /system/.
This, I though, would work just fine, because I had renamed the original addon.d to addon_BU.d.
So after restoring addon.d , the only thing left to do would be delte addon_BU.d.
ES-explorer reported no error, but - surprise - there was no file "addon.d" present in /system/
The only file still there was "addon_BU.d"
well, let's go to
step 5
rename addon_BU.d back to it's original name "addon.d" using ES-explorer
FAILED.
addon_BU.d could not be renamed - this file really was screwed up big time !!!
I ended up with no addon.d - so I could have deleted it right away istead of starting my trial with step 1 ...
step 6
Anyway. Shut dowm my phone.
Rebooted my phone normally (not to recovery mode !!!)
This took considerably longer than normal - my heart rate had began to increase slightly if not to say I began to feel like a squirrel on red bull...
After roughly 3 minutes, I had a successful reboot to my OS (lineage Android 7.1.2)
step 7
Reboot again, this time to recovery mode (=TWRP)
and: backups work again.
Don't ask me why this worked and if it will work for you, but hey, give it a triy and let me know...
Click to expand...
Click to collapse
Hi, thank you for a fix but this is an 10 month old thread. The issue was with TWRP 3.0.2-2. Along with an EFS issue that plagued TWRP 3.0.1-2, both issues have long since been resolved.
Sent from my Nexus 5X using Tapatalk
simple and working solution :
by @yannick818
"looks like it's an error with parallel apps oder multiple users. since i do not use something like that, i just removed this user with the android terminal emulator:
su
pm remove-user 999
everything was fine after that"
I could resolve my nandroid /data backup error on my EMUI 8.0 Mediapad M5 device with those following steps:
1 - Use a correct TWRP implementation
TWRP need to access the uncyphered partition /data.
There no possibility to backup it, if TWRP does not implement deciphering user data partition.
2 - Remove all users except user 0 (the administrator)
You can verify that there is no unwanted users, looking at directory /data/user : the only subdirectory should be "0".
To remove the others users :
Remove the PrivateSpace if you have one (Settings > Security & Privacy > PrivateSpace, and tap on the garbage can).
Remove all the secondary users (Settings > Users & accounts > users, and tap on each users to delete them). Keep just the main administrator user.
On EMUI, remove all twins applications (Settings > Apps & Notifications > App Twin, and disable all twin apps).
On OxygenOS, remove all parallel apps (Settings > Apps > Parallel Apps, and disable all parallel apps).
On MIUI, remove all dual apps (Settings > Dual Apps, and disable all dual apps)
On others devices ... you must find all parameters that create those unwanted users.
If you are not able to get the correct settings to suppress those users, in last resort you can try this command : "pm remove-user user-no. (For example "pm remove-user 999").
3 - Do not forget to protect your backups by a password
This would be stupid to cipher your /data partition and keep backups of this partition unprotected.
These steps fixed the nandroid backup problem for /data partition on my Huawei Mediapad M5 device.
I post on this forum because I hope that this will be helpful for others devices owners.

TWRP Backup fails with message "createTarFork() process ended with ERROR 9"

Hello,
I've got a problem I couldn't find a solution for: Before trying to flash a custom ROM, I wanted to do a Backup of the "original" system (rooted samsung android 4.4.2 KitKat). As listed by the devs of TWRP on their site (https://twrp.me/faq/whattobackup.html), I selected system, data and boot. System and boot were backuped to card without error (when selected without data), but backing up data always fails with error message "createTarFork() process ended with ERROR 9".
I could find threats about error 255, but nothing about error 9. Can you please help me solving this issue so I can create a backup of media as well?
These are the last lines of recovery.log:
I:InfoManager saving '/external_sd/TWRP/BACKUPS/1633cc05/2019-05-15--20-00-46_KOT49HI9301IXCUAOF1/data.info'
Prozess createTarFork() endete mit Meldung: 9 // createTarFork() process endet with message 9
Sicherung fehlgeschlagen, bereinige Sicherungs-Verzeichnis // creating backup failed. cleaning up...
I:Copying file /tmp/recovery.log to /external_sd/TWRP/BACKUPS/1633cc05/2019-05-15--20-00-46_KOT49HI9301IXCUAOF1/recovery.log
Click to expand...
Click to collapse

Lineage Install fails with Error E1001: Failed to update system image, ERROR 7

Hi,
I am trying to install the latest Lineage version on my Samsung Nexus 10 via twrp, but so far it always immediately fails with
Error E1001: Failed to update system image.
Updater process ended with ERROR: 7
Error installing zip file '/sdcard/lineage-17.1-20220318-UNOFFICIAL-manta.zip'
I tried wiping the entire system, cache and all and I tried both the adb push method and sideloading adb and they all produce the exact same error.
This is my first time doing this type of thing, so any help would be greatly appreciated.
P.S. I am currently running Windows 10, but could boot into a Linux Live Medium if that would be useful.
Edit: I was following this tutorial for the setup.
I'm facing exactly the same issue here with the installation of `lineage-17.1-20220919-UNOFFICIAL-manta.zip` file.
I'm currently on the latest original Google Android ROM flashed with `image-mantaray-lmy49j.zip` and want to update the system to the lineage OS as above.
I'm using TWRP v3.6.2_9.
What I did:
- uploaded `lineage-17.1-20220919-UNOFFICIAL-manta.zip` to `/sdcard` location;
- wiped out `dalvik-cache` and `cache` partitions;
- tried to install `lineage-17.1-20220919-UNOFFICIAL-manta.zip` as a single installation file;
Got this error. Here is an output from recovery.log:
Code:
Installing zip file '/sdcard/lineage-17.1-20220919-UNOFFICIAL-manta.zip'
Unmounting System...
I:Update binary zip
I:Extracting updater binary 'META-INF/com/google/android/update-binary'
I:Zip does not contain SELinux file_contexts file in its root.
I:Legacy property environment not used in updater.
No path given to file labeling backend
selinux_android_file_context: Error getting file context handle (No such file or directory)
Warning: No file_contextsTarget: google/mantaray/manta:5.1.1/LMY49J/2640980:user/release-keysTarget: google/mantaray/manta:5.1.1/LMY49J/2640980:user/release-keys
Extracted file "/tmp/install/bin/backuptool.functions"
Extracted file "/tmp/install/bin/backuptool.sh"
Extracted 2 file(s)
about to run program [/tmp/install/bin/backuptool.sh] with 4 args
Backup/restore is not possible. Partition is probably empty
Patching system image unconditionally...
performing update
blockimg version is 4
maximum stash entries 0
creating stash /cache/recovery/4dd6bf24fbba9cc76c352f5c4cfaed0074be0244
535756800 bytes free on /cache (0 needed)
/cache/recovery/last_command doesn't exist.
erasing 3367 blocks
BLKDISCARD ioctl failed: Invalid argument
failed to execute command [erase 4,225950,228864,229947,230400]
new data receiver is still available after executing all commands.
Patching system image unconditionally...script aborted: E1001: Failed to update system image.
E1001: Failed to update system image.error: 1001
Updater process ended with ERROR: 7
I:Install took 0 second(s).
Error installing zip file '/sdcard/lineage-17.1-20220919-UNOFFICIAL-manta.zip'
Does anyone have any clue on what could be wrong here and why it fails?
unpack zip remove lines, then pack zip and try again. voilla
or utube eroor 7
I'd the same problem with twrp but does did successfully for version 16 installation. I tried the above listed way but failed again. Same thing happened even I unchecked the system in twrp before flashing again. Need expert to help fix the issue. Appreciate in advanced!
Cpluo said:
I'd the same problem with twrp but does did successfully for version 16 installation. I tried the above listed way but failed again. Same thing happened even I unchecked the system in twrp before flashing again. Need expert to help fix the issue. Appreciate in advanced!
Click to expand...
Click to collapse
Not enough space on /system. Resize the partition. After 17.1 is running for me. https://www.hovatek.com/forum/thread-32750.html
Thanks a lot Daniel! I will try your way.

[SOLVED] Restore decrypted nandroid backup of FBE

Tried restoring a nandroid backup of the data partition with twrp.
also copied the /data/media partition back from an external copy.
when booting up the phone immediately reboots back into twrp with an error message:
Android Rescue Party...
The reported problem is:
'--reason=set_policy_failed_:/data/vendor'
the vendor partition seems to be intact and i do have a backup of it taken at the same time as the data backup, restoring it doesn't yield results..
i'm wondering if FBE is throwing it off, as the backup was taken when the phone was decrypted (within twrp) however the data on the partitions is referencing some sort of encryption key?
you may also exhibit the following error upon bootup of a restored nandroid backup.
immediately after booting, the phone reboots back into recovery.
viewing the log in twrp will show:
Android Rescue Party...
The reported problem is:
'--reason=set_policy_failed_:/data/bootchart'
1. the solution to this is editing fstab.​​under twrp or other recovery​mount /vendor from the mount icon.​​in twrp: Advanced > File Manager > /vendor/etc/fstab.qcom​select edit file under userdata, find where it says fileencryption=ice​rename fileencryption to encryptable.​​Original​
Code:
/dev/block/bootdevice/by-name/userdata /data ext4 noatime,nosuid,nodev,barrier=1,noauto_da_alloc,discard wait,check,fileencryption=ice,quota,reservedsize=512M
​​Modified​
Code:
/dev/block/bootdevice/by-name/userdata /data ext4 noatime,nosuid,nodev,barrier=1,noauto_da_alloc,discard wait,check,encryptable=ice,quota,reservedsize=512M
​save file.​
2. next delete the following directories:​
/data/unencrypted
/data/misc/vold/user_keys
3. Lastly delete any of the existing files from /data/system/ :​
locksettings.db
Gatekeeper.password.key
gatekeeper.pattern.key
locksettings.db-shm
locksettings.db-wal
recoverablekeystore.db
password.key
pattern.key
4. Reboot and re-encrypt​​
At this point rebooting from recovery will result in a running and successfully recovery backup.
one thing to note is the data and data/media partitions are at this point unencrypted
TRYING TO REINCRYPT NOW WILL FAIL to reencrypt got to settings > security > re set your pin or password for the phone
(optional) then select encryption and there will be an orange button to encrypt device.
the encryption process will take quite a while as it will reencrypt your entire phone.
The above doesn't work as it's trying to accomplish FDE, and the fstab line for encryptable=ice, isn't compatible with this.
i could not find an fstab string to follow the same option but for FBE.
​
Thanks for sharing, nice guide to disable forced FBE encryption! I think this applies to Android 12+ in general, not just OnePlus devices.
I ended up with the same problem on my Mi 10 Ultra with MIUI 13 after a /data partition restore and it was a real pain to solve ("set_policy_failed:..." rescue party error for different directories). It's strange though why it fails to set the fscrypt policy for existing directories with no policy, correct permissions and SELinux context...
(Btw: whether a fscrypt policy is applied to a directory ("is this directory encrypted?") can be checked with fscryptpolicyget in terminal.)
Unfortunately, this didn't directly solve my TWRP backup restore problem and I still had to do a manual restore, but now I can at least disable FBE and it's always nice to have actual control over the device you paid money for (you should really have control by default, but oh well...)
(Some of) the troubleshooting I did:
Like I mentioned, I first thought the issue might be with the SE linux context, so I tried running restorecon, but this didn't help - I eventually found that in init.rc, restorecon is usually already automatically run during each boot for directories under /data/... so running it manually makes no difference.
To edit /vendor/etc/fstab.qcom (or /system) on my device, I had to first disable the shared blocks EXT4 optional feature. I followed this nice guide to unpack/repack super.img. But this is missing the step for disabling shared blocks: when I tried to mount any of the unpacked images (e.g. vendor.img) as R/W, it failed with the useless generic error:
wrong fs type, bad option, bad superblock on ...
Click to expand...
Click to collapse
Then dmesg gave me another clue, but at the same time was still cryptic and not immediately helpful:
EXT4-fs (loop*): couldn't mount RDWR because of unsupported optional features (4000)`.
Click to expand...
Click to collapse
So I guess 4000 is the code for shared blocks and you can disable these with e2fsck -E unshare_blocks <your .img file or loop device> (and probably need a filesystem check with e2fsck -yf <file>). Again very annoying that these numerical feature codes are not mentioned anywhere in the e2fsck manual pages for example.
Anyway, I was finally able to either:
1. mount vendor.img on my PC (mount -o loop vendor.img /mnt/vendor) and edit the /mnt/vendor/etc/fstab.qcom right there before repacking the .img and flashing the new edited super.img to my device
or
2. just repacking the vendor.img with shared blocks disabled and size increased (resize2fs vendor.img <new size>) and flashing the new super.img without other modifications - this way /vendor can also be mounted as r/w in Android and changes made later (mount -o remount,rw /vendor).
The worst part is that in the end, even with decryption disabled and the keys deleted, the device still wouldn't boot after a /data restore from TWRP (and after multiple days spent on debugging )... I still had to manually extract the TWRP backup and move directories/files individually - thankfully no issues with app/ or data/ - I think the problem was with some files in either system/ or misc/, but idk for sure. I just manually went through and kept only what seemed important (saved wifi APs, BT devices, SMSs etc, but not saved accounts). And after this it finally booted with all my apps and (most of) my settings!
(Btw2: a TWRP/nandroid backup is apparently just a bunch of separate tar.gz files, not a split archive, so you can just extract them with for file in ../data.f2fs.win*; do echo "extracting $file..."; busybox tar -xzf $file; done)

Categories

Resources