yashsingh1/xdaforums huggingface dataset:
[General Topics] saga1900:
I'm trying to modify my system.img (/system/build.prop) to include support for multi users. After struggling a lot, I've succeeded following your guide (that's an awesome work btw) to unpack, mount, modify, umount and repack super.img. Then, after flashing the new super.img, nothing changes on the phone. I've tried adding and removing files to the system.img before reflashing, and after flashing, i've verified using adb shell. It seem that the image flashed do not contains my modifications. In other words, I succeed to repack a modified super.img, but flashing the new super.img do not modify the phone itself. Any clues? Can you help me?

Phone is Umidigi A7 Pro 64GB
[General Topics] Brepro1:
Hey dear thank you for the compliment, please tell me more about how did you flash the new image.

hey dear did you flash it by using sp flash tool? did you unlocked the bootloader? did you see orange state warning when the device booted after flashing?
[General Topics] saga1900:
Hi, thx for your reply!

I've unlocked the bootloader as you oriented, and after that, I'm seeing the orange warning!I tried flashing using two methods. Using SP Flash Tool, and using flashboot.

Using SP Flash Tool was straight forward. Just selected the Scatter File, then picked the new super.img. Successfully flashed, but no changes on the phone.

Using flashboot: ./flashboot flash super super.modified.img

What a did, in short, was:

1.) simg2img super.img super.raw

2.) imjtool super.raw extract (also tried using lpunpack as you oriented)

3.) mount -t ext4 -o loop system.img /mount/point

4.) edit everything needed

5.) umount /mount/point

6.) repacked super.img using lpmake

7.) flashed the new super.img using SPFT or flashboot. Boths succeeds, but none really modifies the phone

To double check that the new super.img is correct, I've extracted it again, and double checked my changes. and they are there.
[General Topics] Brepro1:
Vary strange, I don't have an idea, sorry
[General Topics] saga1900:
NP, thanks anyway. I'm reading about a few things like disabling vbmeta verity and other things. Also, I did not mentioned, but I've downloaded and modified a stock rom, and my phone is not rooted. If i found anything that worths mention here, I'll update this thread
[General Topics] NguyenNhutNam:
i cant mounr system.img . Cant you help me

#sudo mount -t ext4 -o loop system.img system

mount: /home/nam/system: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error
[General Topics] AtraxRobustus:
what does the command

file path://system.img

show up?
[General Topics] dewettie:
Anyone can help how to repack an unpacked super.img?

Try to delete an app in the product and system.img and post the instructions to repack everything into a super.img again.

My goal is to remove most of the preinstalled Google apps.

Here is the firmware link

UMIDIGI_A9_PRO_128GB_V1-0_20210127

MediaFire is a simple to use free service that lets you put all your photos, documents, music, and video in a single place so you can access them anywhere and share them everywhere.

www.mediafire.com

How do you get this size, from the scatter file super partition size?

3)--device super: The size of the “super” partition on the device. It must match exactly, and it must be evenly divisible by the sector size (512 bytes).

After repacking I also get this error, is it normal?

'Invalid sparse file format at header magic'
[General Topics] EfrenKilller:
when I put the command line

./lpmake --metadata-size 65536 --super-name super --metadata-slots 2 --device super: 6836715520 --group main: 6642450432 --partition system: readonly: 5244977152: main --image system =. / system.img --partition odm: readonly: 4349952: main --image odm =. / odm.img --partition product: readonly: 752545792: main --image product =. / product.img --partition vendor: readonly: 640577536: main --image vendor =. / Vendor.img --sparse --output ./super_new.img

it says this: Invalid sparse file format at header magic

why ????
[General Topics] giubenez:
I edited the vendor.img but something strange happens:

$stat -c '%n %s' *

super.img 3758096384

product.img 1596944384

system.img 1128718336

vendor.img 544976896

$../otatools/bin/lpmake --metadata-size 65536 --super-name super --metadata-slots 1 --device super:3758096384 --group main:3270639616 --partition system:readonly:1128718336:main --image system=./system.img --partition vendor:readonly:544976896:main --image vendor=./vendor.img --partition product:readonly:1596944384:main --image product=./product.img --sparse --output ./super.new.img

lpmake I 02-17 12:18:27 2646704 2646704 builder.cpp:1012] [liblp]Partition system will resize from 0 bytes to 1128718336 bytes

lpmake I 02-17 12:18:27 2646704 2646704 builder.cpp:1012] [liblp]Partition vendor will resize from 0 bytes to 544976896 bytes

