Related
Hi guys,
lateley I saw F2FS support in Nightlies changelog of CM12.1. Im using latest TWRP + CM12.1. So.. how to get there?
Do I need a custom kernel? What if CM13 will be released do I have to go back to EXT4 before and will this work without problems?
Do I need to fully wipe all my data or can I just convert without data loss?
Help appreciated!
Kind regards!
[Edit: ]
Should I convert every partition or just cache + system?
Looking at http://review.cyanogenmod.org/#/c/109990/4/rootdir/etc/fstab.qcom, F2FS is only supported for the data and cache partition.
CM12.1 for klte/klteduos supports F2FS, TWRP has options under "wipe" -> "advanced wipe" -> "fs options" -> "change fs" to format the partitions to use F2FS.
You should make a full backup and then change the fs type. Dont't forget to backup your internal sdcard as this is not included in the TWRP backup.
There's a nice howto: http://forum.xda-developers.com/xpe...rial-migrate-filesystem-to-f2fs-ext4-t3004755
Good luck!
Thank you very much!
I've made a backup of data and cache and tried to convert but TWRP won't let me change to F2FS as the option is missing. Do I need some custom TRWP or did I miss something as I am using the latest version. Also, if I change the data partition my userspace won't be touched, right? So the backup of my userspace which I can see when I plug my phone to PC is not necessary, just for caution, right?
Thanks in advance!
[Edit: ]
If CM12.1 has the F2FS options, the kernel should automatically support the new file system? In your link they say you need TWRP with mkfs.f2fs support, so I need to change something somehow?
ktoonsez' TWRP image supports F2FS (http://forum.xda-developers.com/showthread.php?t=2777835).
Just changed my cache partition with it.
BTW, if you followed the howto, you should have read that you can also download the provided mkfs.f2fs and push it to the original TWRP recovery.
I think, you don't read and search carefully enough. All your questions are answered in this forum, you just need to invest some time.
meiser said:
ktoonsez' TWRP image supports F2FS (http://forum.xda-developers.com/showthread.php?t=2777835).
Just changed my cache partition with it.
BTW, if you followed the howto, you should have read that you can also download the provided mkfs.f2fs and push it to the original TWRP recovery.
I think, you don't read and search carefully enough. All your questions are answered in this forum, you just need to invest some time.
Click to expand...
Click to collapse
Thank you, again!
I used the search function before, the problem ist that it's very specific as there are dozens of kernel and custom roms and I wanted to be on the save side as I really need my mobile. But you are right, the mkfs.f2fs problem should have been solved by reading better. So this is now solved!
Kind regards
ktoonsez' TWRP image supports F2FS (http://forum.xda-developers.com/show....php?t=2777835)
Click to expand...
Click to collapse
As i see it can't format internal storage. Is there any solution?
When I tried do backup in twrp recovery I always end with error 255
There's log if this help.
Thankshttp://cloud.tapatalk.com/s/59dc5f7f153b3/last_log.txt
Odoslané z ONEPLUS A5000 pomocou Tapatalku
Yup, same here! I always getting it while trying doing an restore via ADB (copy backupped TWRP folder via commands to internal device storage)
I would like a solution to for this frustrating Tarfork 255 error!
This is what i asked and mentioned to one of our Team Members and i tried everyting;
First: *I don't like the idea of "wipe data" clean restoring is to me included "format data*
Secondly: *if i backup my data also along with system and all (exclusive recovery, cache and system image) and move it to my pc via ADB and than wipe and format all in twrp and than move my TWRP back up via ADB back to my Device, than restoring fails...*
Thirdly: *So the only way you can restore is NOT to format Data(internal) while restoring. But that just doesn't make sense. Because the Data is dirty if you flash another ROM and than restore your previous ROM*
So in my opinion when you restoring without the Data formatted, it stays dirty when you restoring. Also i don't want dirty data from other ROMs if you know what i mean..
I like to know an very satisfying solution! And hopefully someone can enlightening us:crying:
It's very simple.. If you can find through the log the "guilty" app just uninstall it and re-do TWRP backup.. If you can't find that (or those) app you need to wipe data... When you're 100% sure that the problem is in data partition (try to backup it alone) so the solution is the above... :good:
---------- Post added at 20:15 ---------- Previous post was at 20:13 ----------
lekiaM said:
Yup, same here! I always getting it while trying doing an restore via ADB (copy backupped TWRP folder via commands to internal device storage)
I would like a solution to for this frustrating Tarfork 255 error!
This is what i asked and mentioned to one of our Team Members and i tried everyting;
First: *I don't like the idea of "wipe data" clean restoring is to me included "format data*
Secondly: *if i backup my data also along with system and all (exclusive recovery, cache and system image) and move it to my pc via ADB and than wipe and format all in twrp and than move my TWRP back up via ADB back to my Device, than restoring fails...*
Thirdly: *So the only way you can restore is NOT to format Data(internal) while restoring. But that just doesn't make sense. Because the Data is dirty if you flash another ROM and than restore your previous ROM*
So in my opinion when you restoring without the Data formatted, it stays dirty when you restoring. Also i don't want dirty data from other ROMs if you know what i mean..
I like to know an very satisfying solution! And hopefully someone can enlightening us:crying:
Click to expand...
Click to collapse
If you format Data you'll decrypt partion and when you go restoring a previous backup done with encryption it won't work.. You can even restore a full backup on a fully working system the recovery will wipe everything for you before continue (with everything i mean those partition that yuo've previously backuped)
Aaah i see. This is what i've got;
A backup (stored in my internal and PC) i made this backup on an running "encrypted" device. But in TWRP i had to decrypt it by password so the backup i made in TWRP is automaticly decrypted right? because of the pincode i insert to decrypt my data.
But let's see, if i want to; let say.. switch to another Custom Rom. The only way is to "wipe" all and flash the new Custom Rom? This without Formatting "Data"? (as i suppose) because if i format the "data" i'm not able to restore my backup. This does make completely sense to me. But..... one thing i don't understand is this;
Why is it possible to make an full backup in TWRP, push it via ADB to PC, going back to twrp "wipe" and "format" all, reboot TWRP, pull the backup from PC via ADB again to TWRP and restore. But it won't restore why? why? because i formatted the "data"? so the only way to restore is (with the "dirty" data from previous ROM's than)...
Anyway, i wish it all was easier... Maybe i make it myself to hard to understand, i dunno.... But hey, thanks for your feedback! appreciate
lekiaM said:
Aaah i see. This is what i've got;
A backup (stored in my internal and PC) i made this backup on an running "encrypted" device. But in TWRP i had to decrypt it by password so the backup i made in TWRP is automaticly decrypted right? because of the pincode i insert to decrypt my data.
But let's see, if i want to; let say.. switch to another Custom Rom. The only way is to "wipe" all and flash the new Custom Rom? This without Formatting "Data"? (as i suppose) because if i format the "data" i'm not able to restore my backup. This does make completely sense to me. But..... one thing i don't understand is this;
Why is it possible to make an full backup in TWRP, push it via ADB to PC, going back to twrp "wipe" and "format" all, reboot TWRP, pull the backup from PC via ADB again to TWRP and restore. But it won't restore why? why? because i formatted the "data"? so the only way to restore is (with the "dirty" data from previous ROM's than)...
Anyway, i wish it all was easier... Maybe i make it myself to hard to understand, i dunno.... But hey, thanks for your feedback! appreciate
Click to expand...
Click to collapse
encrypted backup and a backup of a encrypted device is 2 different things.. When you do a TWRP backup you can choose to encrypt it with a password, it will encrypt that archive backup, but you can also do a TWRP backup of your encrypted device without encrypting the backup, hope this is clear
Second point.. Why you need to format every time? Format here on op5 can cause the data partition to switch from ext4 on f2fs and is not really necessary everytime... Example.. I'm on Resurrection Remix but today i want to change rom but first i want to take a backup, so i reboot in TWRP, do the backup (without encrypt the backup itself, it's not really necessary, indeed it can be risky) then i wipe cache-dalvik/art cache-system-data NO INTERNAL STORAGE then i install my new custom rom
It's really easier as you were thinking but maybe you've done some confusion with format/wipe and encrypted/decrypted
Your problem of restoring the backup is due to this ---> Probably, when you do the TWRP backup you're encrypted then you move it to the PC and here there's nothing wrong, but after this you format data and this will decrypt your device, so like i said above, your restoring isnt working because you want to restore an encrypted backup on a decrypted device
Avoid format and instead use the wipe function :good:
Now i see!!! Finally.. You're second post made it all clear to me! I keep this post in my subscriptions, so i can always look back.
Thanks again! (and for you're time to explain) :highfive:
from recovery log
Enyone can help with this, still ending with error 255
I:addFile '/data/system_ce/0/shortcut_service/shortcuts.xml' including root: 1
==> set selinux context: ubject_r:system_data_file:s0
I:addFile '/data/system_ce/0/recent_images' including root: 1
==> set selinux context: ubject_r:system_data_file:s0
found policy '/data/system_ce/0/recent_images' - '1CE0' - '031a968edf614759'
I:addFile '/data/system_ce/0/recent_images/9416_task_thumbnail.png' including root: 1
==> set selinux context: ubject_r:system_data_file:s0
I:addFile '/data/system_ce/10' including root: 1
==> set selinux context: ubject_r:system_data_file:s0
failed to lookup tar policy for '/data/system_ce/10' - 'cddc5aeae0e4e778'
I:Error adding file '/data/system_ce/10' to '/data/media/0/TWRP/BACKUPS/d3d80913/2017-10-14--14-19-57/data.ext4.win010'
Error creating backup.
I:ERROR tarList for thread ID 0
Error creating backup.
I:InfoManager saving '/data/media/0/TWRP/BACKUPS/d3d80913/2017-10-14--14-19-57/data.info'
createTarFork() process ended with ERROR: 255
Backup Failed. Cleaning Backup Folder.
I:Copying file /tmp/recovery.log to /data/media/0/TWRP/BACKUPS/d3d80913/2017-10-14--14-19-57/recovery.log
I:Set page: 'action_complete'
I:TWFunc::Set_Brightness: Setting brightness control to 255
Iperation_end - status=1
I:Set overlay: ''
I:Set page: 'clear_vars'
I:Set page: 'backup'
Truncating string cache entries.
I:Set page: 'main'
I:Set page: 'clear_vars'
I:Set page: 'main2'
I:Set page: 'advanced'
I:Set page: 'copylog'
I:Set page: 'action_page'
Iperation_start: 'Copy Log'
I:Copying file /tmp/recovery.log to /data/media/0/recovery.log
Click to expand...
Click to collapse
chlap said:
Enyone can help with this, still ending with error 255
Click to expand...
Click to collapse
Have you tried to backup Data only partition?
As I said above the 255 error is due to damaged file/s
Hitman478[emoji769 said:
;74161048]Have you tried to backup Data only partition?
As I said above the 255 error is due to damaged file/s
Click to expand...
Click to collapse
Tried backup Data. Same error.
Odoslané z ONEPLUS A5000 pomocou Tapatalku
If you are getting the same error again and qgain, i know its frustrating! And i also know to find the culprit for the error, is very hard. So i suggest start from scratch? I mean wipe all and format data, reboot to recovery, flash the latest "stable" and "improved" blu spark TWRP as recovery. Reboot recovery again, transfer the ROM, Gapps package and root method from PC to Internal and flash, reboot.
I know it's not an solution you'll be waiting for, but i ended up the same way too (as you can see earlier posts) . But since Hitman478 explained all to me, i have no issues anymore! which I'm truly great full for.
Have a nice Sunday (after all) :highfive:
chlap said:
Tried backup Data. Same error.
Odoslané z ONEPLUS A5000 pomocou Tapatalku
Click to expand...
Click to collapse
There's a corrupted file.. if you can't find it out and delete/uninstall that app, you never will be able to backup.. your solution is to clean install again your room (but first look at log and watch where TWRP gives you the error)
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.
larpoux said:
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
Click to expand...
Click to collapse
Thanks! That was the clue I needed! I had installed the app Shelter lately which created a work profile (= second user). Uninstalling Shelter and deleting the work profile solved the problem.
Hi, I use App2SD and this error occurs with the date partition. It's probably the symlinks.
Repartition tool for A5 and A7 2017
Disclaimer
Code:
I am NOT responsible for bricked devices or any damage that may happen to your device.
Repartitioning is a dangerous process and may brick your device in the worst case.
Features
This script will set 64MB for your /cache partition and ~4.6GB for your /system partition (The size of /system may be smaller or bigger depending on which variation of A5 and A7 is used)
The script will create a new partition called "vendor" with a size of 300MB
Only /system and /cache will be deleted during the flashing process, your /data partition keeps untouched
Flashing the script for a second time after already having it flashed will delete the /vendor partition and restore your stock partitions
You will still be able to install any recent ROM (Note that A720S may be unable to install any recent ROM. Contact me if you have problems)
TWRP, SHRP and Orangefox are supported
Installation
Make a backup of all your partitions first in case something goes wrong. Repartitioning is a dangerous process!
Make sure to have the latest version of TWRP/SHRP/Orangefox installed before installing this script.
Download the Repartitioner from post #2
If you only want to patch your recovery but already have the /vendor partition, download the RecoveryPatch from post #2
Flash the installer zip and wait until it is finished. It will add the necessary partition, patch your recovery and automatically reboot you to recovery if the installation is successful.
After reboot, make sure that /system, /cache and /vendor are mountable. If not, format them. (See a How-To in FAQ in post #3)
Congratulations, your device now supports treble!
Downloads
Find them in post #2
Support and FAQ
Telegram Group
FAQ (Frequently asked questions)
Credits
Me for the time I spent on this
@corsicanu for his template script
@Reverant for the original repartition script
@osm0sis for AnyKernel
Telegram users for testing
XDA:DevDB Information
[TOOL][SCRIPT][A520X|A720X] Repartition tool for treble support, Tool/Utility for the Samsung Galaxy A Series 2017 A3, A5, A7
Contributors
Simon1511
Version Information
Status: Stable
Created 2020-09-08
Last Updated 2020-09-09
Downloads
v1.2
Repartitioner: Google Drive | Androidfilehost (Will resize your partitions AND patch recovery)
RecoveryPatcher: Google Drive | Androidfilehost(Will ONLY patch your recovery for treble support. Flash this if you upgrade from an older version.)
Changelog
Spoiler
v1.2
Spoiler
Removed TWRP version check
Added support for SHRP and Orangefox
v1.1
Spoiler
Fixed a typo that prevented the script from creating new partitions on A720F and korean A5 variants
v1.0
Spoiler
Initial release
Reserved
FAQ (Frequently asked questions)
I cant mount /system, /cache or/and /vendor. What do I do?
->In recovery, go to Wipe, Advanced Wipe, select the partition you have problems with and tap "Repair or Change File System". Choose "Change File System", choose EXT4 and confirm the process. Reboot to recovery again to complete the process.This may be slightly different depending on which recovery you are using.
Restoring my /system backup always fails! What do I do?
->This seems to be a general TWRP problem. To fix, wipe /system, reboot to recovery, install the ROMs zip you had installed before, reboot to recovery again and restore your backup.
I have an A720S and cant install any recent ROM! Why?
->A720S has the smallest /system partition of all A5 and A7 variants and Lineage and every other ROM currently has its stock partition sizes set. Just flash the repartition ZIP again to revert the changes and contact me so we can resolve this problem.
How do I upgrade from an older version to the latest?
->The latest version doesn't change anything in terms of partition size. Therefore, you don't need to upgrade unless you have any issues.
How do I patch my recovery to support treble?
->Download the "RecoveryPatch" ZIP from the download section above and flash it in recovery. It will patch your recovery to support treble. If you want to switch to non-treble recovery, flash the recovery IMG/ZIP or the RecoveryPatch ZIP again.
reserved
in a720f can't format or mount /system, /cache or/and /vendor
says unable to wipe them
error changing file system
After second time installing "repartitioner-v1.0-a57y17lte.zip" reverse process fails to restore /cache partition to first /cache
matkali said:
in a720f can't format or mount /system, /cache or/and /vendor
says unable to wipe them
error changing file system
After second time installing "repartitioner-v1.0-a57y17lte.zip" reverse process fails to restore /cache partition to first /cache
Click to expand...
Click to collapse
Did you have TWRP 3.4 installed before installing the repartition script?
If not, thats likely to be the cause.
Also, dont forget to format /system, /vendor and /cache after installation.
Simon1511 said:
Did you have TWRP 3.4 installed before installing the repartition script?
If not, thats likely to be the cause.
Also, dont forget to format /system, /vendor and /cache after installation.
Click to expand...
Click to collapse
yes I do all of them
matkali said:
in a720f can't format or mount /system, /cache or/and /vendor
says unable to wipe them
error changing file system
After second time installing "repartitioner-v1.0-a57y17lte.zip" reverse process fails to restore /cache partition to first /cache
Click to expand...
Click to collapse
Yeah same issue here,. A720F
deleted
Updated the script to fix A720F and korean A5 support.
Sorry for the circumstances.
Downloads can be found in post #2
UPDATE
repartitioner v1.2: Google Drive | Androidfilehost (Will resize your partitions and patch recovery)
RecoveryPatcher: Google Drive | Androidfilehost (Will ONLY patch your recovery for treble support)
Changelog
Removed TWRP version check
Added support for SHRP and Orangefox
Backup/restore apps and respective data, SSAIDs, runtime permissions, generic system settings, Magisk modules, and more.
Works in recovery mode as well.
Refer to the upstream repository to get started.
I would like to be the first to thank you for this solution, i have one question how to make a full backup all accounts and data i saw in the guide tarb -badsm10 . but im not sure if its full backup or no
yassine2217 said:
I would like to be the first to thank you for this solution, i have one question how to make a full backup all accounts and data i saw in the guide tarb -badsm10 . but im not sure if its full backup or no
Click to expand...
Click to collapse
tarb -badsm10 . would backup the following:
a) All user and updated system APKs;
d) Data of those apps (also includes device-encrypted data (user_de), which can be excluded with D);
s) Generic system settings (quick toggles, sounds, display, etc.);
m) Magisk data (everything from /data/adb/, except magisk/ and magisk.db);
10) This instructs tarb to use 10 as the zstd compression level (default is 1);
This is a complete backup, except if you also want external data. If so, you would add the e flag.
External data includes /sdcard/Android/data/, /sdcard/Android/media/ (can be excluded with M), and /sdcard/Android/obb (can be excluded with O).
Note: backing up Google accounts on recent Android versions is just not a thing. You could try, but there's no guarantee that the restore will work. It may even cause problems. The target data keeps changing with new Android releases, and those changes are fairly unpredictable -- all thanks to Google, yay!
Cool, so this will replace Migrator right
VR25 said:
tarb -badsm10 . would backup the following:
a) All user and updated system APKs;
d) Data of those apps (also includes device-encrypted data (user_de), which can be excluded with D);
s) Generic system settings (quick toggles, sounds, display, etc.);
m) Magisk data (everything from /data/adb/, except magisk/ and magisk.db);
10) This instructs tarb to use 10 as the zstd compression level (default is 1);
This is a complete backup, except if you also want external data. If so, you would add the e flag.
External data includes /sdcard/Android/data/, /sdcard/Android/media/ (can be excluded with M), and /sdcard/Android/obb (can be excluded with O).
Note: backing up Google accounts on recent Android versions is just not a thing. You could try, but there's no guarantee that the restore will work. It may even cause problems. The target data keeps changing with new Android releases, and those changes are fairly unpredictable -- all thanks to Google, yay!
Click to expand...
Click to collapse
Thank you for the clear explaination
v2022.5.12 202205120
- C flag: exclude all *[cC]ache* files/directories globally (alternative to -X '*[cC]ache*');
- Do not backup/restore SSAIDs if /data/system/users/0/settings_ssaid.xml is encrypted;
- Updated info and support texts.
Try upgrading with tarb -u.
v2022.5.15 202205150
- Fixed -rnx ['regex'];
- -r shall have no fallback regex, just like -b;
- Skip GMS data backup/restore.
Try upgrading with tarb -u (interactive) or tarb -uu (no prompts).
v2022.5.16 202205160
- Fixed "backup/restore stops right after gms";
- Remind user to disable/remove Magisk modules that may cause bootloop;
- Updated Telegram group link.
v2022.5.25 202205250
- Architecture-aware self-backup
- Build script gets version from changelog
- Fixed `-rnx ['regex']`
- Fixed settings backup output inconsistencies
v2022.6.4
- cf899cd Remove debugging line, and reword a comment
- f8fdb0f Update help text
- bae6a39 C == "-X [Cc]ache" (non-greedy)
- 9a9138e Always exclude external cache
- 6d29dd6 Only restore SSAIDs and runtime perms after successful data restore
- fb0d1e9 Fix build/VERSION
Hello, I tried using this and I'm not having success. I installed as a Magisk Module with the -m flag and rebooted afterwards. Installed the arm64 as I have the SD855.
When I run the command tarb -badsm10 I get the following:
settings global
settings secure
settings system
/data/adb
Click to expand...
Click to collapse
And on the tarb folder I get a file with 30MB, that's all.
Thanks!
jakito said:
Hello, I tried using this and I'm not having success. I installed as a Magisk Module with the -m flag and rebooted afterwards. Installed the arm64 as I have the SD855.
When I run the command tarb -badsm10 I get the following:
And on the tarb folder I get a file with 30MB, that's all.
Thanks!
Click to expand...
Click to collapse
Perhaps the period is missing at the end of command line. Write command as follows:
tarb -badsm10 .
cave.man1908 said:
Perhaps the period is missing at the end of command line. Write command as follows:
tarb -badsm10 .
Click to expand...
Click to collapse
Yes, that worked. My bad!
Thank you
Edit: fixed
How do you use this in recovery? This works for a12 and a12 recoveries?
parag0n1986 said:
How do you use this in recovery? This works for a12 and a12 recoveries?
Click to expand...
Click to collapse
Only custom recoveries that can decrypt data are supported.
If you've installed tarb as a Magisk module (-m), /data/t is available for use in recovery.
Run /data/t -badems ..
It'll backup (-b):
* All user and updated system apps (a) with respective data (d) and external data (e), excluding cache;
* Magisk modules (m);
* Generic system settings (s).
If you haven't installed it, assuming it's located in /sdcard/Download, run sh /sdcard/Download/tarb-arm64 -badems ...
Use adb shell or recovery's own terminal.
v2022.6.25
ece9f5c Add Zelle donation info
e667f34 Add support for -bnx 'regex'
b1d3484 Remove obsolete lines
2e50b94 Fix: incomplete apk backup
5b268d9 Flag D implies d; M/O imply e
d898768 Make "o" flag work with "-b" as well
9715bbb Update usage examples
ff40224 Exclude internal cache by default
VR25 said:
Only custom recoveries that can decrypt data are supported.
If you've installed tarb as a Magisk module (-m), /data/t is available for use in recovery.
Run /data/t -badems ..
It'll backup (-b):
* All user and updated system apps (a) with respective data (d) and external data (e), excluding cache;
* Magisk modules (m);
* Generic system settings (s).
If you haven't installed it, assuming it's located in /sdcard/Download, run sh /sdcard/Download/tarb-arm64 -badems ...
Use adb shell or recovery's own terminal.
Click to expand...
Click to collapse
So if I'm on an a12 custom ROM, I would have to flash DFE so I am unencrypted and this should work? I've tried DFE on a couple of the 12.1 ROMs and it doesn't work any ideas to get it unencrypted on all these new rooms? I'm assuming I have to use TWRP I didn't know if any of these a12s have a terminal yet
parag0n1986 said:
So if I'm on an a12 custom ROM, I would have to flash DFE so I am unencrypted and this should work? I've tried DFE on a couple of the 12.1 ROMs and it doesn't work any ideas to get it unencrypted on all these new rooms? I'm assuming I have to use TWRP I didn't know if any of these a12s have a terminal yet
Click to expand...
Click to collapse
Android ROMs almost never ship with a terminal emulator. You can always install one or just use adb shell.
Modern custom recoveries (TWRP and derivatives) all have a built-in terminal.
Some recoveries can decrypt data.
When this is not the case, one must disable forced encryption to be able to read /data from recovery (mandatory for tarb to work there).
If Magisk cannot disable encryption, you have to patch /vendor/etc/fstab* file(s). This is usually just a matter of replacing "fileencryption=" with "encryptable=", rebooting, and formatting (not just wiping) the userdata partition.
VR25 said:
Android ROMs almost never ship with a terminal emulator. You can always install one or just use adb shell.
Modern custom recoveries (TWRP and derivatives) all have a built-in terminal.
Some recoveries can decrypt data.
When this is not the case, one must disable forced encryption to be able to read /data from recovery (mandatory for tarb to work there).
If Magisk cannot disable encryption, you have to patch /vendor/etc/fstab* file(s). This is usually just a matter of replacing "fileencryption=" with "encryptable=", rebooting, and formatting (not just wiping) the userdata partition.
Click to expand...
Click to collapse
So basically, using ADB shell while you're in nameless or Evo X recovery, for example, is just like using the built-in TWRP terminal? Just need ADB enabled in recovery mode?
How do I have magisk disable encryption? I've noticed when you flash magisk, It usually shows keep verity and force encryption = true. How do you make magisk disable them when you first flash magisk?
Sorry about all the questions, just really want to learn this stuff more, and you're amazing for explaining this stuff! I miss being able to backup/restore data nandroid style!
One last question. You said manually patch /vendor/etc/fstab.qcom? Do you replace anything that says file encryption with encryptable, or only in the /userdata area in the fstab? Here is what mine says. Would love to know what change in there and put it back and reformat and be unencrypted on a12!
/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=512M,sysfs_path=/sys/devices/platform/soc/1d84000.ufshc,checkpoint=fs
That's line #45 in my fstab.qcom file. So from that, my current ROM is FBEv2? And f2fs format for data?
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 recoverymount /vendor from the mount icon.in twrp: Advanced > File Manager > /vendor/etc/fstab.qcomselect edit file under userdata, find where it says fileencryption=icerename 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)