[TOOL][WIN,LIN,AND,DARW] Super image tools | extract or make partitions RW in super partition

Search This thread

munjeni

Senior Member
Jun 2, 2011
9,594
22,248
thankyou for in detail guide but
OnePlus8T:/ $ su exec /system/bin/mount -t overlay overlay -o lowerdir=/system
mount: bad /etc/fstab: No such file or directory
OnePlus8T:/ $ mount -t overlay overlay -o lowerdir=/system
mount: bad /etc/fstab: No such file or directory
su mount -t overlay overlay -o lowerdir=/system
su: exec failed for -t Error:permission denied

drwxrwxr-x 16 system system 4096 2022-06-24 06:46 system

i guess i need to do it with.vdi file
You must be root as a first thing to do :)
 

munjeni

Senior Member
Jun 2, 2011
9,594
22,248
kernel of my phone prevents mounting /system, so magisk can't mount modules

but this actually works

rc script:
on load_persist_props_action
exec -- /system/bin/mount -t overlay overlay -o lowerdir=/system,upperdir=/data/system/ou,workdir=/data/system/ow /system

on zygote-start
exec -- /system/bin/mount /sbin/.magisk/zygisk/app_process32 /system/bin/app_process32
exec -- /system/bin/mount /sbin/.magisk/zygisk/app_process64 /system/bin/app_process64

#####

manualy "mounting" all modules