lpmake I 02-17 12:18:27 2646704 2646704 builder.cpp:1012] [liblp]Partition product will resize from 0 bytes to 1596944384 bytes

Invalid sparse file format at header magic

Invalid sparse file format at header magic

Invalid sparse file format at header magic

BUT....

$stat -c '%n %s' super.new.img

super.new.img 3248851200

which is not divisible by 512!

Shouldn't it be 3758096384 ?
[General Topics] Mobilelearner:
This is for android 10 custom os. Or it will work on all android 10 mobile. Can we modify FRP partition using this.
[General Topics] DeirdreRoberts:
Me too, sorry
[General Topics] lebigmac:
@Brepro1 thank you so much for writing this detailed guide.

Thanks to your detailed guide I was able to create an automated bash script that performs all of these steps automatically and makes all read only partitions inside super.img (system, vendor , product, etc...) into read write-able partitions again and flash to device as a brand new super.img.

It would be an honor for me if you could please try it and let me know if it works on your device. Thanks.

Here is the link:

https://xdaforums.com/t/script-mount-system-as-read-write-android-10.4240703/
[General Topics] vp1117:
I have same issue as already was mentioned by NguyenNhutNam on Jan-20, i.e.:

In response to

sudo mount -t ext4 -o loop system.img edit

I'm getting this:

wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.

And Linux tells me this:

file system.img

system.img: Linux rev 1.0 ext2 filesystem data, UUID=4729639d-b5f2-5cc1-a120-9ac5f788683c (extents) (large files) (huge files)

Of course, I tried:

sudo mount -t ext2 -o loop system.img edit

only to get this:

wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.

Any ideas?
[General Topics] vp1117:
Figured out the reason.

Topicstarter confuses people with incorrect instructions.
[General Topics] lebigmac:
The code below works great in Ubuntu

sudo su
mkdir /mnt/dir
mount -t ext4 -o loop,rw ./system.img /mnt/dir

But as soon as I try it directly inside Android I get this error:

mount: '/dev/block/loop10'->'/mnt/dir': Block device required

I guess this must be some kind of Android limitation...
[General Topics] alecxs:
use busybox mount applet instead of toybox
[General Topics] alecxs:
why don't use magisk native systemless method? just overlay magisk module with desired mods

https://topjohnwu.github.io/Magisk/guides.html#easy-replace
[General Topics] pvdeejay:
For those who can't mount system image see this twitter conversation by

https://twitter.com/i/web/status/1170404631865778177
[General Topics] alecxs:
overlay empty file as descriped in module tricks
[General Topics] weskerty:
No entendí. Logré descomprimir y editar el sistema by otras particiones .raw

El problema es volver a comprimirlos en system.img para flashear súper. ¿cómo se hace?
[General Topics] harvey186:
you know, that there is great tool on github which is doing the job on the fly ?? https://github.com/ChromiumOS-Guy/SuperPatcherGSI

EDIT: Oh, just seen, that ChromiumOSGuy is envolved
[General Topics] alecxs:
Kindly provide your own solution for free, and spend your life time supporting n00bs having trouble understanding the basics
[General Topics] alecxs:
you are using this google product so you agreed with their policy. no one is forcing you to use magisk (which is open source btw) feel free to reinvent the wheel
[General Topics] joshjosh14:
use this command!

(file system.img )

if the output is android sparse image you need to convert it first with this command

(simg2img system.img system1.img)

if done you will have system1.img file you can delete system.img and rename the system1.img

now you can check the system1.img by using file system1.img

if the output are ext2 or ext4 then you can mount it to your system folder

sorry for bad english im from ph
[General Topics] joshjosh14:
you need to convert all files to android sparse image before lpmake
[General Topics] Keven11:
I apologize for my noobness. I have a moto g9 plus on A10 with magisk root and twrp. I imagine that the process would be fairly similar to what you went through. When I first started reading about this solution I was making some headway. However, I seem to have hit a wall. I have to admit that after reading through the threads I am now completely confused/lost. If there is anything that you would be willing to do to help me make my system rw would be greatly appreciated to say the very least.
[General Topics] joshjosh14:
if your on linux distros you can simply install img2simg by sudo apt install img2simg and simg2img
[General Topics] mohacraft8:
hello sir how are you

i do it all steps good but when i want do this step 7) generating new super.img

i calcul the size the all of partitions 1 by 1 i have this error

