Closed joyX3 closed 2 months ago
Can you please rerun that with --log-level trace
and post the output here? And if you could upload the boot
and init_boot
files you get from patching with KernelSU, that would be great too.
Init_boot_ptch.txt txt->img
[Uploading boot_ptch.img.zip…]()
[Uploading boot_ptch.img.zip…]()
Thanks for uploading init_boot
. (The boot
image didn't upload successfully, but I assume it has the same problem as init_boot
.)
The problem is that KernelSU's patching process fails to update the fields properly in the AVB footer:
Original LineageOS image:
❯ avbroot avb info -i extracted/init_boot.img
...
HashDescriptor {
image_size: 2670592,
...
Footer {
original_image_size: 2670592,
KernelSU patched image:
❯ avbroot avb info -i Init_boot_ptch.txt
...
HashDescriptor {
image_size: 2670592,
^^^^^^^
# KernelSU fails to update this
...
Footer {
original_image_size: 3002368,
^^^^^^^
# KernelSU updates this properly
So when you boot, the checksum does not match because the incorrect size is telling the bootloader to only verify a part of the image instead of the whole image. That's why you get the no bootable image error.
This is a KernelSU bug, but you can work around it by manually using avbroot to update the AVB fields instead of KernelSU:
Extract the AVB metadata:
avbroot avb unpack -i init_boot.img
This will split the file into avb.toml
and raw.img
. raw.img
no longer contains AVB metadata so KernelSU can't mess it up.
Patch raw.img
with KernelSU.
Replace raw.img
with the patched file.
Create init_boot_ptch.img
:
avbroot avb pack -o init_boot_ptch.img
(Repeat with boot.img
)
Thx, I will try. IMHO u and kernelsu people have to work together.
After this command: avbroot avb pack -o init_boot_ptch.img I get this error: ERROR Need to sign new AVB header, but no private key was specified
Patching get error ERROR Failed to patch OTA zip
Caused by: 0: Failed to patch payload: payload.bin 1: Failed to patch boot images: boot, init_boot, vendor_boot 2: AVB error 3: Invalid VBMeta header magic: [65, 78, 68, 82]
Which key I have to use?
I used command
avbroot avb pack --output boot_patched.img --key avb.key
Thank u very much without ur it would be impossible
I used command
avbroot avb pack --output boot_patched.img --key avb.key
Thank u very much without ur it would be impossible
Glad you got it working! Yep, that's the right way to do it.
Telefone: Pixel 7 pro 12/512. Avbroot on ubuntu. LineageOS. Doesn't work. On the pixel I patch with kernelsu init_boot and boot images. Then I sent result to ubuntu. The comand is: ./avbroot ota patch --input lineage.zip --key-avb avb.key --key-ota ota.key --cert-ota ota.crt --prepatched boot.img --replace init_boot init_boot.img --clear-vbmeta-flags
It passed without errors and I get lineage.zip.patched file. From it I make directory extracted. Flash with fastboot all files from extracted directory except system.img. With sideloade I flash lineage.zip.patched. then erase and flash avb_custom_key. All it passed without any errors.
When I lock bootloader and boot, I get something like this: there is no bootable image. If I maintain bootloader unlock I can boot os. But it has no root. But if I flash boot.img and init_boot.img exactly which I get after patching them with kernelsu (before sending them to avbroot) I get kernelsu lkm rooted os.
I did this about 20 times with different OS and changing the sequence of actions with the same result