adb-insecure-patcher icon indicating copy to clipboard operation
adb-insecure-patcher copied to clipboard

sysmalloc: Assertion error while using the script

Open maddo7 opened this issue 1 year ago • 6 comments

While using the script, I am getting this error:

Android Image Kitchen - UnpackImg Script
by osm0sis @ xda-developers
 
Supplied image: boot.img
 
Removing old work folders and files...
 
Setting up work folders...
 
Image type: AOSP
 
Footer with "SEAndroid" type detected.
 
Splitting image to "split_img/"...
BOARD_KERNEL_CMDLINE 
BOARD_KERNEL_BASE 00211632
BOARD_NAME 
BOARD_PAGE_SIZE 0
BOARD_HASH_TYPE unknown
BOARD_KERNEL_OFFSET 00008000
BOARD_RAMDISK_OFFSET ffdeeffe
BOARD_SECOND_OFFSET ffdee9ce
BOARD_TAGS_OFFSET ffdee9ce
BOARD_DT_SIZE 4
unpackbootimg: malloc.c:2617: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.
Aborted (core dumped)
Error!

Is there a way to fix it?

maddo7 avatar Mar 03 '23 04:03 maddo7

Sadly, this project is quite old and there is a chance this is crashing with latest images.

As you can see here the unpackbootimg is 6 years old now.
If you find an updated binary, it may fix your problem. If you fix, I would love a PR.

pcboy avatar Mar 03 '23 12:03 pcboy

It looks like the mkbootimg project was forked and updated.
https://github.com/osm0sis/mkbootimg

You may try to recompile it and replace that unpackbootimg.

pcboy avatar Mar 03 '23 12:03 pcboy

Thank you for the quick reply. I updated the binaries for x86_64 but now the result is this

Android Image Kitchen - UnpackImg Script
by osm0sis @ xda-developers
 
Supplied image: boot.img
 
Removing old work folders and files...
 
Setting up work folders...
 
Image type: AOSP
 
Footer with "SEAndroid" type detected.
 
Splitting image to "split_img/"...
ANDROID! magic found at: 0
BOARD_KERNEL_CMDLINE 
BOARD_PAGE_SIZE 4096
BOARD_OS_VERSION 12.0.0
BOARD_OS_PATCH_LEVEL 2023-01
BOARD_HEADER_VERSION 4
BOARD_HEADER_SIZE 1584
../bin/magic, 1195: Warning: Unparsable number `'
ls: cannot access '*-ramdisk*.gz': No such file or directory
 
Unpacking ramdisk to "ramdisk/"...
 
Compression used: cannot
Unsupported format.
Error!

maddo7 avatar Mar 03 '23 13:03 maddo7

https://github.com/draekko/AIK-Linux

Try to use the bin, unpackimg.sh and repacking.sh scripts from this repository instead.

Technically, the only part that really matters in my repo is: https://github.com/pcboy/adb-insecure-patcher/blob/master/adb_insecure.sh

It's just patching the ramdisk default.prop and then repack the boot.img.

pcboy avatar Mar 03 '23 14:03 pcboy

I think using this did the trick but now it seems your script fails because a file it not there.

Android Image Kitchen - UnpackImg Script
by osm0sis @ xda-developers
 
Supplied image: boot.img
 
Removing old work folders and files (as root)...
 
[sudo] password for netogami: 
Setting up work folders...
 
Image type: AOSP
 
Signature with "AVBv2" type detected.
 
Splitting image to "split_img/"...
ANDROID! magic found at: 0
BOARD_KERNEL_CMDLINE 
BOARD_PAGE_SIZE 4096
BOARD_OS_VERSION 12.0.0
BOARD_OS_PATCH_LEVEL 2023-01
BOARD_HEADER_VERSION 4
BOARD_HEADER_SIZE 1584
 
Unpacking ramdisk (as root) to "ramdisk/"...
 
Warning: Using cpio 2.13 may result in an unusable repack; downgrade to 2.12 to be safe!
 
Compression used: lz4-l
7616 blocks
 
Done!
sed: can't read ramdisk/default.prop: No such file or directory

I'm using a Samsung device. I checked the files of the ramdisk a bit and found this file: /ramdisk/etc/ramdisk/build.prop

The content is the following:

####################################
# from generate-common-build-props
# These properties identify this partition image.
####################################
ro.product.bootimage.brand=samsung
ro.product.bootimage.device=a53x
ro.product.bootimage.manufacturer=samsung
ro.product.bootimage.model=SC-53C
ro.product.bootimage.name=a53xdcm
ro.bootimage.build.date=Wed Jan 11 09:09:05 KST 2023
ro.bootimage.build.date.utc=1673395745
ro.bootimage.build.fingerprint=samsung/SC-53C/SC-53C:12/SP1A.210812.016/SC53COMU1BWA1:user/release-keys
ro.bootimage.build.id=SP1A.210812.016
ro.bootimage.build.tags=release-keys
ro.bootimage.build.type=user
ro.bootimage.build.version.incremental=SC53COMU1BWA1
ro.bootimage.build.version.release=12
ro.bootimage.build.version.release_or_codename=12
ro.bootimage.build.version.sdk=31
# Auto-added by post_process_props.py
persist.sys.usb.config=mtp
# end of file

Could it be that this is the needed file? If not, could you tell me how I can find it?

I am completely new to Android devices and doing something with them.

maddo7 avatar Mar 04 '23 08:03 maddo7

I'm not super familiar with samsung roms. Usually at the root of the extracted ramdisk there is a default.prop. The build.prop is different iirc.
Is there no ramdisk/default.prop file at all or is it a symlink to /system/etc/prop.default by any chance? On xiaomi devices that's the case and it's then replaced in my script by a sample default.prop.
You can also try to search for ro.secure or adb.secure or ro.debuggable over all the files in the ramdisk/ folder and see if you get results.

pcboy avatar Mar 04 '23 09:03 pcboy