• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!
Search This thread

lebigmac

Senior Member
Jan 31, 2017
933
556
The manual method worked for Pixel 4a on Android 12 (modified script), but even tho I can mount system R/W, I only get 0kb files when copying and can't create folders anywhere. I tried with FX, Root Explorer and ADB with the same results.
My goal is install Cerberus in priv-apps, I'm rooted with Magisk.
Hi @Nad4. Thanks for your log files (y). This is great news! Does this mean your device still boots after flashing the patched super image? The script actually works in Android 12? That's crazy! I'm surprised they didn't fix this System RW vulnerability in Android 12 yet?!
Which device are you using?

If you can mount your system as rw and delete system files but you cannot write into your system that means script works :love:(y) but it looks like your system has ran out of space :oops:
To increase free system space you can run script again with a larger custom size. For example size=50 or size=100
Good luck! (y)

auto-resize feature in next version should take care of such issues ;)(y)
 
Last edited:

Nad4

New member
Nov 28, 2021
3
0
Hi @Nad4. Thanks for your log files (y). This is great news! Does this mean your device still boots after flashing the patched super image? The script actually works in Android 12? That's crazy! I'm surprised they didn't fix this System RW vulnerability in Android 12 yet?!
Which device are you using?

If you can mount your system as rw and delete system files but you cannot write into your system that means script works :love:(y) but it looks like your system has ran out of space :oops:
To increase free system space you can run script again with a larger custom size. For example size=50 or size=100
Good luck! (y)

auto-resize feature in next version should take care of such issues ;)(y)
I tested it on Pixel 4a (Sunfish), build SP1A.211105.002
Actually after deleting a system app (from file explorer) and rebooting I got a bootloop. Flashing a stock ROM didn't work until I flashed the original super partition, the device is working now but that gave me enough of a scare to not mess with it again :(
 

lebigmac

Senior Member
Jan 31, 2017
933
556
Be very careful when modifying system files! One little mistake can cause a bootloop!
I'm happy that you managed to get back out of that bootloop :D(y)
Please let us know your results if you decide to try it again once you recover psychologically from that bootloop ;)(y)
 
Last edited:
  • Love
Reactions: Nad4

jhayprince

Member
Nov 20, 2021
8
3
Hi again @LanceLot9980.
Yes I mean this path in Android /
Or this path in recovery /system_root
I'm happy that now you can finally mount these aforementioned paths as read/write-able and fully debloat your device :D(y)

Try running script again with larger custom size such as size=25 or size=50 for instance. And then please send me your log files. Thanks. Your feedback is useful for further development of script.
Good luck! Have fun debloating your device and make lots of backups before doing so! (y)


Hi @jhayprince. Thanks for your log files.
Congratulations! Enjoy a fully read/write-able device! :love:(y)

Which error was
 

Attachments

  • lpdump.txt
    1.5 KB · Views: 6
  • mylog.txt
    35 bytes · Views: 9
  • Screenshot_2021-11-30-03-10-52.png
    Screenshot_2021-11-30-03-10-52.png
    178.1 KB · Views: 11

Toreton

