topjohnwu / Magisk

The Magic Mask for Android
GNU General Public License v3.0
47.24k stars 11.96k forks source link

magisk patched boot.img - breaks boot #984

Closed gigabyte-1000 closed 5 years ago

gigabyte-1000 commented 5 years ago

Hi I was hoping you could take a look at my boot image, this is for a tv box ugoos am3/ android 7.1.2 (amlogic S912 chipset),

if I patch this boot image using Magisk Manager the box fails to boot completely, it doesn't even make it to the second boot logo, patching appears to go fine with no errors, same if I flash Magisk from TWRP, no complaints or errors but for some reason it fails to boot.

it seems like if anything modifys the ramdisk it will fail to boot, it's really strange I can't figure it out and not sure how to log this since its pre-boot.

Thanks.. I have tried Magisk 16 - Magisk 18 and the Canary builds with the same result.

stock_boot_f4f6bb3d7d060bbc34af8a9e149f4158d1027296.zip

nitram9 commented 5 years ago

I just wanted to write that I am having the same issue on new install of Magisk v18 or upgrade from v17.2. The second boot screen (of the OS) does not appear. Furthermore, the TWRP (latest) recovery-based uninstall does not seem to revert to the original behavior. I expect that the install has modified a file that cannot be reverted during uninstall.

gigabyte-1000 commented 5 years ago

update I think it may be a problem with magiskinit , i tried running it from shell and it seg faults

[   92.656332@3] magiskinit[7128]: unhandled level 3 translation fault (11) at 0xffffffff, esr 0x92000007
[   92.660278@3] pgd = ffffffc04356f000
[   92.663523@3] [ffffffff] *pgd=00000000138c0003, *pmd=00000000082ef003, *pte=0000000000000000
[   92.671883@3]
[   92.673529@3] CPU: 3 PID: 7128 Comm: magiskinit Tainted: G        W  O 3.14.29 #53
[   92.681064@3] task: ffffffc020a07000 ti: ffffffc027ebc000 task.ti: ffffffc027ebc000
[   92.688651@3] PC is at 0x36c30
[   92.691649@3] LR is at 0x8965
[   92.694568@3] pc : [<0000000000036c30>] lr : [<0000000000008965>] pstate: 20000010
[   92.702123@3] sp : 00000000fffae1e8
[   92.705524@3] x12: 00000000fffae130
[   92.709060@3] x11: 0000000000000001 x10: 00000000fffaf378
[   92.714491@3] x9 : 000000000004822f x8 : 000000000004820e
[   92.719936@3] x7 : 00000000fffaf3e0 x6 : 00000000ffffffff
[   92.725358@3] x5 : 0000000000000000 x4 : 00000000ffffffff
[   92.730792@3] x3 : 0000000000000001 x2 : 0000000000000020
[   92.736225@3] x1 : 000000000004820e x0 : 00000000ffffffff
BruXy commented 5 years ago

Hi, I have probably a similar issue.

I have tried to patch taimen-pq1a.181105.017.a1 (Google Pixel 2 XL) and booting stopped after G and it went to the blank screen and then again and again. (I was running patched taimen-opm1.171019.018 previously.)

I was using MagiskManager-v7.0.0.apk [v7.0.0 (185)/Magisk v18.1 (18100)] on Android 9 (build number above) and according to the output of patching, there was no error. I have downloaded patched_boot.img and used fastboot flash boot patched_boot.img. And also there was no error (I have tried it twice).

When this situation appeared, I have tried to boot to the Recovery mode, but it ended with No Command error. I have used flash-all.sh to flash back the official image and phone works (it was quite problematic because I had to provide mke2fs from platform-tools_r28.0.1-linux.zip).

I have no idea how to provide more information to debug this issue, would pathed_boot.img be helpful?

BruXy commented 5 years ago

