yashsingh1/xdaforums huggingface dataset:
[Android Software/Hacking General [Developers Only]] Techguy777:
Honestly Im not a 100 percent sure anymore. I know it's a super img and it's really different in twrp there's a ton of new partitions and you have to wipe it off completely to flash a new system. I really haven't dug to deep into everything because I know that S6 oneui isn't writable and actually upset me because it's not like having full root access anymore.
[Android Software/Hacking General [Developers Only]] Lossyx:
For Windows users with TWRP.

(This is more like a reference)

From adb shell inside twrp.

X = Partition. To find out what block partition is mounted at, mount it in twrp then run 'df -h'.

e2fsck -f /dev/block/dm-x

resize2fs /dev/block/dm-x 3G

e2fsck -E unshare_blocks /dev/block/dm-x

Now reboot to fastbootd and execute:

fastboot resize-logical-partition <partition_slot> $((3*1024*1024*1024))
[Android Software/Hacking General [Developers Only]] giubenez:
Thank you for the script.

When I read that I could use it with the super.img I guessed the usage was like

./makesysrw.sh image.img super_edited.img

I have a linux partition, but on a remote server and I was hoping to use it on the file and get my edited file from the server without putting the phone in the server..

Let me knowif you add something like that(-i and -o flags will be useful)

Best
[Android Software/Hacking General [Developers Only]] lebigmac:
As much as I wish for a solution to be available to our fellow Windows users,

unfortunately your suggestion doesn't work here on my device see screenshot below.

View attachment 5236719
[Android Software/Hacking General [Developers Only]] Lossyx:
Yeah. These dynamic partitions are weird, because for some reason I only managed to do this on slot A. And only did it on the vendor partition.

Also, this is the reference i was going by;

https://twitter.com/i/web/status/1260577424418488324
[Android Software/Hacking General [Developers Only]] Brepro1:
I think the problem is that you are requesting too large amount of memory try to replace 3G with smaller amount of memory
[Android Software/Hacking General [Developers Only]] lebigmac:
If anybody is good with creating flashable zips contact me! Need help working on universal version right now which will also be compatible with Windows and Mac users!

I am only amateur so need a real pro to give me some assistance here. Thank you.
[Android Software/Hacking General [Developers Only]] noyxo:
Redmi note 9 pro. EU 12.0.2 rom. Android 10. It works. I installed WMware Workstation on a virtual machine in Windows. Thanks.(Google translate, sorry)
[Android Software/Hacking General [Developers Only]] MinhDat_Vo:
I can confirm that it works pềctly on my Pixel 4 XL Android 11 (coral-rq2a.210305.006) and Android 10 (coral-qq3a.200805.001), thank you for your awesome hard work! (y)
[Android Software/Hacking General [Developers Only]] gearmaker:
Tried it on my Oneplus 7T Pro with Android 10. It extracted the superimage but failed at writing it back. It returned this error:

error: file_write: write: No space left on device
lpmake E 03-02 21:41:55 76867 76867 images.cpp:468] [liblp]sparse_file_write failed with code: -1
lpmake E 03-02 21:41:55 76867 76867 images.cpp:326] [liblp]Could not open image for partition: product_a

makesysrw: Error! failed to create super_fixed.img file./makesysrw.sh super_image.img 14.21s user 37.28s system 51% cpu 1:40.46 total

Any ideas? Thank you for your great work!
[Android Software/Hacking General [Developers Only]] walid77dz:
my device is it with super img ?

View attachment 5249291
[Android Software/Hacking General [Developers Only]] d4ylight:
The device does appear to have a super partition from that screenshot. And to answer your previous question, on a Linux desktop machine, enter:

echo $PATH

This will show you the PATH environment variable that your system can reference from any directory. In our case, for the purpose of executing a necessary program from any directory. In other words: making sure that adb and fastboot's file paths are in $PATH helps you and I to not have to reference the locations of where adb and fastboot are installed. $PATH is a reference of shortcuts for the operating system.
[Android Software/Hacking General [Developers Only]] lebigmac:
Ok folks I fixed the problem. I'm wrapping it all up and making a flashable zip and then uploading today. I promised the new universal version would be available this week. Well today is still this week ;)

I'm so done with this project lol. It was a great bash programming exercise for me but I'm happy if I can start working on something new. I spent too much time on this project already.

