yashsingh1/xdaforums huggingface dataset:
[Miscellaneous Android Development] pandavova:
I have a Xperia 5II with Android 11 (EEA_58.1.A.5.55). I'm trying to debloat my phone, but for that I need to make my system r/w. TWRP is not an option (the decryption doesn't work) and trying to do it through the adb shell gives me errors.

I also tried to extract the super file with the superunpack (in r/w), I tried to fix the new files with resize2fs, that was not needed, all files were 4k blocks long, "nothing to do".

e2fsck gave some errors, here are the logs (I got them by using "e2fsck -fy -E unshare_blocks *partition_name* > *partition_name*.txt"), hopefully they help.
[Miscellaneous Android Development] munjeni:
Yes you do not see any error thats a true but true thing is its not working and your partition contain ton of errors! I have explained whats happening
[Miscellaneous Android Development] Spaceminer:
@munjeni

Do you by chance have a superrepack.arm32? I tried building it but the tools embedded within the binary still get built as arm64 which won't run on my device.

Edit: This was more than likely an error on my end, but I wanted to check to be sure.

Solved! I found a copy in v2, which I needed for Motorola devices anyways.
[Miscellaneous Android Development] munjeni:
V2 is bad!
[Miscellaneous Android Development] Spaceminer:
No other version works. V2 worked on the Moto G Fast and Moto E (2020). It's been about 8 hours now and I've had zero issues. What's wrong with it?
[Miscellaneous Android Development] munjeni:
Explained allready 3-4 times, last one is inside post 152! If you compare it with first post and changelog you will notice that resize & repair is inplemented inside version 5 and up, all version before version 5 is bad because partitions get damaged and dangerous since resize & repair feature is not implemented before version 5. If you folow more posts yo can see that even latest version fail to e2fsck on some phones. Inside post 152 is clean instructions and explanation.
[Miscellaneous Android Development] bobbyp1086:
Why can't we take what works outta v2 and put in what's missing, or is that the problem?
[Miscellaneous Android Development] munjeni:
Please read whole thread carefully and you will get idea why. As I have mentioned allready version 2 was bad (explained allready why) so I done attempt to fix the things in version 3, version 4, version 5, version 6, version 7, version 8, version 9, version 9 is the last attempt and it is only one correc, but version 9 work on some devices but not work on some devices, on devices which it not work (because of error "unable to clone blocks" which is seeems some other protection active in android 10, I don't know why and I don't know what I need to do further as I don't have device with latest android & super partition), hope somebody figure out why, I spent almost few pages here and explained the thing and will not repet, in most case if you guys continue to repeat version 2 things this thread will go into the trash as I have no free time to repeat explanation so please read whole thread and you will understand why. Version 2 forget it. Version 9 is only one correct but not work on some devices and I don't have idea why, you should use real Linux like Ubuntu and do the things (explained allready how). If you use Ubuntu you need to compile latest e2fsprogs to get right and compatible tools like e2fsck and resize2fs for repair your super partition dump on Ubuntu and write it back to android using dd (explained allready how).
[Miscellaneous Android Development] Spaceminer:
The error "unable to clone blocks" happens on Motorola devices with FEC (forward error correction) enabled. It's a form of dm-verity that acts like ECC ram for a phone's nand. If you change any data, then metadata is used to rewrite the corrupted block back to it's original state. How much data it can restore depends on the internal storage size of the phone. I've watched it restore a corrupt vendor partition that was ~300mb without any problem though. So it's very robust. The flag for this is usually in the ramdisk init. (System or boot depending.) I worked with zackptg5 on this about a year ago. There's no way to defeat it on most devices that use it. The only workaround is a custom OS or custom kernel in most cases. Devices that accept --disable-verification & --disable-verity shouldn't have a problem, but not all devices respect that while flashing images.

To put it another way, if the device is using FEC, then there's nothing wrong with your binaries. V9 wouldn't work on the Moto E (2020) just because there's no arm32 binary. V2 did work, but as you said, it corrupted partitions. Specifically vendor_b and product_b. I just didn't notice because I was on slot_a.
[Miscellaneous Android Development] munjeni:
Finaly explanation, thank you so much! Commands from generated run.sh I have tested on super partition dump in Ubuntu without any error all the operation completed, so tool generaly work but on some devices not because of protection. I'm believing fec can be disabled because any android update doing changes to the partitions so for sure in that case fec is temporary disabled. I'm believing there is a way to disable fec.

EDIT:

but if fec is realy a problem here how than version 2 bypased fec? In that case fec might be no isue here but something diferent!

EDIT:

I see now this -> patchwork.kernel.org/project/dm-devel/patch/1446688954-29589-4-git-send-email-samitolvanen@google.com/

I will try research a bit about disabling Reed-Solomon

what you get while doing command??: adb remount

and command??: adb disable-verity

this work only in adb version 1.0.33 and up

EDIT:

found very good info here -> https://android.stackexchange.com/q...dm-verity-on-android-with-user-build-type-rom

https://android.googlesource.com/pl...ags/android-9.0.0_r47/libfec/fec_private.h#54 #define VERITY_MAGIC_DISABLE 0x46464F56 :love:
[Miscellaneous Android Development] munjeni:
This will be easy to implement probably https://android.googlesource.com/pl...0_r47/adb/set_verity_enable_state_service.cpp but I will use magic bytes VERITY_MAGIC_DISABLE instead :), the only thing whichj I willl use is to retrieve prop values related to avb and dm verity
[Miscellaneous Android Development] munjeni:
Anybody give me dump of the vbmeta partitions?
[Miscellaneous Android Development] munjeni:
Anybody have idea where is VERITY METADATA on disk, which partition? I'm right now hex searched for VERITY_MAGIC byte inside whole super partition dump and it simply not exist
[Miscellaneous Android Development] bobbyp1086:
I have the factory image and verity is an .img file if that helps? Sorry vbmeta lol. Was thinking of dmverity cause adb command
[Miscellaneous Android Development] munjeni:
I'm made dm-verity disable allready but yes please need to look into img
[Miscellaneous Android Development] munjeni:
Version 11 is out!

- version 11 (01.05.2021) simplified, removed needs for parameter rw, implemented dm-verity disabler

let me know and post your log
[Miscellaneous Android Development] bobbyp1086:
It's not that I'm second guessing you, but isn't dm-verity disabled when and only when flashing vbmeta?
[Miscellaneous Android Development] munjeni:
I don't have latest phone with android 10 for test so I don't know, here is a litle feedbacks for me to figure all the things. What I know bootloader need to be unlocked and fastboot --disable-verification done to disable things completely, I have included dm-verity disabler and verification disabler, temporary selinux disabler, root check, hope all work.
[Miscellaneous Android Development] f1^ter:
I attach my Xperia 1 II dumps. Maybe it will help...
[Miscellaneous Android Development] munjeni:
Thanks! But seems vbmeta header and metadata is not inside those partition. What I trying to find is this -> https://android.googlesource.com/pl...ags/android-9.0.0_r47/libfec/fec_private.h#54 precisely need to find partition contain VERITY_MAGIC magic bytes , right now I have no idea where it is since looking on source code its unclear which partition holds those structure:) . What clear is that when VERITY_MAGIC magic bytes is replaced with VERITY_MAGIC_DISABLE magic bytes than verity is completely disabled, I wonted that to omit using any external library for just disabling verity, but since I not found what I wonted I have used library in v11. Anybody tried v11, is all ok?
[Miscellaneous Android Development] f1^ter:
Maybe he should be in the dtbo.img?
[Miscellaneous Android Development] munjeni:
Maybe. I'm just looking here https://gitlab.com/cryptsetup/cryptsetup/-/wikis/DMVerity , it might be that dm-verity header is not on a block device but on kernel memory which we probably can't access without special kernel module or to modify ramdisk, change kernel command line and all the things related to it inside ramdisk. It can be done from magisk mannager. Anybody tried superrepack v11? Is dm verity disabled? Verification disabled? Also I have found right now location of the vbmetaa headers, its on all partitions after last byte of the every ext4 partition. Also found it also in your vbmeta dups. This is not clear for me do we need to write AVB_VBMETA_IMAGE_FLAGS_VERIFICATION_DISABLED to the vbmeta or we need to write it to the end of each ext4 partition or we need to write it to booth ext4 partition which we want to disable verity + write it to the vbmeta partition. Here is some usefull info https://android.googlesource.com/platform/external/avb/+/0922bf8970fd2a61b9053a6fca81d8165cc0af67^!/ . What I have done is I have implemented avbctl tool to disable the things in v11. I don't know if it work and I would be glad if somebody try v11 and give me log
[Miscellaneous Android Development] munjeni:
Also this is intersting https://android.googlesource.com/platform/external/avb/+/master/libavb/avb_vbmeta_image.h

based on it header I have found :

/* 120: Flags from the AvbVBMetaImageFlags enumeration. This must be
* set to zero if the vbmeta image is not a top-level image.
*/
uint32_t flags;

Further research I found that super partition (all partitions in super partition) and also your vbmeta dumps contain zero flag, see attachment, I don't have idea where is a top partition contain vbmeta top-level image, super and vbmeta is definitelly not a top level. Anybody have idea where is top-level vbmeta???

To manualy disable avb verification its done by writing flag AVB_VBMETA_IMAGE_FLAGS_VERIFICATION_DISABLED to top level vbmeta.

as clearly stated here:

/* Flags for the vbmeta image.
*
* AVB_VBMETA_IMAGE_FLAGS_HASHTREE_DISABLED: If this flag is set,
* hashtree image verification will be disabled.
*
* AVB_VBMETA_IMAGE_FLAGS_VERIFICATION_DISABLED: If this flag is set,
* verification will be disabled and descriptors will not be parsed.
*/
typedef enum {
AVB_VBMETA_IMAGE_FLAGS_HASHTREE_DISABLED = (1 << 0),
AVB_VBMETA_IMAGE_FLAGS_VERIFICATION_DISABLED = (1 << 1)
} AvbVBMetaImageFlags;

Verification enabled check is done this way: (flags & (1 << 1)),. So to disable hashtree & verification we need to write 0x03 to the flags location from screenshoot, instead of zero it must be 03 00 00 00. But it must be done to the top level vbmeta. And I have no idea where is a top level vbmeta :)
[Miscellaneous Android Development] munjeni:
And this is one more interesting thing, rollback index (aka rollback protection) location is till after flags, but we see it zero too, so definitelly top level is somewhere else and in most case probably without access from userspace? I'm believing only a way for disable verification is via fastboot only?
[Miscellaneous Android Development] f1^ter:
I tried using the commands:

fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img
fastboot --disable-verity --disable-verification flash vbmeta_system vbmeta_system.img

I didn't get any results with your kitchen. I haven't tried your v11 yet, I'll come back from work later and try the same thing with v11. I will unsubscribe about the results.

And yet... I looked at v11 and saw that there is no "superrepack.arm64_pie", is this normal?
[Miscellaneous Android Development] munjeni:
Sorry I forgot to include superrepack. I'm reupoaded right now v11
[Miscellaneous Android Development] Spaceminer:
I tried v11 on my Moto G Fast running stock Android 11. Verity is disabled and everything is working great. Logs attached.
[Miscellaneous Android Development] f1^ter:
I attach my log! Unfortunately still the same errors.
[Miscellaneous Android Development] munjeni:
The same problem: Couldn't clone file: Could not allocate block in ext2 filesystem, it not work :(
[Miscellaneous Android Development] munjeni:
Please post booth logs, superrepack log and script.log! Script.log is concentated with old logs so if you look at the start of the log you see old logs errors, but your latest run in log tells that its done right and without errors! I will make v12 to alway delete old logs before making new log. This is from your latest run:

Resizing the filesystem on /dev/block/loop27 to 366 (4k) blocks.
The filesystem on /dev/block/loop27 is now 366 (4k) blocks long.

Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
odm: 41/48 files (0.0% non-contiguous), 338/366 blocks
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
odm: 41/48 files (0.0% non-contiguous), 338/366 blocks
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
odm: 41/48 files (0.0% non-contiguous), 338/366 blocks
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
odm: 41/48 files (0.0% non-contiguous), 338/366 blocks

