yashsingh1/xdaforums huggingface dataset:
[Android Software/Hacking General [Developers Only]] nagper:
eh, indeed i've just realized that the problem not only appliest to my_manifest_a but for the one i've sent as well:

sysrw: Sub-partition: odm_b (odm), group: qti_dynamic_partitions_b
sysrw: Current size of odm_b.img in bytes: 150302720
sysrw: Current size of odm_b.img in 512-byte sectors: 293560
sysrw: Current size of odm_b.img in MB: 143

sysrw: odm_b dm-path: /dev/block/dm-8, mount-point: /odm
Extracting odm.img...
Unpack done. 14s
erofsUnpack 1.3.220207 Linux
error: ext4_allocate_best_fit_partial: failed to allocate 10971 blocks, out of space?
loaded 1201 fs_config entries
Creating filesystem with parameters:
Size: 300605440
Block size: 4096
Blocks per group: 32768
Inodes per group: 6128
Inode size: 256
Journal blocks: 0
Label: odm
Blocks: 73390
Block groups: 3
Reserved block group size: 23
sysrw: Fatal make_ext4fs error:

I'll try to reprocude my original error message as well.
[Android Software/Hacking General [Developers Only]] nagper:
I did run the script again, got same error regarding "odm_b.img".

Do you write anywhere else that /data/local/tmp/?

After the program crashes it seems that there are plenty of storage space still available:

OnePlus7T:/ # df -h /data/local/tmp/
Filesystem Size Used Avail Use% Mounted on
/dev/jQD/.magisk/block/data 95G 25G 71G 27% /dev/jQD/.magisk/modules
[Android Software/Hacking General [Developers Only]] Timmmmaaahh!:
@lebigmac, don't call us out in public. It's disrespectful to the hard volunteered work we do to keep XDA a fun and free place for all. We have made relentless efforts for you over the past few weeks, yet you refuse to cooperate with us. If you post a new thread with 4 overlapping titles, it's a duplicate, and it violates our terms. I will not further explain our actions in public and there will be no discussion on this in the thread, that's not how moderation works. We will gladly explain anything we do via PM (as I already did), just like with any member of this amazing community. Thanks and sorry for the interruption, everyone.
[Android Software/Hacking General [Developers Only]] lebigmac:
You must know English is not my native language. I didn't mean to call out anyone like you assumed and I apologize if you misunderstood it that way.

I was just wondering why my new MakeRW / ro2rw thread was locked that's all. ;)

If you look a couple pages back I actually edited my comment and removed the "moderator" word as that wasn't the appropriate word, you're right. I didn't want to point any fingers at anyone ;)(y) I'm always happy to have interesting discussions with you in private. You can contact me anytime. Cheers 🍻

🖐:D

Hey it's not my fault that the latter program is an integral part of the former program (since day 1), hence the titles will inevitably overlap somewhat. One program is a SUPER partition ro2rw converter while the other is the sub-partition ro2rw converter. Think of it as a MACRO vs MICRO thing. I don't know how to explain the difference any better. ;)

The other day you guys just witnessed the core MakeRW / ro2rw component of my main SystemRW / SuperRW program being born in real time into its own executable. This step was long overdue to simplify the main SystemRW / SuperRW program and make it easier to debug. ;)(y)

Did you try

adb pull /data/local/tmp/sysrw_1.33/img/super_patched.bin
fastboot flash super super_patched.bin

Good luck!
[Android Software/Hacking General [Developers Only]] lebigmac:
New (old) beta test version for COW users ;)(y)

OPEN SOURCE!

This is my old v1.32 SystemRW/SuperRW script with the new version of my MakeRW/ro2rw tool plugged into it :D(y). Works fine over here on my Redmi Note 12 5G

[download link further down]
[Android Software/Hacking General [Developers Only]] xxXDarkNightXxx:
I copied super_patched.bin to computer's hard drive And I uploaded it via fastboot flash super But the system is still not read and write Now I have a question, should I rip the whole img folder with all the files or was it enough to just rip super_patched.bin ? Because maybe this is a problem and these files are somehow related to each other?
[Android Software/Hacking General [Developers Only]] lebigmac:
@xxXDarkNightXxx