EDIT: Just found a genius called @Kolibass who figured out a way to flash an 8 GB large file in just under 30 seconds. Now compare this to the 2-5 minutes using traditional fastboot! Holy cow that's fast. Multithreading anyone?
[Android Software/Hacking General [Developers Only]] walid77dz:
any help please ?
[Android Software/Hacking General [Developers Only]] lebigmac:
Wait a second I upload new version right now. Give me a minute.

Don't waste your time with that old version. The new version is a whole different beast! I think it deserve a new thread ;)
[Android Software/Hacking General [Developers Only]] lebigmac:
Great news! New universal version available HERE
[Android Software/Hacking General [Developers Only]] jhill110:
View attachment 5250289
[Android Software/Hacking General [Developers Only]] jhill110:
Well, I got not enough space error.
[Android Software/Hacking General [Developers Only]] lebigmac:
@jhill110 thanks for your feedback but you are in the wrong thread. This thread is for Linux only version ;)

To answer your question. You did not properly copy the makesysrw_1.15 folder including all the tools and the script to the correct path.

The folder makesysrw_1.15 should be located here: /data/local/tmp/makesysrw_1.15
[Android Software/Hacking General [Developers Only]] jhill110:
I executed it from twrp terminal :

/sdcard/data/local/tmp/makesysrw_1. 15/makesysrw.sh

and the script ran.

But got the above error about no space.

Linux only??? Hmm...

Actually I'm using my old atari 400...:D
[Android Software/Hacking General [Developers Only]] lebigmac:
Lol this doesn't look good. It seems like the new path check failed. Thanks for feedback @jhill110
[Android Software/Hacking General [Developers Only]] ronlkh1965:
I tried this method and the result is not good
[Android Software/Hacking General [Developers Only]] lebigmac:
Hi ronnie.

Did you do

chmod +x ./makesysrw.sh

try run the script like this:

./makesysrw.sh

you did it like this:

sh makesysrw.sh

this is wrong

which phone are you testing it with right now? with super or without super image?
[Android Software/Hacking General [Developers Only]] ronlkh1965:
Mi9Pro5G without Super.img

I tried your above method and result same
[Android Software/Hacking General [Developers Only]] alecxs:
one can't run bash script on android because there is no bash at all (except for lineageos and termux). write script for ash. there is a reason for bundling busybox and set up own environment before running scripts

also take care of applets, you can do extensive testing on pc before release

https://xdaforums.com/t/tool-bin-official-toybox-for-android.3290884/#post-81797803

edit: official TWRP shipped with true bash now. applets still linked toybox (or dynamic linked binaries)
[Android Software/Hacking General [Developers Only]] Mikac21:
Do you think with Cygwin from Windows this will work?

My congratulations for your work
[Android Software/Hacking General [Developers Only]] lebigmac:
Thank you for your interest in this project @Mikac21. Why don't you run the

BRAND NEW UNIVERSAL VERSION

The new universal version requires no computer at all!

It has never been this easy to install my new script on your device.

Simply flash the flashable.zip inside TWRP and it launches the script automatically!

This Linux version is pretty much deprecated at this point. I might give it one last update sometime in the near future if there's high demand but that's about it.

setprop this.thread.readonly = 1;
[Android Software/Hacking General [Developers Only]] TNSMANI:
MOD ACTION:

Thread closed at OP's request.
[Android Software/Hacking General [Developers Only]] Oswald Boelcke:
Thread has been closed! The account of the author of this thread has been permanently suspended. Please, I ask everybody not to promote a banned user or his website, blog, work etc. on XDA. Thanks very much for your cooperation.

Regards

Oswald Boelcke

Senior Moderator
[Android Software/Hacking General [Developers Only]] lebigmac:
I haven't seen this error before. The good news is you almost reached the very end of the script.

To me it almost looks like your hard drive is full so the lpmake command is throwing an error.

Were all partitions successfully extracted from your super image? It's complaining that it can't find product_a partition.

This definitely needs further investigation...
[Android Software/Hacking General [Developers Only]] alecxs:
have modified dumpFile() a little to make script faster and save space on userdata
[Android Software/Hacking General [Developers Only]] lebigmac:
View attachment 5238631

lol that's quite the extensive modification compared to the original...

You even changed the version number to 1.02 ! How thoughtful.

Hey if it works for you I'm happy for you :)

Please keep in mind the new universal version is already in the works that's also going to be compatible with Windows and Mac users.

Alecxs I appreciate your effort but don't waste your time on modding the old version. Come join me and help me create the new version so all Android users (not only the Linux users) can enjoy a system that's read-write-able.

