"Magisk Alpha" magisk fork patching fails
cawilliamson opened this issue · 5 comments
Hello!
This is a long shot but I use a Magisk fork called "Magisk Alpha" which has worked via avbroot auto-patching (using the APK) until now when it suddenly fails.
I've attached the actual APK to this ticket but I'm not 100% sure where the source is - it used to be open source and I believe the source is still out there somewhere but I'm not sure where.
When attempting to patch with this I get:
2.770s INFO Replacing zip entry: META-INF/com/android/otacert
2.770s INFO Copying zip entry: apex_info.pb
2.770s INFO Copying zip entry: care_map.pb
2.770s INFO Patching zip entry: payload.bin
2.770s INFO Extracting from original payload: boot
2.871s INFO Extracting from original payload: vendor_boot
2.974s INFO Extracting from original payload: system
4.746s INFO Extracting from original payload: vbmeta
4.747s INFO Extracting from original payload: init_boot
4.822s INFO Patching boot images: boot, init_boot, vendor_boot
5.145s 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: Zip error
3: specified file not found in archive
I did compile avbroot with your patch for the 27003 version of magisk also just to test but get the same result. It seems like it's looking for a missing partition "specified file not found in archive" but if I install with their previous version of magisk alpha OR the latest official magisk build it patches just fine. Bit odd.
EDIT: I had to rename the APK to a ZIP in order to attach it to the ticket. Please feel free to rename and test if you wish. This isn't my fork though so no worries if it's a case of "We don't support this, go away!" :)
Thanks for reporting this! I think the problem is just that they're sticking with the 27002 version number, similar to upstream Magisk's CI (master
branch) builds. So now there's 27002 with the old behavior and 27002 with the new behavior.
Maybe I can find a way to improve avbroot's detection instead of just relying on version numbers. At the very least, I'll be fixing the error message so that specified file not found in archive
actually specifies what file is missing :)
In the meantime, since you're building from source already, I bet that changing this line from 27003..
to 27002..
will fix the problem: https://github.com/chenxiaolong/avbroot/pull/268/files#diff-224aa9709fc987f31ed7b355dc79c99ea36488d9b6e3de99eab03cdaec1070feR160. I'll verify after work today.
#268 now fixes both issues. avbroot's support for Magisk's new file structure no longer depends on the version number and the error messages now indicate which file was not found:
1.547s 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: Zip error for entry name: "lib/arm64-v8a/libmagisk64.so"
3: specified file not found in archive
@chenxiaolong That is absolutely awesome - patched and flashed successfully now!
One concern - once I boot and launch Magisk I'm greeted with the dreaded "I need to flash again, recovery can't detect..." type message which is strange because I DID specify themagisk-preinit-device as metadata
which is what worked before and even having patched the init_boot.img on the device itself it does say sda10 which is metadata:
husky:/ $ ls -l /dev/block/by-name/metadata
lrwxrwxrwx 1 root root 16 2024-06-04 09:29 /dev/block/by-name/metadata -> /dev/block/sda10
Not 100% sure if it's a magisk issue or a avbroot patching issue. :(
Update: Full message from Magisk is:
Requires Additional Setup:
Your device needs reflash Magisk to work properly. Please reinstall Magisk within app; recovery mode cannot get correct device info.
Awesome!
Just to double check: did you also install the updated Magisk APK?
If the error happens even when the installed APK matches what the OTA was patched with, can you check a couple things?
- Check if the version numbers at the top of
/data/adb/magisk/util_functions.sh
matchesassets/util_functions.sh
inside the APK. - Check if
Device type
instat /debug_ramdisk/.magisk/device/preinit
matches the metadata partition (stat /dev/block/sda10
).
Also, could you upload both the init_boot
patched from the app and also the init_boot
extracted from the OTA (avbroot ota extract -i ota.zip -d .
)?
How DARE you?! Of course I installed the latest APK!!! >:O
Ok.... yep... I'm an idiot. I forgot to install the new APK. :( Thank you for your patience with me on this one! I owe you a beer or ten! 👍