Alright I see in your screenshot you ran v1.33

Can you please upload here this log folder as .zip

Thanks (y)

/data/local/tmp/sysrw_1.33/log

It's enough to pull super_patched.bin and flash to your super partition.

And phone still boots?

Can you do this as root?
[Android Software/Hacking General [Developers Only]] xxXDarkNightXxx:
phone boots up and works normally
[Android Software/Hacking General [Developers Only]] lebigmac:
Thanks for the logs. I can't see any errors. So what happens if you do this as root? Can you please show screenshot of your results? Thanks (y)
[Android Software/Hacking General [Developers Only]] lilysirius:
It's weird that it complains that executables in the tools are inaccessible or not found.

I checked the permissions in the tools directory, and they are all executable.
[Android Software/Hacking General [Developers Only]] AlpheusNL:
@lebigmac Do you have any idea when you are going release the F2FS (S22 ULTRA) version?
[Android Software/Hacking General [Developers Only]] lebigmac:
Full F2FS support for all Samsung devices is coming 1st quartal 2023. Hopefully my new official MakeRW / ro2rw by lebigmac thread will be unlocked by then so I can update it :D(y)

@lilysirius Try this quick hotfix to get rid of those annoying permission issues. Good luck! ;)(y)

[see file below]
[Android Software/Hacking General [Developers Only]] lebigmac:
okay so in my main SystemRW / SuperRW script itself these sub-partitions will throw make_ext4fs size error and when piping those same files manually through my external MakeRW / ro2rw program you get no error? Is that correct? :unsure:
[Android Software/Hacking General [Developers Only]] lilysirius:
It says congratulations but when I try to reboot, the system cannot be loaded. Tried a few times but still cannot reboot.
[Android Software/Hacking General [Developers Only]] lebigmac:
Can you please post your latest log ? Thanks (y). Did you see any errors in the log?

The screenshot you posted is looking good from here (y)
[Android Software/Hacking General [Developers Only]] lebigmac:
ok I think I know what is the problem give me 5 minutes ;)(y)