Member
Mar 6, 2010
16
1
31
Donetsk
Realme Narzo 30 5G
@lebigmac Realme Narzo 30 5G
I can remount to RW almost all important partitions (after I fixed #238 string) and I have the same problem when I used default (size=15) but with size=50 all is working fine for now!
Thx man!!!

Here are both logs:
 

Attachments

  • log_MOD_size15_systemrw_1.32_flashable.zip
    3.7 KB · Views: 2
  • log_MOD_size50_systemrw_1.32_flashable.zip
    3.2 KB · Views: 3
Last edited:

lebigmac

Senior Member
Jan 31, 2017
933
556
So while trying to get this script to work again on Redmi 9 I figured out something. @lebigmac if I run the script in recovery then reboot my device to "fastbootd" mode then do the commands fastboot erase system, vendor, product. Then reboot to recovery and reflash my rom I can get vendor and product RW but still no System RW
Hi again @xda general. You never sent me your log files from script folder...

Are you sure you can't mount your system as RW after running my script on your Redmi Note 9 (merlin) ?
Here you said that it works on your device. According to your screenshot you can mount all your important partitions as RW including your system partition:

Screenshot_20210908-102916854.jpg


Now compare to my screenshot:
1-jpg.5235933

If you don't get the '/dev/block/dm-0' is read-only error that means it works! Congratulations! :love:(y)

Why would you format or erase your partitions after running my SystemRW script? That doesn't make any sense at all.
You must only reboot device once after running the script! That's all! ;)(y)

Have fun debloating and customizing your fully read/write-able device! :love:(y)



HI and thx. Your script works great.
I just flashed it from TWRP (I have Super Partition and I didn't change size, default 15)
It took few mins and all is ok. Now I can get my phone working much better .
OnePlus Nord 2 (DN2103), android 11
Thank you very much.
Hi @jis251
Thanks for your positive feedback. I'm happy that the script works perfectly on your OnePlus Nord 2 device.
Have fun debloating and customizing your fully read/write-able device! :love:(y)



Hi there, I'm running rooted Android 11 on a Moto G Power 2021. I have tried and failed a few attempts both with the initial instructions and also the repair method you have provided. I would like to attempt using the SuperRepack process you linked to in the first post but am not sure how to apply it to your method to make it work. Could you provide some guidance on this and if possible the location of the super.bin file and what needs to be entered in the command line? Thank you and please.
Hi @JLamp thanks for your interest in this project. I'm sad to hear that you were not able to get the script to work on your Motorola device. Don't worry I'm sure we can get it to work. Please send me your log files from this folder:
/data/local/tmp/systemrw_1.32/log/
Hopefully in next version I can finally fix that annoying error 73 that some motorola users experience.
Sadly I don't have access to a Motorola device or else I could've fixed this annoying issue a long time ago...

To undo all changes performed by my script you can simply reflash original stock read-only super image and re-enable dm-verity and verification either through adb/fastboot or with the included avbctl binary (inside /tools/ subfolder - also available in recovery).

Then it should be no problem to run the amazing superrepack tool by @munjeni on your stock read-only super image. Even though both tools pretty much do the same thing but in a different way (his tool does the job in a much more sophisticated way and on the fly) you should have better luck with his tool because that guy is a real professional. Remember I am only beginner programmer that's why my script is not perfect yet but don't worry I'm constantly working on improving it so please keep your feedback coming. Thanks! ;)



my friend we are thesame model redmi note 10 pro global miui 12.5.8...
but for me is working perfectly..
first thing i did is flash the zip file and give error...
then i restart my phone after flash the zip...and start to flash again and its working perfectly without error..but sad things i can't remove the system file...then i download terminal emulator and grant permission then i type this code su and hit enter then mount -0 remount,rw /system_root
after that i restart my phone and its work like a charm....
what can i do to r/w the vendor...only system are r/w
Hi again @jhayprince. Your first log looks good. Your second log is empty.
systemrw: NO 'shared_blocks feature' detected @ system.img
systemrw: NO 'shared_blocks feature' detected @ system_ext.img
systemrw: NO 'shared_blocks feature' detected @ product.img
systemrw: NO 'shared_blocks feature' detected @ vendor.img
It looks like script successfully removed shared_blocks read-only feature from your most important partitions including /vendor :D(y)

Please run this code below while device is in Android mode and upload this file here/sdcard/my_tune2fs_output.txt
Thanks! (y)
Bash:
adb shell
su
touch /sdcard/my_tune2fs_output.txt
for i in `seq 0 5`; do tune2fs -l /dev/block/dm-$i>>/sdcard/my_tune2fs_output.txt; done



@lebigmac Realme Narzo 30 5G
I can remount to RW almost all important partitions (after I fixed #238 string) and I have the same problem when I used default (size=15) but with size=50 all is working fine for now!
Thx man!!!

Here are both logs:
Hi @Toreton thanks for your log files.
You replaced this line of code
if [[ "$imgName" == *"system"* || "$imgName" == *"product"* || "$imgName" == *"vendor"* ]]; then makeRW $fName; fi
with this line of code?
makeRW $fName
That's a great idea! Why only make RW system, product and vendor if you can make them all RW? :D
I shall make this the default behavior in next version. Thanks for your feedback!(y)

I'm happy you got everything to work properly after running script a second time with larger custom size (y)
Have fun debloating and customizing your fully read/write-able device! :love:(y)
 
Last edited:
  • Like
Reactions: Toreton

jhayprince

Member
Nov 20, 2021
8
3
hoping you help me lebigmac to analyze what is the problem why only system become rw but the vendor and system_ex and product image are cant touch .thank you
 

lebigmac

Senior Member
Jan 31, 2017
933
556
@jhayprince can you please run these commands below and show screenshot. Thanks! (y)

Bash:
adb shell
su
# If you're in custom recovery you need to do mount -o remount,rw /system_root
mount -o remount,rw /
mount -o remount,rw /product
mount -o remount,rw /vendor

If everything works correctly then it should look something like this:
screenshot_20210908-102916854-jpg.5471687
 

jhayprince

Member
Nov 20, 2021
8
3
@jhayprince can you please run these commands below and show screenshot. Thanks! (y)

Bash:
adb shell
su
# If you're in custom recovery you need to do mount -o remount,rw /system_root
mount -o remount,rw /
mount -o remount,rw /product
mount -o remount,rw /vendor

If everything works correctly then it should look something like this:
screenshot_20210908-102916854-jpg.5471687
 

Attachments

  • mount&remount.jpg
    mount&remount.jpg
    276.1 KB · Views: 4

Top Liked Posts

  • 1
  • 3
    i use poco m3 rom xtrv hellas....your script is rock..i remove permanently bloatware with root explorer...nice job
    Hi @masricky I'm happy you like the script. Please send me your log files from this folder. Thanks (y)
    /data/local/tmp/systemrw_1.32/log/

    Enjoy tinkering with your fully read/write-able device and make lots of backups before modding stuff! :love:(y)

    Yes it's true. I wrote this script but it wouldn't exist as such without
    Thank you to everyone who contributed positively to this project! :D(y)
    Also keep in mind script is not perfect for all devices out there yet. Rest assured I'm always working hard on next version ;)(y)
    2
    Thanks! It works flawlessly (although I had to do it manually, it's easy enough). My device is a Redmi Note 9S (curtana). If I update my device, do I need to remake the fixed super.img or should I flash the one made before the update?
    Hi @LanceLot9980. Congratulations for getting the script to work on your device! Enjoy a fully read/write-able device! :love:(y)
    If you upload your log files from script folder and a screenshot of your system mounted as r/w then I can add you to the list of successful devices on front page ;)(y)

    @LanceLot9980 yes I noticed your question but I was on the road.
    If you update OTA this will most likely restore the shared_blocks read-only feature on your super partition which means you will have to run script again if you want to go full r/w again ;)
    Thanks! It works flawlessly (although I had to do it manually, it's easy enough). My device is a Redmi Note 9S (curtana). If I update my device, do I need to remake the fixed super.img or should I flash the one made before the update?
    The flashable zip gave you error 255? Don't worry I already fixed this issue in next version ;) Hopefully I can release it soon!
    2
    @tids2k için çok fazlaki geri bildiriminiz için teşekkür edilir. Evet, bu bootloop bekleniyordu. Sanırım bu, [2470925]@Hippie459MN[/KULLANICI]'nın birkaç gün önce genel Sony Xperia amiral gemisi yemekta aynı inatçı çekirdekli paniksi.
    gerçek betiğin bir sürüm, Almanya'da kötü durumdaki 255, motorola sürücüsündeki can sıkıcı 73 ve bu inatçı hata siniri gibi bu sorunlardan bazılarını çözecektir. Tam Android 12 olur de harika olurdu.




    Merhaba [KULLANICI=11226285]@kafeinsiz[/KULLANICI] geri bildiriminiz için teşekkürler! Senaryomun Xiaomi azda çok memnunum. Tebrikler! Okunabilir/yazılabilir bir ürünlerden çıkarılabilir!:Aşk :()

    mevcut özel boyutlar=25 (MB) mi kullandınız?

    Android 11 çalıştırdığınızdan emin misiniz? Günlüğünüzde söylüyor diyor ki:
    Evet kesinlikle A11. A10 bir hata nedeniyle burada görünüyor.
    2
    hi and thank's for your work...
    I have an issue with your script, I flash it on twrp on my renoir on A11 LOS and the flash is correct but at the end got these errors messages
    failed to mount system/ext/product/vendor (invalid argument) here are the logs and the ss...

    when I try to copy a .xml on vendor partition got, no more space available and it copy a .xml but empty..
    Hello @rayman95. You're welcome. Thanks for your log files and the screenshot (y)
    Don't worry about this TWRP related error at the very end. This has nothing to do with the script. This only means you must reboot the device. That's all ;)(y)
    Failed to mount '/system_ext' (Invalid argument)
    Failed to mount '/product' (Invalid argument)
    Failed to mount '/vendor' (Invalid argument)

    According to your log it looks like everything worked as expected but I think you must run script again with larger custom size. Which custom size did you use? I can't see it in the log :(
    Hopefully I can release that new version soon. The included auto-resize feature should fix this kind of issue in next version ;)(y)



    it worked great on poco x3 pro, but vendor didn't, when I try to edit an XML located in "vendor/etc/device_features" it doesn't work, even so, thank you very much for the work.
    Hi @Revokke. You're welcome. Thanks for your feedback.
    Please feel free to send me your log files from this folder and I'll have a look at your specific issue. Thanks (y)
    /data/local/tmp/systemrw_1.32/log/

    Which MIUI version number are you using? Official stock MIUI or Xiaomi.eu ROM ?
    What do you mean it doesn't work? I just tried it on my device and it just works. I can create and delete files in this directory /vendor/etc/device_features
    Make sure you remount /vendor partition as rw before copying or deleting files.
    If you can only write empty files to /system, /product or /vendor that means you must run script again with larger custom size. Good luck! (y)
    1
    Hi.
    I can't believe script works in Android 12!
    Did you flash super_fixed.bin to the super partition yet? Chances are high that you will get a bootloop if you do it.
    Make a full backup before proceeding just in case.
    Please send me your log files from this folder. Thanks.
    /data/local/tmp/systemrw_1.32/log/
    Good luck.

    Bootloops :-D , still excited to see it works flawlessly. But I think you would probably need to tinker it a little to fully support A12.
  • 110
    If you can't get this script to work on your device check out the brand new sophisticated superrepack tool by @munjeni


    logo_large.jpg

    SystemRW© v1.32 by lebigmac

    Creation date: February 2021
    Updated: August 2021

    Requirements:
    • rooted STOCK Android 10 or newer (custom ROM should already be R/W!)
    • at least 10+ GB free space on phone for dumping data
    Description:
    A script for all Android power users that wish to make their read-only Android 10+ system read/write-able again to remove bloatware and make more thorough customizations to their device.
    Script only modifies super and vbmeta partitions. /data partition is not affected. It's only used for dumping data and for storing script files.
    In a nutshell this is what the script is doing:
    • dumps your existing super OR your system / product / vendor partitions depending on whether or not you've got super partition
    • extracts embedded read-only partitions (system, vendor, product...) from super if applicable
    • makes these partitions read/write-able
    • joins everything back together to new super.img OR NOT depending on whether or not you've got super partition
    • flashes read/write-able images back to device using the super fast Kolibass technique (only in recovery mode)

    NOTE:
    • Extract BUNDLE.zip (the included sysrw_repair.zip is only for fixing error 73!)
    • Before launching script make sure you've got full read/write access to the /data partition by first decrypting and then mounting /data partition as R/W!
    • Before running this experimental software on your device it is recommended to make a full backup of your device (just in case you are unlucky enough to end up in an irreversible bootloop)
    • The script can be run both inside custom recovery and inside Android operating system.
      If you run script in Android mode you will need to fastboot flash the patched image(s) manually!
    • To check whether or not you've got a super partition on your device you can run this command: adb shell "ls -l /dev/block/by-name/super"
    • To check whether or not your device has the notorious shared_blocks read-only feature you can run these commands in Android:
      Bash:
      adb shell
      su
      touch /sdcard/my_tune2fs_output.txt
      for i in `seq 0 5`; do tune2fs -l /dev/block/dm-$i>>/sdcard/my_tune2fs_output.txt; done
    Manual installation:
    • Extract flashable.zip and copy systemrw_*VERSION* folder into /data/local/tmp/
    • run this command to make the script executable:
      chmod +x /data/local/tmp/systemrw_*VERSION*/systemrw.sh
    Automatic installation:
    Installation of the script has never been this easy!
    Download the flashable.zip below, do NOT enable zip signature verification and simply install it in your custom recovery (works in TWRP, OrangeFox and PBRP!)
    The installer binary will auto-detect whether or not your device has a super partition and launch the script accordingly with the proper command line arguments.

    Flashable zip custom usage:
    You can set these custom installation arguments in the included config.ini file.
    Simply extract the flashable.zip and modify the included config.ini file and then save the file. Then compress the systemrw_*VERSION* and META-INF folders again as a new .zip and install it in recovery.
    First line of config.ini contains the script arguments for those WITHOUT super partition.
    By default this line is completely empty (no space).
    Second line of config.ini contains the script arguments for those WITH super partition.
    For example if you already dumped your super_original.bin and want to skip that process next time you install the .zip then put this in line #2 of config.ini :
    in=`ls -l /dev/block/by-name/super | awk '{print $NF}'` size=15
    Remember if you decide to use custom arguments in config.ini then the first character should always be an empty space. If no arguments are used such as by default in line #1 (no super) then the line should be completely empty, no space, nothing.

    Script usage:
    If you've got no super partition then simply call the script with no arguments from the shell (see examples below).
    If you've got a super partition I would recommend using the optional size=15 parameter as well to give some extra free space (in MB) to each partition.
    Optional script arguments:
    Replace x with your custom value
    • in=x *THIS IS IGNORED IF YOU'VE GOT NO SUPER PARTITION*
      With this flag you can specify an existing super image as input and skip the entire dumping of the super image process. Here you can use the super_original.bin which you dumped earlier with systemrw or the official unsparsed super.img from your downloaded firmware. (unsparse with simg2img). It's also possible to use your super partition block device as input.
      If omitted, systemrw will dump super image from phone to ./img/super_original.bin
      (path is relative to the script)
    • out=x *THIS IS IGNORED IF YOU'VE GOT NO SUPER PARTITION*
      With this argument you can specify the output path of the new patched super file.
      If omitted, default output value is ./img/super_fixed.bin
    • size=x *ONLY RECOMMENDED IF YOU'VE GOT SUPER PARTITION*
      With this parameter you can specify the extra free space (in megabytes) that will be added to each partition. There is a limit as to how much extra free space you can add per partition. Check your lpdump.txt to find out the exact maximum extra size.
      If omitted, default extra size is 0 (shrink to minimum)

    Examples:
    Bash:
    adb shell
    su
    cd /data/local/tmp/systemrw_1.32
    chmod +x ./systemrw.sh
    
    # Run this command *IF YOU'VE GOT NO SUPER PARTITION*
    ./systemrw.sh
    
    # Run this command if you're first time user *AND YOU'VE GOT SUPER PARTITION*
    # Specify the extra free space in megabytes for each partition:
    ./systemrw.sh size=15
    
    # Plug an existing super image into the script like this *ONLY IF YOU'VE GOT SUPER PARTITION*
    ./systemrw.sh in=./img/super_original.bin size=15
    
    # Specify both the input file as well as the output destination *ONLY IF YOU'VE GOT SUPER PARTITION*
    ./systemrw.sh in=./img/super_original.bin out=./custom/path/super_fixed.bin size=15
    
    # EXPERT EXAMPLE:
    ./systemrw.sh in=`ls -l /dev/block/by-name/super | awk '{print $NF}'` out=./img/super_fixed.bin size=50

    Uninstallation:
    • To free up space and keep script as well as r/w capability you can simply delete /img subfolder at /data/local/tmp/systemrw_1.32/img
    • To delete script and keep r/w capability you can simply delete whole script folder at /data/local/tmp/systemrw_1.32
    • To undo all changes performed by the script you can simply reflash original stock read-only super image and re-enable dm-verity and verification either through adb/fastboot or with the included avbctl binary (inside /tools/ subfolder - also available in recovery).

    Troubleshooting:
    If you get error 255 in custom recovery when trying to install flashable zip then try to install it manually. If you encounter this error please send me this file /tmp/recovery.log
    Make sure the script folder was correctly extracted to:
    /data/local/tmp/systemrw_*VERSION*
    If you can't run the script try making the file executable like this: chmod +x ./systemrw.sh
    If you still can't get it to work run which sh in your shell and replace the shebang in the first line of the script with the output of that command. Don't remove the first two #! symbols though. Then save the file and try again.
    Make sure you have full read write access to the /data/local/tmp directory and that the containing files are not encrypted in custom recovery!
    If you get bootloop after successfully flashing super_fixed.bin then you can undo bootloop simply by re-flashing original stock super image and re-enabling dm-verity and verification with the included avbctl binary (inside /tools/ subfolder - also available in recovery). Those are the only changes performed by the script.
    Good luck!

    About:
    I did not come up with all this by myself. After searching for a solution for countless days without success, going even as far as learning hex editing - I accidentally came across a couple of very interesting threads burried deep inside the new forum interface where this method has been described by various enthousiasts (links can be found in the credits section below). Therefore I take absolutely no credit for the underlying core mechanisms of the script. I'm only the amateur who put it all together into a compact script so that everybody can enjoy an Android system that's read/write-able again. Just like it used to be in Android 9 or earlier. Before this annoying 'shared_blocks feature' was implemented.

    Credits:
    Huge thanks to @Kolibass for allowing me to use his partition tools for Android. Without your tools this script would not work on the Android platform! This genius also showed me how to flash a 5GB file to my partition in just under 30 seconds! Much faster than fastboot! I still can't believe it!
    Big thanks to @Brepro1 for allowing me to basically copy his awesome tutorial and make it into a script. Without your tutorial guiding me I couldn't have created this script.
    Big thanks @munjeni for allowing me to use his superunpack V1 tool in the initial version. It helped me to understand how these super images work.
    Thanks @AndyYan your great tutorial also helped me a lot for automating the script especially the lpdump part.
    Thanks @bynarie for making available his otatools package! A part of it was bundled with the initial version which helped me to create this universal version. It's still part of the troubleshooting repair script to fix error 73.
    More thanks @gabrielfrias for his helpful comment
    Thanks @YOisuPU and of course @topjohnwu for discovering the 'shared_blocks feature'
    Thanks @HemanthJabalpuri for assisting me in optimizing the underlying algorithm!

    Disclaimer:
    #Disclaimer v2.0​
    This open source software is provided as is without any kind of warranty or support whatsoever.
    By using and viewing this software you agree to the following terms:
    • Under no circumstances shall the author be held responsible for any damages that may ensue from the (inappropriate) use of this software.
    • All responsibility, liability and risk lies with the end-user. You hereby agree not to abuse this software for illegal purposes.
    • Under no circumstances shall the comments & title section of the script (lines #1 - #65) as well as the included update-binary be modified or removed by the end-user without the original author's explicit consent.
    • Under no circumstances shall the end-user steal and / or abuse my entire SystemRW project or parts thereof (including but not limited to my update-binary, my script, my program logo, my program name or the names of my functions and my variables and more...) only to rename and republish my SystemRW project (or parts thereof) as his / her own without even mentioning original source or original credits!!! (yes this actually happened :( perpetrated by a fellow forum member...)
    • Unauthorized re-uploads of any files contained within this project to 3rd party websites are not permitted without the original author's prior consent!
    • The end-user is allowed to improve the underlying algorithm (as long as no malicious code is added) and post his/her improvements, results and feedback right here in the official SystemRW project thread @ xda-developers.com
    • If the end-user wants to integrate my SystemRW project into his/her own project then he/she shall first ask me (the original author) for permission.
      If you want to make a video tutorial about my script please contact me first!
      Thank you! I can give you high resolution project logo and more!

    Please make sure to post your feedback and suggestions in the official thread right here.
    Enjoy customizing your fully read/write-able Android device! And feel free to share your Android system mods with other users in this thread! Thanks!


    v1-31d_01-jpg.5309953
    v1-31d_02-jpg.5309955
    v1-31d_03-jpg.5309957


    1-jpg.5235933


    Confirmed working on these devices:

    Download v1.32 mirror #1

    Download v1.32 mirror #2
    more official download mirrors coming soon!
    current status: experimental


    If you like this project and want to support further development of SystemRW & the creation of more amazing projects like this then please feel free to donate to the developer by clicking the button below. Thanks! Your support is very much appreciated!
    Donate
    12
    If the script works on your device please send me your log files from this folder:
    /data/local/tmp/systemrw_1.32/log/

    And please write your phone model /// Android version /// firmware version

    Then I can add you to the list of successful devices and it will be helpful for further development. Thank you!
    6
    New version 1.20 is ready! DOWNLOAD HERE
    Good news for those that don't have TWRP or couldn't get it to work in their TWRP. Now the script can also be run directly inside Android. Keep in mind that you will have to flash the patched images manually in this case using fastboot flash.

    The zip can still be flashed in TWRP (make sure zip signature verification isn't checked). This time I bundled my device's stock sh binary (which I used to develop the script) with the archive. Hopefully this will prevent avoidable sh-related syntax errors for some folks. The flashable zip installer update-binary automatically launches the script with the proper arguments using this bundled sh program (it's inside the tools subfolder).

    To those that were having difficulties running the previous version due to empty partitions or multiple partition groups inside their super : this has finally been fixed :D

    Please give this new version a try and let me know if it works for you or not and I will add it to the first post. Thanks for your feedback!
    5
    I try to redo the procedure, i want to change the size. but i get error, can't remove lock.

    Good news. New hotfix available HERE
    I got rid of that buggy get minimum size function and reworked the size querying algorithm a little bit. Should be more stable now.

    Next step will be to make the script compatible with those devices that have empty partitions embedded inside their super partition...
    Also ronnie was complaining about syntax error but I have yet to find the syntax error... If anyone finds it please let me know so I can fix it. Thank you!