su -c cp -r /sbin/.magisk/modules/*/system/* /system

doing all stuff in couple of commands...that's illegal, right? =)
Yes android fs mannager probably not allow all this. Take a look at https://android.googlesource.com/platform/system/core/+/master/init/

 
Last edited:
  • Like
Reactions: Pervokur

Pervokur

Senior Member
Feb 15, 2022
200
54
  • Like
Reactions: munjeni

munjeni

Senior Member
Jun 2, 2011
9,594
22,248
I mean that's actually works for me. No problems when upper layer in /data.
I also tried different partitions and with some others it's works only with SE linux disabled.
Actualy I'm out off interest since my phone do not have super partition, its old xperia 10, but good to know that, thanks!
 

iamatx

Member
Jul 16, 2021
11
1
@Pervokur can u guide me am not able to get it done it's with Bluestack that they add stuff to block the editing system.
able to do it directly by accessing through windows and editing it with notepad ++ the data.vdi file
 

iamatx

Member
Jul 16, 2021
11
1
thankyou but bluestack 5 has a broken mount magisk doesn't work on it even modded bcoz their dev did this
1657658598263.png
 

Pervokur

Senior Member
Feb 15, 2022
200
54
Actualy I'm out off interest since my phone do not have super partition, its old xperia 10, but good to know that, thanks!
I did another ultimate "systemless" crap

mount -t ext4 system.img /somefolder
mount /somefolder/system /system

It's should be done before zygote starts. Or after booting and just force restart zygote

su -c killall surfaceflinger
 

munjeni

Senior Member
Jun 2, 2011
9,594
22,248
Yes it can be done for example editing ramdisk and doing some bindmounts, or using overlayfs and many other ways. But we don't stick to the topic, neither you nor me. Topic is super image tools! What need to be done is recalculation about how many free space is remain in an super partition, that way maybe we can make some more work to resize internal super partitions to the minimal size so that partition which is editing have enought free space to unshare blocks, the thing can be probably done the same way as lptools doing that on the fly https://raw.githubusercontent.com/phhusson/device_phh_treble/android-11.0/cmds/lptools.cc . As you can see lptools doing that natively! The whole idea is to make fast tool for super partition edits on the fly, wihout ramdisk modifications, hackings...etc, so natively inside android. Getting an fast tool I see is not possible because of lack of free space for unshare blocks inside super partition. And I will probably get out of this topic and start new topic and leave our tool only for those who need to extract partitions from super image, at least I see its suitable only for that and nothing more.
 
Last edited:

Pervokur

Senior Member
Feb 15, 2022
200
54
Yes it can be done for example editing ramdisk and doing some bindmounts, or using overlayfs and many other ways. But we don't stick to the topic, neither you nor me. Topic is super image tools! What need to be done is recalculation about how many free space is remain in an super partition, that way maybe we can make some more work to resize internal super partitions to the minimal size so that partition which is editing have enought free space to unshare blocks, the thing can be probably done the same way as lptools doing that on the fly https://raw.githubusercontent.com/phhusson/device_phh_treble/android-11.0/cmds/lptools.cc . As you can see lptools doing that natively! The whole idea is to make fast tool for super partition edits on the fly, wihout ramdisk modifications, hackings...etc, so natively inside android. Getting an fast tool I see is not possible because of lack of free space for unshare blocks inside super partition. And I will probably get out of this topic and start new topic and leave our tool only for those who need to extract partitions from super image, at least I see its suitable only for that and nothing more.
then compress something and add decompression and mounting to init.rc, it's pretty easy to do

Otherwise I don't understand how do you want "decompress"(unshare blocks)system.img without increasing size.

I will write and test script today, it's sounds pretty easy
 

munjeni

Senior Member
Jun 2, 2011
9,594
22,248
Some super partitions have reserved space on every each partition but also some do not have that reserved space, I have implemented resizing in superrepack but it not work on every device, only on those devices which have some reserved free space on each partition.
 

Pervokur

Senior Member
Feb 15, 2022
200
54
Some super partitions have reserved space on every each partition but also some do not have that reserved space, I have implemented resizing in superrepack but it not work on every device, only on those devices which have some reserved free space on each partition.
also will not work if OTA firmware have something like this

# Remove all existing dynamic partitions and groups before applying full OTA
remove vendor
remove system
# Add partition system to group qti_dynamic_partitions
add system qti_dynamic_partitions
# Add partition vendor to group qti_dynamic_partitions
add vendor qti_dynamic_partitions
# Grow partition system from 0 to 5761216512
resize system 5761216512
# Grow partition vendor from 0 to 1097568256
resize vendor 1097568256

Not the right order. Because of this there will be 2 segments of each partition .
 
Last edited:

Mitezuss

Senior Member
Dec 8, 2017
60
12
is it working on any stock firmware ? (like motorola ?) with Android 12 ?

And, this patch is permanent ? Or if i re-flash the original firmware the partition will be again RO ?

is it secure ? (if fail can be re-flash and will work all ?) the partitions can be delete or some like that (problems)?

Thanks
 
  • Like
Reactions: Talon

munjeni

Senior Member
Jun 2, 2011
9,594
22,248
is it working on any stock firmware ? (like motorola ?) with Android 12 ?

And, this patch is permanent ? Or if i re-flash the original firmware the partition will be again RO ?

is it secure ? (if fail can be re-flash and will work all ?) the partitions can be delete or some like that (problems)?

Thanks
1. I don't know, probably yes
2. Its not permanent
3. if you reflash original fw it will be stock again and RO
4. I don't know if it is secure.
5. If you reflash stock rom it will be fully stock rom
6. You can delete but not using our tool, for deletion you need another tool and don't ask which one, I don't know. I'm not android active for almost 5 years, even I have no idea whats new in android world
 

Talon

Senior Member
Hi

Tried on realme NEO2 A12

- it seems that the process is going "normally" ... there are no errors ... - but in the end there is also no RW ... /

- ...after reboot - all modules and danylist in magisk were turned off - everything else was unchanged....

hope the attached log will tell something useful with help

(this is the log of the first run .... - I ran it 4-5 more times - but nothing interesting happened ... and in subsequent logs there may be 5-7 uninteresting lines ... - definitely not errors !!))
 

Attachments

  • script.log.zip
    3 KB · Views: 4

Top Liked Posts

  • There are no posts matching your filters.
  • 46
    Disclaimer:

    Super image tools was made for testing and educational purposes, ME is not responsible for what you do on/with your device using our tools, you must agree that you using our tools on your own risk, I am not responsible for anything else!


    How to use superunpack:

    - First step, unpack super.sin using my tool or use @IgorEisberg unsin tool
    - Step two, Superunpack. On windows just drag and drop unpacked super image onto our exe to start extraction. Also you can use it from command line, from script or from etc. On Linux use it from command line. No need to set slot like it was a case on lpunpack, our tool will auto extract all slot images for you, enjoy!
    - If you need to unpack partition images in RW mode add parameter 1 at the end of command line e.g. "superunpack super.img 1", than resize partition using resize2fs, repair and unshare blocks using e2fsck. Or if you unpack without rw you no need to resize or repair it, just mount it ro.

    How to manualy patch super partition in under Linux:
    https://forum.xda-developers.com/t/...s-rw-in-super-partition.4120963/post-87112415

    Note that, superunpack is a tool for extract all logical partitions from super image or directly from super partition.

    How to use superrepack:

    adb push superrepack.arm64_pie /data/local/tmp
    adb shell
    su
    cd /data/local/tmp
    mv superrepack.arm64_pie superrepack
    chmod 755 superrepack
    stop
    ./superrepack /dev/block/bootdevice/by-name/super system_a
    sync
    reboot

    Note that, superrepack is a tool to convert logical RO partitions iside your phone super partition to RW mode without extracting anything, all things is done on the fly directly inside super partition/image! In this example system_a partiton is converted to the rw mode, if you need other partitions to rw just change system_a argument. Or if you need all partitions to rw mode do it without partition rw argumet e.g: "./superrepack /dev/block/bootdevice/by-name/super". YOU MUST RUN TOOL 4-5 TIMES UNTIL ALL ERRORS DISAPEARS!!! One of the well known errors is: "Couldn't clone file: Could not allocate block in ext2 filesystem". Look at /data/local/tmp/script.log each time and make sure it not contain any error otherwise you are not done things right and partition is not repaired yet!!! More info -> https://forum.xda-developers.com/t/...s-rw-in-super-partition.4120963/post-84966715

    Platform:

    - Superunpack is working on Windows, Linux, Android, Darwin11, just chose right binary.
    - Superrepack is working only under android


    Changelog:

    - version 1 (21.Jun.2020), initial version
    - version 1.1 (22.Jun.2020), dump file format detection, partition size correction in case ext4, partition group detection, have extraction progress bar, improvements
    - version 2 (03.04.2021) implemented possibility to extract partition images to rw mode using Superunpack & I have made new tool called Superrepack
    - version 2 (04.04.2021) implemented arguments so you would do conversion on single partition instead of doing it on all partitions
    - version 3 (04.04.2021) implemented return codes and implemented output logs to be more scripting friendly
    - version 4 - not released
    - version 5 (08.04.2021) implemented resize and repair partitions after switching to rw mode. Implemented build script for building resize2fs, e2fsck, simg2ims, img2simg, lptools
    - version 6 (08.04.2021) better loop device detection and setup
    - version 7 (08.04.2021) fix selinux status detection
    - version 8 (15.04.2021) fix loop device setup in superrepack
    - version 9 (16.04.2021) make losetup android compatible
    - version 10 - not released
    - version 11 (01.05.2021) simplified, removed needs for parameter rw, implemented dm-verity disabler
    - version 12 (05.05.2021) make old logs always deleted before fresh log is created, this prevent concentation with old logs
    - version 13 (06.05.2021) make linux version so you should do the things on your super partition dump in linux machine
    - version 14 (07.05.2021) fix compilation mess between linux and android
    - version 15 (08.05.2021) use libselinux to determine and set selinux to permissive mode instead of popening getenforce-setenforce tools

    Credits:

    - me and me :)


    Source code:

    - source code -> https://github.com/munjeni/super_image_dumper
    19
    I'm not one of those who make paid software and promote on xda, my work is always free. Even I'm always providing source code for free, source code of this tool is here -> https://github.com/munjeni/super_image_dumper , enjoy! ;)
    3
    Version 7 is out! V6 had error detecting slinux status. I do not have device with super partition for test my tool but I have only hope that all is ok. Let me know! :)
    3
    Pixel 4a, working. V13
    3
    how about simg2img