Everything done right! As you see your partition is rw now and not contain errors! :)
[Miscellaneous Android Development] munjeni:
Version 12 is out!

- version 12 (05.05.2021) make old logs always deleted before fresh log is created, this prevent concentation with old logs
[Miscellaneous Android Development] f1^ter:
Did the same with v12. Thank you for your interest in our devices.
[Miscellaneous Android Development] munjeni:
Thanks! Unfornuately it not work! Even with disabled verification and disabled verity it fail with error: Could not allocate block in ext2 filesystem returned from clone_file_block, I am realy out of idea!

Error, script null response is bug in my tool. I will delete superrepack tool definitelly, you, evorybody and me wasting time with it. Design of the tool is wrong from the start. Did you tried on Ubuntu to do it? See instruction at the end of superrepack log
[Miscellaneous Android Development] munjeni:
Version 13 is out!

Changelog:

- version 13 (06.05.2021) make linux version so you should do the things on your super partition dump directly on linux machine

I have good news for you! After I made linux version (x86_64) of the superrepack I have got the same errors: Couldn't clone file: Could not allocate block in ext2 filesystem

but runing tool 4-5 times errors is less and less until it totaly disapears, when all errors disapears filesystem is fully repaired and without any single problem! So it will be the same with android version in most case! So try run tool 4-5 times until error (Couldn't clone file: Could not allocate block in ext2 filesystem) totaly disapear! Make sure your script.log not contain any single error, without error mean filesystem is fully ok otherwise your partition is not done right! Its not recommend to leave partition with errors! If tool unable to repair filesystem and contain errors try dump your super partition and do the things using linux version of the tool than if all is done right simple restore repaired dump back to phone. I'm believing android version will be ok now and you will not have need for linux version. Let me know! :)
[Miscellaneous Android Development] pandavova:
Tried it out, kinda doesn't work.