Nice log by the way. Looks perfect to me or did you spot an error in the mylog file?
[Android Software/Hacking General [Developers Only]] lebigmac:
final cow fix? :unsure:
[Android Software/Hacking General [Developers Only]] nagper:
Yes, that's correct!
[Android Software/Hacking General [Developers Only]] Bogdkdkd:
This script had not stopped on my_manifest, but stopped on error Not enough space for partition my_preload_a. Before i start this script the devise had 48gb free space
[Android Software/Hacking General [Developers Only]] Bogdkdkd:
$ su
d /data/local/tmp/systemrw_1.32 <
:/data/local/tmp/systemrw_1.32 # ls -l /img
ls: /img: No such file or directory
1|:/data/local/tmp/systemrw_1.32 # ls -l img/ <
total 20141899
drwxr-xr-x 4 root root 3452 2023-01-05 09:53 my_bigball
-rw-r--r-- 1 root root 795115520 2023-01-05 09:49 my_bigball.img
-rw-r--r-- 1 root root 1060134912 2023-01-05 09:53 my_bigball_a.img
drwxr-xr-x 4 root root 3452 2023-01-05 09:53 my_carrier
-rw-r--r-- 1 root root 348160 2023-01-05 09:49 my_carrier.img
-rw-r--r-- 1 root root 262144 2023-01-05 09:53 my_carrier_a.img
-rw-r--r-- 1 root root 225280 2023-01-05 09:53 my_company_a.img
drwxr-xr-x 4 root root 3452 2023-01-05 09:51 my_engineering
-rw-r--r-- 1 root root 348160 2023-01-05 09:49 my_engineering.img
-rw-r--r-- 1 root root 262144 2023-01-05 09:51 my_engineering_a.img
drwxr-xr-x 4 root root 3452 2023-01-05 09:52 my_heytap
-rw-r--r-- 1 root root 1060421632 2023-01-05 09:49 my_heytap.img
-rw-r--r-- 1 root root 1420578816 2023-01-05 09:53 my_heytap_a.img
drwxr-xr-x 4 root root 3452 2023-01-05 09:53 my_manifest
-rw-r--r-- 1 root root 471040 2023-01-05 09:49 my_manifest.img
-rw-r--r-- 1 root root 1014853632 2023-01-05 09:53 my_preload_a.img
drwxr-xr-x 4 root root 3452 2023-01-05 09:51 my_product
-rw-r--r-- 1 root root 471486464 2023-01-05 09:49 my_product.img
-rw-r--r-- 1 root root 560349184 2023-01-05 09:51 my_product_a.img
drwxr-xr-x 4 root root 3452 2023-01-05 09:53 my_region
-rw-r--r-- 1 root root 2760704 2023-01-05 09:49 my_region.img
-rw-r--r-- 1 root root 3674112 2023-01-05 09:53 my_region_a.img
drwxr-xr-x 4 root root 3452 2023-01-05 09:52 my_stock
-rw-r--r-- 1 root root 1488302080 2023-01-05 09:49 my_stock.img
-rw-r--r-- 1 root root 2054266880 2023-01-05 09:52 my_stock_a.img
drwxr-xr-x 4 root root 3452 2023-01-05 09:51 odm
-rw-r--r-- 1 root root 1131077632 2023-01-05 09:49 odm.img
-rw-r--r-- 1 root root 733478912 2023-01-05 09:49 odm_a-cow.img
-rw-r--r-- 1 root root 1787994112 2023-01-05 09:51 odm_a.img
-rw-r--r-- 1 root root 13807616 2023-01-05 09:49 product_a-cow.img
-rw-r--r-- 1 root root 13692928 2023-01-05 09:51 product_a.img
drwxr-xr-x 4 root root 3452 2023-01-05 09:50 system
-rw-r--r-- 1 root root 646754304 2023-01-05 09:50 system.img
-rw-r--r-- 1 root root 649285632 2023-01-05 09:49 system_a-cow.img
-rw-r--r-- 1 root root 1082761216 2023-01-05 09:50 system_a.img
drwxr-xr-x 4 root root 3452 2023-01-05 09:51 system_ext
-rw-r--r-- 1 root root 900620288 2023-01-05 09:49 system_ext.img
-rw-r--r-- 1 root root 1457369088 2023-01-05 09:52 system_ext_a.img
drwxr-xr-x 2 root root 3452 2023-01-05 09:49 tmp
drwxr-xr-x 4 root root 3452 2023-01-05 09:50 vendor
-rw-r--r-- 1 root root 627945472 2023-01-05 09:49 vendor.img
-rw-r--r-- 1 root root 630403072 2023-01-05 09:49 vendor_a-cow.img
-rw-r--r-- 1 root root 1207611392 2023-01-05 09:50 vendor_a.img
:/data/local/tmp/systemrw_1.32 #
[Android Software/Hacking General [Developers Only]] jonas.ska:
Hello and thanks for outstanding work!

I've tried using this tool on some kind of shady Chinese smartphone Hotwav (Wheatek) H1 device that has Android Go 11 and I can't get it to work. The error I get is "./sysrw[28]: ./bin/superw: not executable: 64-bit ELF file" .