I do agree however that the process of dumping the original super to the computer is a little bit more time consuming than necessary. This is not due to a limitation of the script but rather an Android permission limitation...

You can't adb pull the original super file directly off the phone because if you try it on a stock phone you will get the 'adb cannot run as root on production builds' or 'permission denied' error and therefore the script must first copy the file to internal /sdcard before being able to pull it to the computer.

This is already fixed in the next upcoming version.
[Android Software/Hacking General [Developers Only]] uvzen:
The script does't detect root even though I have it.

Device: Xiaomi Redmi Note 9 Pro joyeuse Android 10
[Android Software/Hacking General [Developers Only]] lebigmac:
What's the result if you type this in your terminal:

adb shell which su
[Android Software/Hacking General [Developers Only]] uvzen:
I will check it later and let you know because I can't now.
[Android Software/Hacking General [Developers Only]] alecxs:
have seen you made a lot of advertising for this. i recommend to ask @munjeni for hosting precompiled binaries under releases tag, so we can always wget/bitsadmin binary depending on host arch, instead of bundling binaries without distributing source code...

also other binaries like simg2img should be installed via package manager if possible, for example on darwin/debian/fedora it is available

brew install -y simg2img
apt-get install -y android-tools-fsutils
yum --disablerepo=updates* install -y android-tools
[Android Software/Hacking General [Developers Only]] lebigmac:
@Alecxs. The reason why I made lots of comments about this method is to bring more attention to this technique. My intention was not to spam the forum.

And no I did not invent this method I only found it hidden deep inside the forum after a very long time of searching. It was very well hidden or I just don't know how to navigate the new forum software yet.

I had to go even as far as learning hex editing before finally out of the blue I discovered those threads that helped me to create this script.

I just wanted to automate the entire process and make this method available to a wider audience so everyone can enjoy a system that's read-write-able. That's all. If such a script were available back in February it would've saved me lots of trouble and time.

If anything all credits should go to @Brepro1 , @AndyYan and @gabrielfrias also @munjeni for his nice superunpack tool.

My script is basically a carbon copy of the excellent Brepro1 / AndyYan tutorial (links in post #1)

Yes I agree releasing those precompiled binaries in the /tools folder without including the source code is not optimal. I might include a /source folder in the next version. Thanks for the idea.
[Android Software/Hacking General [Developers Only]] lebigmac:
If you look closely at this screenshot you will see what the problem is.

You don't have the adb program in your $PATH environment variable.

So in order to fix this you must add your adb and fastboot to your $PATH environment variable.

That should fix your issue. Good luck!
[Android Software/Hacking General [Developers Only]] alecxs:
no need to bundle source code, just links is already sufficient. unfortunately didn't find any useful download source or packages providing Dynamic Partition Tools, leaving you no choice to bundle binaries :(

edit: found lpunpack at least for linux

https://github.com/AndroidDumps
[Android Software/Hacking General [Developers Only]] lebigmac:
@Alecxs there's this:

https://android.googlesource.com/platform/system/extras/+/master/partition_tools/
[Android Software/Hacking General [Developers Only]] zgfg:
By putting to GitHub, the source code, changes, (tagged) releases, everything will be easily available and managable, with the possibility for other developers to contribute (branches, pull, merge)
[Android Software/Hacking General [Developers Only]] alecxs:
@zgfg maybe you provide build-bot for binaries cross-platform :)
[Android Software/Hacking General [Developers Only]] alecxs:
what's the purpose of this? do you want to compile binaries for aarch64 and provide flashable zip?
[Android Software/Hacking General [Developers Only]] lebigmac:
You must admit that does sound good doesn't it? Anything to simplify the process and make our lives easier.

Unfortunately due to my limited compiling knowledge and limited resources I've hit a roadblock so I'm waiting for somebody with more compiling experience to contact me. Any volunteers?

The script in its current state and form works great for Linux users but I'm just sad for all the Windows and Mac users who are missing out on a system that's read-write-able and all the endless device customization possibilities that brings with it.
[Android Software/Hacking General [Developers Only]] alecxs:
that was also my plan before i read your thread. ask here
[Android Software/Hacking General [Developers Only]] lebigmac:
Thanks @Alecxs.

In your modification of the dumpFile function of the script why do you replace the dd command with this?

'cat $superPath 2> /dev/null' > $newPath

Does that pretty much do the same thing as dd ? Is it faster than dd ? Thanks for clarifying.