I have tried patching again, providing magisk_install_log (I did not tried flash boot again, but checksum of the patched_boot.img is the same:

- Copying image to cache
- Device platform: arm64-v8a
- Downloading zip
... 0%
1038+1 records in
1038+1 records out
1063528 bytes transferred in 0.006 secs (177254666 bytes/sec)
- Unpacking boot image
MagiskBoot v18.1(18100) (by topjohnwu) - Boot Image Modification Tool
Parsing boot image: [/data/user_de/0/com.topjohnwu.magisk/install/boot.img]
HEADER_VER      [0]
KERNEL_SZ       [15155388]
RAMDISK_SZ      [9915831]
SECOND_SZ       [0]
EXTRA_SZ        [0]
RECOV_DTBO_SZ   [0]
OS_VERSION      [9.0.0]
PATCH_LEVEL     [2018-11]
PAGESIZE        [4096]
NAME            []
CMDLINE         [console=ttyMSM0,115200,n8 earlycon=msm_serial_dm,0xc1b0000 androidboot.hardware=taimen androidboot.console=ttyMSM0 lpm_levels.sleep_disabled=1 user_debug=31 msm_rtb.filter=0x37 ehci-hcd.park=3 service_locator.enable=1 swiotlb=2048 firmware_class.path=/vendor/firmware loop.max_part=7 raid=noautodetect usbcore.autosuspend=7 androidboot.dtbo_idx=12 buildvariant=user]
CHECKSUM        [5f84318b85ea12347b32b976d3a22827db35ab1c]
DTB             [392041]
KERNEL_FMT      [lz4]
RAMDISK_FMT     [gzip]
- Checking ramdisk status
MagiskBoot v18.1(18100) (by topjohnwu) - Boot Image Modification Tool
Loading cpio: [ramdisk.cpio]
- Stock boot image detected
- Backing up stock boot image
MagiskBoot v18.1(18100) (by topjohnwu) - Boot Image Modification Tool
Compressing to [stock_boot_5ec2e06639fc086d1f78e60813378199ab978ab6.img.gz]
- Patching ramdisk
MagiskBoot v18.1(18100) (by topjohnwu) - Boot Image Modification Tool
Loading cpio: [ramdisk.cpio]
Add entry [init] (0750)
Patch with flag KEEPVERITY=[true] KEEPFORCEENCRYPT=[true]
Loading cpio: [ramdisk.cpio.orig]
Backup mismatch entry: [init] -> [.backup/init]
Add entry [.backup/.magisk] (0000)
Dump cpio: [ramdisk.cpio]
MagiskBoot v18.1(18100) (by topjohnwu) - Boot Image Modification Tool
MagiskBoot v18.1(18100) (by topjohnwu) - Boot Image Modification Tool
MagiskBoot v18.1(18100) (by topjohnwu) - Boot Image Modification Tool
Patch @ 0185B06E [736B69705F696E697472616D667300]->[77616E745F696E697472616D667300]
- Repacking boot image
MagiskBoot v18.1(18100) (by topjohnwu) - Boot Image Modification Tool
Parsing boot image: [/data/user_de/0/com.topjohnwu.magisk/install/boot.img]
HEADER_VER      [0]
KERNEL_SZ       [15155388]
RAMDISK_SZ      [9915831]
SECOND_SZ       [0]
EXTRA_SZ        [0]
RECOV_DTBO_SZ   [0]
OS_VERSION      [9.0.0]
PATCH_LEVEL     [2018-11]
PAGESIZE        [4096]
NAME            []
CMDLINE         [console=ttyMSM0,115200,n8 earlycon=msm_serial_dm,0xc1b0000 androidboot.hardware=taimen androidboot.console=ttyMSM0 lpm_levels.sleep_disabled=1 user_debug=31 msm_rtb.filter=0x37 ehci-hcd.park=3 service_locator.enable=1 swiotlb=2048 firmware_class.path=/vendor/firmware loop.max_part=7 raid=noautodetect usbcore.autosuspend=7 androidboot.dtbo_idx=12 buildvariant=user]
CHECKSUM        [5f84318b85ea12347b32b976d3a22827db35ab1c]
DTB             [392041]
KERNEL_FMT      [lz4]
RAMDISK_FMT     [gzip]
Repack to boot image: [new-boot.img]
HEADER_VER      [0]
KERNEL_SZ       [15153974]
RAMDISK_SZ      [10153739]
SECOND_SZ       [0]
EXTRA_SZ        [0]
RECOV_DTBO_SZ   [0]
OS_VERSION      [9.0.0]
PATCH_LEVEL     [2018-11]
PAGESIZE        [4096]
NAME            []
CMDLINE         [console=ttyMSM0,115200,n8 earlycon=msm_serial_dm,0xc1b0000 androidboot.hardware=taimen androidboot.console=ttyMSM0 lpm_levels.sleep_disabled=1 user_debug=31 msm_rtb.filter=0x37 ehci-hcd.park=3 service_locator.enable=1 swiotlb=2048 firmware_class.path=/vendor/firmware loop.max_part=7 raid=noautodetect usbcore.autosuspend=7 androidboot.dtbo_idx=12 buildvariant=user]
CHECKSUM        [581967149fe8cf202725795384717c3da0473362]
MagiskBoot v18.1(18100) (by topjohnwu) - Boot Image Modification Tool
Cleaning up...

****************************
 Patched image is placed in 
 /storage/emulated/0/Download/patched_boot.img 
****************************
- All done!
BruXy commented 5 years ago

I have to give it second try, but with the different process using twrp-3.2.3-1-taimen.img described here: https://www.youtube.com/watch?v=RdfFGIYUy78

The system was successfully rooted. I have also used platform-tools from Google (not version c7815d675 comming from Fedora29, but fastboot version 28.0.1-4986621), so maybe this was a problem?

nitram9 commented 5 years ago

Closed because it is solved or no boot img?