How could I solve this problem? Thank you very much. I have 500 of these phones and desperately need to enable USB host mode by placing a file in /system/etc/permissions
[Android Software/Hacking General [Developers Only]] nagper:
chmod +x ./bin/*

assuming that you are in the 'sysrw_1.33' folder
[Android Software/Hacking General [Developers Only]] nagper:
@lebigmac :

There is some more interesting information that might help debugging:

my img folder contains _b and _a suffixes as well although the current slot is 1 (_b):

my_bigball_b.img
my_carrier_b.img
my_company_b.img
my_engineering_b.img
my_heytap_b.img
my_manifest_b.img
my_preload_b.img
my_product_b.img
my_region_b.img
my_stock_b.img
odm_a.img
odm_b.img
product_a.img
product_b.img
system_a.img
system_b.img
system_ext_a.img
system_ext_b.img
vendor_a.img
vendor_b.img

apart from that, i cannot convert sparse img to raw img manually:

OnePlus7T:/data/local/tmp/systemrw_1.32_EROFS_02c/systemrw_1.32 # ./tools/simg2img img/system_b.img system_b_ext.img
Invalid sparse file format at header magic
Failed to read sparse file

does it mean that even lpunpack did not extract the right partitions?
[Android Software/Hacking General [Developers Only]] jonas.ska:
Thanks, but it doesn' work, the result is the same :(

H1:/data/local/tmp/sysrw_1.33/bin # ls
avbctl erofs lpdump lpunpack simg2img
busybox img2simg lpflash make_ext4fs superw
e2fsck lpadd lpmake resize2fs tune2fs
H1:/sdcard # cd /data/local/tmp/sysrw_1.33
H1:/data/local/tmp/sysrw_1.33 # chmod +x ./bin/*
H1:/data/local/tmp/sysrw_1.33 # ./sysrw
./sysrw[28]: ./bin/superw: not executable: 64-bit ELF file
[Android Software/Hacking General [Developers Only]] Aitra:
In my opinion, removing the memory encryption & removing the android system encryption determines the success of the tool to turn off the read-only key to read-write.
[Android Software/Hacking General [Developers Only]] nagper:
I think only the data partition is encryted what contains user data, i mean why a read/only partition would be encrypted?
[Android Software/Hacking General [Developers Only]] BigEmpty:
New novice user here. If this script successfully makes dynamic partitions in super to be rw, can I make changes while rw but then when done with the changes, set it back to ro, with the changes still in effect?

Setting aside any issues with verity or vbmeta. Just concerning the narrow issue of setting the dynamic partitions back to ro, with the changes (made while rw was active) still in effect. Can this be done?
[Android Software/Hacking General [Developers Only]] nagper:
+1

That's my plan as well. I do not need persistent RW access.

Although i am novice as well do not see a reason why it would not be possible.

My other question is:

do we need to create te super image again. I just want to overwrite the system partition via fastboot.

I also wonder if verity status can be determined programatically from an android app or not.

A want to revert root access as well, banking applications do everything to check our backdoors.
[Android Software/Hacking General [Developers Only]] lebigmac:
the _b slot is unpacked by default if you launch lpunpack with default arguments. You can however extract individual partitions from super.img with it. Type lpunpack --help or just lpunpack and it should give you all the available options.

You can't unsparse those extracted sub-partitions because they are already in raw format. ;)

Sure, just add another shared_blocks read-only feature to it ;)(y) or convert back to EROFS after doing your modifications. No my official MakeRW / ro2rw by lebigmac tool can't do that yet but I can add that feature if many people request it. :LOL:

Hello. Thanks for your interest in this amazing and unique RW project for Android! You're welcome.

I will probably add full 32-bit support sometime in 1st quartal 2023 ;)(y)
[Android Software/Hacking General [Developers Only]] nagper:
Hm i see, thanks.

But i cannot mount them either.

And the 'file' utility does not recognize them as a file system.

Do i miss anything?
[Android Software/Hacking General [Developers Only]] BigEmpty:
Great, I'll check yours out. In my specific case, I have other circumventions in place to pass verity and avb. I realize not everyone will have those for their particular device, so resetting to ro does not make much sense in those cases.
[Android Software/Hacking General [Developers Only]] nagper:
My bad, sorry!

Even if i explicitly use --slot=1

_a will be the output suffix.

It's a bit misleading btw.
[Android Software/Hacking General [Developers Only]] Aitra:
Changing the text here will solve the ro ->rw problem.
[Android Software/Hacking General [Developers Only]] Aitra:
I'm sure ro /rw is closely related to the problem of forced encryption in twrp.
[Android Software/Hacking General [Developers Only]] nagper:
I see, you might be right!
[Android Software/Hacking General [Developers Only]] lebigmac:
No they both have nothing to do with each other. The encryption problem is in the fstab file and the read-only problem is caused by the file systems themselves.

Later today I will update my unique and original MakeRW / ro2rw sub-partition converter tool and hopefully that should fix the size issue ;)(y) Not sure where to upload it though as that thread was locked for some reason... You'll probably find it on my personal homepage.
[Android Software/Hacking General [Developers Only]] lebigmac:
New update coming later today my dear RW enthousiasts :D(y). I'm on the road right now. In the meantime I would suggest you guys try to run my official MakeRW / ro2rw sub-partition converter on the individual extracted sub-partitions and then try putting together the new patched super image manually with lpmake as explained here. Good luck!

If you can do the RW magic manually, then we can automate the whole process as well :D(y)
[Android Software/Hacking General [Developers Only]] LeeGarChat:
Here is an example of how to do reverse conversion to RO

./e2fsdroid -e -s -f /system_ext /data/local/s.img
Created filesystem with 1779/127744 inodes and 185329/524288 blocks
# local cd /data/local
# local tune2fs -l /data/local/s.img
tune2fs 1.46.2 (28-Feb-2021)
Filesystem volume name: <none>
Last mounted on: <not available>
Filesystem UUID: 57f8f4bc-abf4-655f-bf67-946fc0f9f25b
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: ext_attr resize_inode filetype extent sparse_super large_file uninit_bg shared_blocks
Filesystem flags: unsigned_directory_hash
Default mount options: (none)
Filesystem state: clean
Errors behavior: Remount read-only
Filesystem OS type: Linux
Inode count: 127744
Block count: 524288
Reserved block count: 0
Free blocks: 338959
Free inodes: 125965
First block: 0
Block size: 4096
Fragment size: 4096
Reserved GDT blocks: 47
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 7984
Inode blocks per group: 499
Last mount time: Thu Jan 5 20:41:17 2023
Last write time: Thu Jan 5 20:42:51 2023
Mount count: 0
Maximum mount count: -1
Last checked: Thu Jan 5 20:42:23 2023
Check interval: 0 (<none>)
Lifetime writes: 742 MB
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 256
Required extra isize: 28
Desired extra isize: 28
Default directory hash: tea
Journal backup: inode blocks
# local
[Android Software/Hacking General [Developers Only]] IamTheBRAVE:
Had this problem too. Any tool you use through terminal is gonna have to be copied to /system/bin and given permission. It's an android shell error.
[Android Software/Hacking General [Developers Only]] Timmmmaaahh!:
┤Thread Cleaned├┤Again├┤But it's a bright future. We've all taken a deep breath and we'll solely press the report button upon the incitement of conflict, opposed to engaging with it. I can feel it. No more fighting, only love. The love for development and technology. We realise that we're holding computers in our hands that are nothing short of a miracle, sliding casually in and out of our pockets every single day. All whilst the wars in the world are raging on. Understand one another, tolerate one another and if you must, ignore one another, for we are all only human. Thank you for this moment and now please continue discussing the topic at hand, with respect. -Timmy├
[Android Software/Hacking General [Developers Only]] nagper:
Just wanted to ask for that, thanks! :)

I've just tried your RO2RW script, works without any problems, even has the option to remove bloatware on the fly, perfect.

I did not flash the result btw as i want to go back to a RO file system.

I wonder if i can leave the ext4 conversion out completely like this:

mount -o loop erofs_partition_exported_by_lpunpack.img /mnt
mkfs.erofs --exclude-regex=YouTube no_youtube.img /mnt/
img2simg no_youtube.img no_youtube_sparse.img

Would it work to flash the resulting image partition (and not the whole super partition) with fastboot?
[Android Software/Hacking General [Developers Only]] TheGhost1951:
Please stay on target of this thread so as to prevent confusion...
[Android Software/Hacking General [Developers Only]] IamTheBRAVE:
If you used leegarchat's script, move this post to his thread. There's enough problems as it is.
[Android Software/Hacking General [Developers Only]] Aitra:
Twice I have experienced turning the ro/rw switch on and off only after excluding the phone encryption.
[Android Software/Hacking General [Developers Only]] lebigmac:
which one is more fool proof? Or it's the same? Will the first one work just as good as the 2nd option? :unsure:

Thanks (y)

chmod +x $binDir/*

# or

for i in $binDir/*; do chmod +x $i; done
[Android Software/Hacking General [Developers Only]] TheGhost1951:
trying it now....
[Android Software/Hacking General [Developers Only]] TheGhost1951:
nope, for what ever reason, it keeps failing with the my_manifest b.img error only all others are successful! bummer! always the my_manifest_b.img and it is always the last one that the script tries to convert!
[Android Software/Hacking General [Developers Only]] xxXDarkNightXxx:
Can someone help solve the problem?
[Android Software/Hacking General [Developers Only]] lebigmac:
@xxXDarkNightXxx Which problem?

You still didn't show me a screenshot of what happens when you do this...

And you did fastboot flash the super_patched.bin to your super block device right? :unsure:

Still working on resolving that size issue but I think I'm pretty close to fixing it ;)(y)
[Android Software/Hacking General [Developers Only]] lebigmac:
Seems to work on both EXT4 and EROFS on my Redmi Note 12 5G :D(y)

Some features are still missing such as the update-binary but that's easy to add.

F2FS support coming in 1. quartal 2023 ! ;)
[Android Software/Hacking General [Developers Only]] SpatialDistortion:
hello how to remove avbctl? because if my verity and verification are disabled my phone won't be able to boot
[Android Software/Hacking General [Developers Only]] Bogdkdkd:
This Anyway stops on my_manifest
[Android Software/Hacking General [Developers Only]] lebigmac:
That's weird. I made sure it deletes all the EROFS working files at run time. You can check under ls -l /data/local/tmp/sysrw_1.34/img/

Did you have any success piping the file in question manually through my MakeRW / ro2rw sub-partition converter tool (the latest makerw binary is in the /bin sub-folder of v1.34) to get rid of the EROFS read-only lock and then putting together the super_patched.bin manually?
[Android Software/Hacking General [Developers Only]] Aitra:
Please guide in detail how to create file super_patched.bin from files "name".IMG child?
[Android Software/Hacking General [Developers Only]] Aitra:
Only these things remained, the important usable things never appeared.
[Android Software/Hacking General [Developers Only]] Bogdkdkd:
I don't know how to use this binary
[Android Software/Hacking General [Developers Only]] Thisisauser6443:
@lebigmac, first of all, I just want to appreciate what you've done to achieve this. I was reading the header notes, on the first post, and I have to say, you're really passionate about it, so thank you for this :)

This is probably a dumb question, but after I've run the script (within Android mode), what exactly do I need to flash in f.b? Is it only just super_patched_new.img, or all of the dumped files including super_patched_new.img (vbmeta, product, system, system_ext and vendor)?
[Android Software/Hacking General [Developers Only]] lebigmac:
@xxXDarkNightXxx thanks for screenshot (y)

Congratulations sir! Your device is R/W :D(y)

Have fun debloating and customizing your Android device :love:(y)

Your /product partition seems to be mounted in a special way but I'm sure if you hack at your fully read/write-able system long enough even that can be made RW with a little effort ;)(y)
[Android Software/Hacking General [Developers Only]] lebigmac:
Hi thanks for the kind words and for your interest in this amazing and unique RW project for Android. :D(y)

If the super_fixed.bin (super_patched.bin) was generated by my script without any errors, then I'd say it's safe to fastboot flash it to your super block device like this:

# pull file to computer
adb pull /data/local/tmp/sysrw_1.34/img/super_fixed.bin

# reboot bootloader
adb reboot bootloader

# flash it
fastboot flash super super_fixed.bin

Please CLICK HERE for more detailed instructions on how to manually put back together your super_patched.bin file after you've piped them through my official MakeRW / ro2rw sub-partition converter/resizer tool (latest version of the makerw binary can be found in v1.34)

Good luck! (y)
[Android Software/Hacking General [Developers Only]] lebigmac:
Just run the included makerw binary without any arguments and it should give you usage examples ;)(y)

Thanks for the screenshot. (y)

You know what I've been thinking? What if we make lpunpack NOT extract all those useless cow sub-partitions and only extract those that we actually need? :unsure: That should save a truckload of space that would otherwise go to waste.

In your specific case you would get 2 GB extra space to work with... Perhaps that could help prevent the out of space error on the my_manifest.img ? :unsure:

What do you think? I'll try to implement this later today as I'm on the road again :)