I always thought dd was the way to dump a file from the phone. It would've never occurred to me to use the cat function for this purpose. I thought that was more for reading text files and stuff.
[Android Software/Hacking General [Developers Only]] ronlkh1965:
Hi any idea what is my problem?

partition_3_name = system

attributes = 0x1

first_extent_index = 0x2

num_extents = 0x1

group_index = 0x1

partition_group = qti_dynamic_partitions

extent num_sectors = 0x6c5718 (0xd8ae3000 bytes total)

extent target_type = 0x0

extent target_data = 0x4bf800 (dumping offset = 0x97f00000)

extent target_source = 0x0

Filetype EXT4. EXT4 size = 0xd8ae3000

Dumping system.ext4 ...

....................................................

........................................Error writing 512 bytes!

makesysrw: Please make sure the file exists and try again.
[Android Software/Hacking General [Developers Only]] lebigmac:
Now that's a new one. Never seen this error before. Your error is happening while the superunpack tool is running. What's happening before partition_3_name = system?

Does the superunpack tool successfully extract the other 2 partitions from your super_original.img file ? vendor.ext4 and product.ext4 ? So it failed at system.ext4 right?

If the super_original.img file was successfully dumped to your computer you could try to run this command manually and post the results here. Thanks

./tools/superunpack super_original.img
[Android Software/Hacking General [Developers Only]] alecxs:
cat is faster than dd but the main what changed is streaming partition straight into (host) terminal and redirect (host) stdout into partition image on host directly without intermediate temp file on client. works with dd too, same as adb exec-out (linux only).

of course in recovery mode adb pull is still faster, but this is working in boot mode (whatever the reason is for instead of just pulling from twrp)
[Android Software/Hacking General [Developers Only]] uvzen:
Is it normal that super_fixed.img weighs less than super_orginal.img?
[Android Software/Hacking General [Developers Only]] uvzen:
After flash I have bootloop, it's good that I have a backup.
[Android Software/Hacking General [Developers Only]] alecxs:
you probably have a/b device while this script is for a-only. backup is good point we should make sure super_original.img always exist on host and double check with sha256 (and is never deleted/overwritten from script)
[Android Software/Hacking General [Developers Only]] lebigmac:
Yes it's normal for super_fixed.img to have smaller size than super_original.img because the latter is in raw format while the former is in sparse format.

@uvzen how did you flash super_fixed.img ? Yesterday you said you don't have that file because lpmake throw an error at the very end?

So did you end up successfully running the script without any errors or not? Please show me your screenshot again.

In case something goes wrong you can always flash back your super_original.img by doing :

fastboot flash super super_original.img

But this shouldn't be necessary as the script usually recognizes if there is an error and aborts. For example if you get lpmake error at the end then there will be no super_fixed.img file to flash and it will abort.
[Android Software/Hacking General [Developers Only]] jhill110:
Can I use a bootable DVD of Linux on my windows machine to do this? If so how would I go about adding adb to the environment variable?

Anybody have any advice on a good and lean Linux solution for a bootable DVD?
[Android Software/Hacking General [Developers Only]] uvzen:
I switched to a second PC with a virtual machine and the super_fixed.img file was created without any errors, but it hangs on flash and I have to terminate the script before flash operation and manually flash from windows 10
[Android Software/Hacking General [Developers Only]] lebigmac:
The super_fixed.img is created without any errors and you still get bootloop after flashing it manually? That's weird.

Did you disable dm-verity and verification?

It probably hangs on flash because there is some kind of fastboot error. Maybe fastboot doesn't work on virtual machines due to some kind of USB driver problem or something.

Keep in mind this script was developed on an actual real machine, not a virtual one. I'm surprised it even runs on a virtual machine at all.
[Android Software/Hacking General [Developers Only]] lebigmac:
That lpmake error definitely needs further investigation...
[Android Software/Hacking General [Developers Only]] alecxs:
@lebicmac your are using arithmetic expansion for calculation sizes in bytes. that may cause integer buffer overflow. check myargs.txt for errors
[Android Software/Hacking General [Developers Only]] lebigmac:
@Alecxs I searched online and many places they say to use arithmetic expansion for adding two integers together such as here:

How can I add numbers in a Bash script?

I have this Bash script and I had a problem in line 16. How can I take the previous result of line 15 and add it to the variable in line 16? #!/bin/bash num=0 metab=0 for ((i=1; i<=2; i++)); ...