./lpmake --metadata-size 65536 --super-name super --metadata-slots 1 --device super:4282497588 --group main:3254302310 --partition system:readonly:2468765696:main --image system=./system.img --partition vendor:readonly:674848768:main --image vendor=./vendor.img --partition product:readonly:110687846:main --image product=./product.img --sparse --output ./super.new.img

error

----

lpmake E 04-19 03:09:22 29210 29210 builder.cpp:319] [liblp]Block device super size must be a multiple of its block size.

Invalid metadata parameters.

----

and this my partitions size

2468765696 system

674848768 vendor

1106878464 product

4282497588 super

any help please

thanks
[General Topics] lebigmac:
What output do you get if you run lpdump

It should be

metadata-slots 2
[General Topics] mohacraft8:
im not try with lpdump ony with lpmake
[General Topics] mohacraft8:
Lpdump not found when i use ./lpdump --meta...
[General Topics] lebigmac:
Run lpdump from Android operating system

Without ./ symbols and without any parameters.

You can try --slot=1 parameter if you're booted into slot _b
[General Topics] mohacraft8:
What output do you get if you run lpdump > dont understand
[General Topics] ashishlive4:
My stock rom having super.img splited files into 3 super0.img ,super1.img ,super2.img can you have any idea to set these files to single image

3 images are separately mount into ext4 successfully help me to resolve this problem

Image file is belongs to realme narzo
[General Topics] vp1117:
Exactly. Topicstarter was not aware of SHARED_BLOCKS.
[General Topics] Zacharee1:
I made a Python script to make repacking a super.img a little easier. To use it, you'll need Python 3 and `argparse` installed (`pip3 install argparse`). You'll also need `lpmake` available somewhere (you can download a prebuilt version here: https://xdaforums.com/t/guide-ota-tools-lpunpack.4041843/).

Basic usage can be seen by running `python3 lpmakesimple.py -h`.

An example would be: `python3 lpmakesimple.py ./lpmake ./super.new.img 4294967296 system=./system.img,vendor=./vendor.img,product=./product.img`

EDIT 8/12/2021: Added a fixed version.
[General Topics] lebigmac:
Hi @Zacharee1 thanks for sharing your nice Python script!

Keep in mind not all groups on all devices are called main

see line 50

command = f'{lpmake_path} --metadata-size {metadata_size} --metadata-slots {slot_count} --device super:{orig_size} --group main:{partitions_size} {partitions_string} --sparse --output {output_path}'

you can query the group names using lpdump binary.

Keep up the great work!
[General Topics] SwedishForenger:
Hello.

Thank you so much for creating this. I have a little problem.

What's going wrong here?

I'm getting this error message:

lpmake E 05-30 18:26:48 5194 5194 builder.cpp:319] [liblp]Block device super size must be a multiple of its block size.

Invalid metadata parameters.

This is what I use:

./lpmake --metadata-size 65536 --super-name super --metadata-slots 2 --device super:33155964948 --group main:4933723156 --partition system:readonly:1447964672:main --image system=./system.img --partition vendor:readonly:329793536:main --image vendor=./vendor.img --partition product:readonly:1194176512:main --image product=./product.img --sparse --output ./super.new.img
[General Topics] firky:
Oh, I have same problem. Do you have any update?

Simply I added dummy file in /system directory of system.img, but I couldn't find it after flashing.

I'm trying on Teclast P10HD+ model
[General Topics] adithya2306:
fallocate -l 1G vendor.img

resize2fs vendor.img 1G

e2fsck -E unshare_blocks vendor.img

mkdir vendor

sudo mount -o rw,loop -t ext4 vendor.img vendor

*make any changes*

sudo umount vendor

This worked for me, I used it to disable fileencryption in fstab of a stock ROM.
[General Topics] beta.0:
Has anyone been able to repack Amlogic super.img with lpmake?

I extracted odm, product, system & vendor from an OTA zip, converted them to sparse and replaced the originals from an older aml_upgrade_package.img (extracted using xVortex kitchen v5).

lpmake built the image without any error but when I flash it to the device it goes into a boot loop, only getting to the boot logo before restarting.

Maybe xVortex is not rebuilding the full upgrade package correctly? It's an S905X4 based device.
[General Topics] beta.0:
I'm getting an error when running this script:

python3 lpmakesimple.py ./lpmake ./super.new.img 1677721600 system=./system.img,vendor=./vendor.img,odm=./odm.img,product=./product.img
Traceback (most recent call last):
File "lpmakesimple.py", line 37, in <module>
lpmake_path = args.lpmake
AttributeError: 'Namespace' object has no attribute 'lpmake'