The script.log doesn't get filled out.

My Device is an Sony Xperia 5ii on Android 11 with the currently latest version EEA_58.1.A.5.159.

Here's the log from my cmd window (I did run that tool several times, I don't know which run is this):
[Miscellaneous Android Development] munjeni:
Thanks! Android ndk toolchain interpreted my today linux x86_64 implementation and included it into android binary, thats crazy, tommorow I will fix it and make final version v14 and it will definitelly do the things right
[Miscellaneous Android Development] Spaceminer:
Pixel 4a, working. V13
[Miscellaneous Android Development] pandavova:
Btw, @munjeni, I don't know if you read the full log, did you catch line 48 and line 52? Can you explain that?

line 48: losetup: Unknown option 'offset=1048576' (see "losetup --help")

line 52: losetup: /dev/block/loop27: No such device or address

Also, it currently just tries to make the system partition r/w, when this script finally works on my Xperia 5ii, will it be possible to also make the vendor and product partitions r/w? If I understand the script, I just need to change the normal "./superrepack /dev/block/bootdevice/by-name/super system_a" command to the partion I want r/w on, right?
[Miscellaneous Android Development] bobbyp1086:
Back on verity real quick, the disable command is ran when flashing it. I have that img file if it's still of use. If you get the stock moto firmware it's all there laid out, including a file telling you what order to flash and when. It's just a huge file, 4 gb I wanna say. So I can extract what you want and upload to Google drive?
[Miscellaneous Android Development] munjeni:
No need realy, anyway thanks!
[Miscellaneous Android Development] munjeni:
Hi, please wait version 14, version 1 is curently not working on your device, explained why in post 195
[Miscellaneous Android Development] munjeni:
Version 14 is out!

Changelog:

- version 14 (07.05.2021) fix compilation mess between linux and android

Let me know :)
[Miscellaneous Android Development] Luix333:
First of all thanks for the work!

I keep getting:

Error, your device is selinux enforced!

Put selinux in permisive mode first by command: setenforce 0

even though I run setenforce 0

please help!

Galaxy S20 SM-G980F
[Miscellaneous Android Development] munjeni:
What you get when you type setenforce 0 ? Command not found?
[OnePlus 5 Questions & Answers] DF5JT:
Official update came in yesterday, build No. A5000_23_200601, worked without problem from previous version. Phone rooted with Magisk, so the usual procedure of flashing a twrp recovery and Magisk.

I've just recorded myself playing the piano and what used to be a real strength of the OP5 is gone. Video is fine, but the audio is mono, not stereo. To me, that's a disaster. This is both with the OP5 camera as well as Open Camera. There has to be a way to restore the previous functionality of using the two internal microphones.

While I've found a way to use external stereo microphones via OTG and a separate audio interface, I really want stereo recording vor quick video of a practice session.

This is what today's audio sounds like:

https://www.youtube.com/watch?v=q4P5Pm_ilfw

And this is what the same phone with the previous OOS version sounded like:

https://www.youtube.com/watch?v=qAVxpMDr6Vk

How can I go back to a previous version or get stereo audio back?
[OnePlus 5 Questions & Answers] DF5JT:
Wasn't helpful anyway, because different regions in the world get different update versions at different times.