stackoverflow.com

I checked the myargs.txt but couldn't find any errors. Where exactly did you find an error please let me know?

So far the script works just fine on my computer/device. I just tested it again today. No problems here.
[Android Software/Hacking General [Developers Only]] ronlkh1965:
root@ubuntu:/home/ronlkh# ./tools/superunpack super_original.img

---------------------------------------------------------

Super image dumper v_11 (by expert :) munjeni @ xda 2020)

---------------------------------------------------------

LpMetadataGeometry magic = 0x616c4467

LpMetadataGeometry struct size = 0x34

LpMetadataGeometry sha256 = 4E31CF64275442F40E25C772A18D1FCCD8B1291232E593F65E522FC7AC07DF03

LpMetadataGeometry metadata_max_size = 0x10000

LpMetadataGeometry metadata_slot_count = 0x2

LpMetadataGeometry logical_block_size = 0x1000

LpMetadataHeader magic = 0x414c5030

LpMetadataHeader major_version = 10

LpMetadataHeader minor_version = 0

LpMetadataHeader header_size = 0x80

LpMetadataHeader header sha256 = 0C33F54AD3D2566C375AF93EC4C87E25790373CEE8448BBE45DF26B730DFD75F

LpMetadataHeader tables_size = 0x1d0

LpMetadataHeader tables sha256 = 7B0623329AC6DAEC0D85E2B5CF4246CFEDBF01BB611ADB6FF1EEC22962190C96

LpMetadataHeader partitions offset = 0x0

LpMetadataHeader partitions num_entries = 0x4

LpMetadataHeader partitions entry_size = 0x34

LpMetadataHeader extents offset = 0xd0

LpMetadataHeader extents num_entries = 0x4

LpMetadataHeader extents entry_size = 0x18

LpMetadataHeader groups offset = 0x130

LpMetadataHeader groups num_entries = 0x2

LpMetadataHeader groups entry_size = 0x30

LpMetadataHeader block_devices offset = 0x190

LpMetadataHeader block_devices num_entries = 0x1

LpMetadataHeader block_devices entry_size = 0x40

Partitions = 4 used, 0 not used, total 4

partition_1_name = product

attributes = 0x1

first_extent_index = 0x0

num_extents = 0x1

group_index = 0x1

partition_group = qti_dynamic_partitions

extent num_sectors = 0x1a4f18 (0x349e3000 bytes total)

extent target_type = 0x0

extent target_data = 0x800 (dumping offset = 0x100000)

extent target_source = 0x0

Filetype EXT4. EXT4 size = 0x349e2000

Dumping product.ext4 ...

....................................................

....................................................

.Error writing 512 bytes!

root@ubuntu:/home/ronlkh#

-rwxr-xr-x 1 ronlkh ronlkh 9539 Feb 28 11:54 makesysrw.sh

-rwxrw-rw- 1 ronlkh ronlkh 1555920 Mar 3 05:42 makesysrw.tar.xz

drwxr-xr-x 2 ronlkh ronlkh 4096 Mar 4 06:32 Music

drwxr-xr-x 2 ronlkh ronlkh 4096 Mar 4 06:32 Pictures

-rw-r--r-- 1 root root 882581504 Mar 4 07:49 product.ext4

-rw-r--r-- 1 ronlkh ronlkh 807 Mar 3 16:09 .profile

drwxr-xr-x 2 ronlkh ronlkh 4096 Mar 4 06:32 Public

-rw-r--r-- 1 ronlkh ronlkh 0 Mar 4 06:33 .sudo_as_admin_successful

-rw-r--r-- 1 root root 9126805504 Mar 4 07:36 super_original.img

-rw-r--r-- 1 root root 600993792 Mar 4 07:36 system.ext4

drwxr-xr-x 2 ronlkh ronlkh 4096 Mar 4 06:32 Templates

drwxr-xr-x 2 ronlkh ronlkh 4096 Feb 28 10:22 tools

-rw-r--r-- 1 root root 1664978944 Mar 4 07:36 vendor.ext4

drwxr-xr-x 2 ronlkh ronlkh 4096 Mar 4 06:32 Videos

Take note, I am running ubuntu on VMWare on my windows10
[Android Software/Hacking General [Developers Only]] alecxs:
i did not find any error, just a hint. this is personal experience, differs for each device. for example

$ echo $((9243328512+123456789))
776850709
$ expr 9243328512 + 123456789
9366785301