The lpmake binary is in the current working directory, so I'm a bit confused by this error. Any idea what's causing it?
[General Topics] Zacharee1:
Did you install argparse?
[General Topics] beta.0:
Yes I did via 'pip3 install argparse'
[General Topics] Zacharee1:
Are you on Windows? What happens if you execute lpmake directly?
[General Topics] beta.0:
I'm running Ubuntu 18.04 under WSL2 (Winows subsystem for linux) on Windows 10.

$ pip3 -V
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)

$ pip3 show argparse
Name: argparse
Version: 1.4.0
Summary: Python command-line parsing library
Home-page: xxxx
Author: Thomas Waldmann
Author-email: xxx
License: Python Software Foundation License
Location: /home/xxxx/.local/lib/python3.6/site-packages
Requires:
[General Topics] beta.0:
./lpmake will return the proper help context when run alone
[General Topics] beta.0:
Perhaps that's the problem, running under WSL2. Have you tried it?

If you have any suggested edits to the scripts I can test them out.

I was looking at this for help but I know almost nothing about coding python: https://stackoverflow.com/questions/28422883/attributeerror-namespace-object-has-no-attribute
[General Topics] Zacharee1:
You could try enclosing the paths in double quotes, but I'm not really sure what's happening.
[General Topics] beta.0:
I tried like this:

parser.add_argument("<lpmake-path>", type=str, help="path to lpmake binary")

and quoting them within the brackets like this:

parser.add_argument('<"lpmake-path">', type=str, help="path to lpmake binary")

Neither of those change the error.

On the line where you build the command it's trying to resolve lpmake_path:

command = f'{lpmake_path} ...

lpmake_path is defined as args.lpmake but where does the lpmake part of the argument come into play? Is that just an identifier and it has more to do with the order of arguments as they're parsed?

The error seems to suggest that the arg.lpmake attribute needs to be defined. Is the 'Namespace' object referring to the lpmake_path variable or the parser.add_argument for <lpmake-path>?

AttributeError: 'Namespace' object has no attribute 'lpmake'
[General Topics] Zacharee1:
I mean quote them in the command.
[General Topics] beta.0:
I just did a test by defining those path arguments manually like this:

args = parser.parse_args()
lpmake_path = "./lpmake"
output_path = "./super.new.img"
orig_size = args.supersize
....

Still getting the same error for the integer:

Traceback (most recent call last):
File "lpmakesimple.py", line 37, in <module>
orig_size = args.supersize
AttributeError: 'Namespace' object has no attribute 'supersize'

So it looks like the paths have nothing to do with it and it's probably an issue with argparser looking for some kind of definition of those attributes.

What version of argparser are you running?
[General Topics] beta.0:
Quoting them in the command seems to make the path arguments work but still get the same error above for the supersize attrib.
[General Topics] Zacharee1:
I'm not sure what happened, since I'm pretty sure I tested the script before I uploaded it, but after looking at it, that version shouldn't work.

Use this one instead.
[General Topics] beta.0:
Yes that one works great, the attrib labels were wrong in the other one. Thanks for the working script Zach!

Just a minor cosmetic bug, partition sizes are printed twice. The reason why is not at all obvious in the script.

Size for partition file ./system.img is 609792000
Size for partition file ./vendor.img is 261836800
Size for partition file ./odm.img is 2633728
Size for partition file ./product.img is 496869376
Size for partition file ./system.img is 609792000
Size for partition file ./vendor.img is 261836800
Size for partition file ./odm.img is 2633728
Size for partition file ./product.img is 496869376
./lpmake --metadata-size 65536 --metadata-slots 1 --device super:1677721600 --group main:1371131904 --partition system:readonly:609792000:main --image system=./system.img --partition vendor:readonly:261836800:main --image vendor=./vendor.img --partition odm:readonly:2633728:main --image odm=./odm.img --partition product:readonly:496869376:main --image product=./product.img --sparse --output ./super.new.img
lpmake I 08-12 22:52:49 22525 22525 builder.cpp:1012] [liblp]Partition system will resize from 0 bytes to 609792000 bytes
lpmake I 08-12 22:52:49 22525 22525 builder.cpp:1012] [liblp]Partition vendor will resize from 0 bytes to 261836800 bytes
lpmake I 08-12 22:52:49 22525 22525 builder.cpp:1012] [liblp]Partition odm will resize from 0 bytes to 2633728 bytes
lpmake I 08-12 22:52:49 22525 22525 builder.cpp:1012] [liblp]Partition product will resize from 0 bytes to 496869376 bytes
Invalid sparse file format at header magic
Invalid sparse file format at header magic
Invalid sparse file format at header magic
Invalid sparse file format at header magic
[General Topics] FR8148:
This version of lpunpack doesn't work on Android 11 super images. Allways this error:

lpunpack E 08-25 17:54:01 2064 2064 reader.cpp:171] [liblp]Logical partition metadata has invalid checksum.

lpunpack E 08-25 17:54:02 2064 2064 reader.cpp:171] [liblp]Logical partition metadata has invalid checksum.

Image does not appear to be in super-partition format.!

I have found one version for Android 11 here:

GitHub - LonelyFool/lpunpack_and_lpmake: android super.img tools

android super.img tools. Contribute to LonelyFool/lpunpack_and_lpmake development by creating an account on GitHub.

github.com

but I dont't get to build it, allways several errors.

Could you try to build lpunpack (and lpmake, they are together) and post it here?

Thanks in advance.
[General Topics] kilosatt:
I put all images, system, vendor, product, and odm in /otatools/bin/ folder and when I run ./lpmake

./lpmake --metadata-size 65536 --super-name super --metadata-slots 1 --device super:6023020544 --group main:4732334080 --partition system:readonly:3227881472:main --image system=./system.img --partition vendor:readonly:567611392:main --image vendor=./vendor.img --partition odm:readonly:4349952:main --image odm=./odm.img --partition product:readonly:932491264:main --image product./product.img --sparse --output ./super.img

it does nothing. Just terminal output is: Expected PARTITION=FILE

What I am doing wrong?

I'm using Ubuntu linux machine. File sizes are correct.
[General Topics] achakian0000:
Google's software downloads these files to me

View attachment 5421193

How do I compile them?
[General Topics] AndyJN:
Hi

I have followed your instructions in order to edit the init.rc file to alter the boot on charge power behaviour for a Samsung A3. When I try and use Odin to reflash the phone - I end up with an error screen showing vbmeta HASH_MISMATCH
[General Topics] lebigmac:
Hi. Did you try disable dm-verity and verification? There is avbctl binary in my SystemRW project that can do this. Maybe it helps with booting.

I know Samsung deleted fastboot from all their devices which is a shame otherwise you could also use that for disabling dm-verity by flashing empty vbmeta with special parameters:

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

Good luck!
[General Topics] jacobel640:
i'm really new in linux and i need an explanation on how to install the "lpmake" tool on ubuntu

please help me🙏

my results

root@user:~# ./lpmake
-bash: ./lpmake: No such file or directory
[General Topics] jacobel640:
Let me know when you got an answer
[General Topics] sarbazg180:
Hi

I have some questions

i want to make my system rw that can be edited in the device so i make system.img 3GB

1- How exactly i found super.img size?? Is it none edited super.img size?

2- is it ok if i repack without make system.img to minimal possible size(because i heard that system.img is ro due to google minimize img size)?

3- is it right method to make /system rw?

Sorry for may bad English 😉
[General Topics] lolvatveo:
help. problem is junk apps will recover when system run without root (restart phone to lost root) even its folder in priv-app has been deleted. how do i solve it? anyone know how to completely delete it? I can't identify these bloatware, it only appear when unroot, disappear when root. No way to uninstall it normally, I need help to find the folder of these bloatware and delete it. i think it can only remove folder in system/app or priv-app to remove bloatware. this is the case especially when i unroot it shows up again. And the additional download file managers can't show them to know directory where it's installed from, this special bloatware simply doesn't work using system/app. So anyone with a solution please help<- my bad englísh
[General Topics] SwedishForenger:
.

Are you on Stock android rom or Custom rom?

.
[General Topics] lolvatveo:
Im in custom ROM (rooted). My partition system is dynamic, using system as root and rooting it's not easy
[General Topics] SwedishForenger:
Im in custom ROM (rooted). My partition system is dynamic, using system as root and rooting it's not easy

.

If apps are restored, you can't have system root. seems to me you onely have partial root. If so. you dont actually delete the apps. You only disables them for user 0.

Try this:

.
[General Topics] lolvatveo:
I guessed wrong, when booting without root bloatware will reinstall itself to the system folder. Help me find the cause and how to fix it. Above command not executing, when re-enable root by booting into recovery i got into data/user/0 but no bloatware folder, bloatware folder in system app also disappeared.