Never mind.
[Xiaomi Poco F2 Pro (Redmi K30 Pro) Questions & Ans] sircretop:
Hi all. New to the forum and based in the UK. Recently got a Redmi K30 Pro 6GB. Currently it is running MIUI 11.0.16 Stable QJKCNXM. I got the from sent from Hong Kong so unsure if it has .EU or China rom. To be honest I just switched from iOS as I've been using that for 10+ years so I'm a little unsure of the whole Android side of things even though I am quite techy.

Basically, what I want to know is:

1. Am I on China Rom or EU Rom based on what I mentioned above.

2. Is it possible to run a stock Android 10 on the phone rather than using MIUI (or any other software you recommend?)

3. If I can't do number 2, then maybe updating to MIUI 12 might fix some of the things I dislike about MIUI 11 such as delayed notifications from many apps despite them not being restricted and having all permissions enabled. Is there a MIUI12 download available with guide?

I already have made a full local backup and have also backed up to the cloud.

First post, so couldn't post in another forum which seemed more in line with what I'm asking but hoping the mods will move it if they feel the need. Thanks!
[Xiaomi Poco F2 Pro (Redmi K30 Pro) Questions & Ans] huyhung411991:
1. It's CN ROM. If during the initial setup you can only choose between English and China, it's stock CN ROM.

2. For now, you can't as there is no stock AOSP (pure) Android custom ROM yet. But you can unlock the bootloader and install Xiaomi.EU modded version of the CN ROM (both MIUI 11 and 12), which has bloated CN apps removed and is customized to be a global ROM.

3. CN MIUI 12 Stable is already available. You can check for update from your phone (Settings \ MIUI version \ Check for updates). If there is still no update, it's probably still in closed testing and will be available later.

But upgrading OS only may not fix the problem you have with the notification.

For the apps with delayed notification in either MIUI 11 or 12, you should try to turn on their Autostart option and set their Battery saver mode as No restrictions in App Info page.
[Xiaomi Poco F2 Pro (Redmi K30 Pro) Questions & Ans] sircretop:
Thank you. Is there any beginner/newbie guide to getting the EU rom on my phone? Doing this, do I lose everything? I have a full local backup but will that backup actually reload the chinese bloatware back on?
[Xiaomi Poco F2 Pro (Redmi K30 Pro) Questions & Ans] XDRdaniel:
Yes, you will lose all data because you have to unlock the bootloader first. You can restore the backup and depending on what the backup contains, it might restore some bloatware.

Apply here for bootloader unlock

https://en.miui.com/unlock/

Then flash twrp recovery then miui eu, and restore whatever you need
[Xiaomi Poco F2 Pro (Redmi K30 Pro) Questions & Ans] sircretop:
Thanks. Looking at the backup folder there are plenty of the bloatware apps in there (all .bak files). If I put them all back on will I be able to delete them naturally within the phone (currently you cannot delete them from within the phone as they are blocked from being deleted). Another option is for me to remove those .bak files from the backup folder but wondering would that be an issue at all?

When you say flash TWRP....how is that done?

Thanks for all the replies so far. Really helpful!
[Xiaomi Poco F2 Pro (Redmi K30 Pro) Questions & Ans] XDRdaniel:
Yes you will 100% be able to delete them afterwards, as they will be stored in data, not in the system partition which is read-only. So you can do a full restore, delete unwanted apps and then do a better backup file without bloatware.

Also check your pm
[Realme 5 Pro Questions & Answers] zfshrief:
Could d you please anyone tell me what's the hell is that?
[Windows Mobile Development and Hacking General] xNitr0us:
I know there are apps or tweaks to make the phone vibrate when you touch the screen and for the dialpad but is there an app to make the phone vibrate only when using the on-screen keyboard while texting? just like the dialpad tweak but for texting only? so I can have the dialpad vibrate and the keyboard keys for the on-screen keyboard vibrate while texting and in any profile (loud, vibrate, silent ect...)
[Windows Mobile Development and Hacking General] bluemetalaxe:
yes, i also would like to have a vibration or even a sound feedback, but just when typing. Anyone has a idea ?
[Windows Mobile Development and Hacking General] andrewx:
Use Phone Pad Vibrate

http://xdaforums.com/attachment.php?attachmentid=59193&d=1195777546