Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Magisk doesn't install after flashing patched boot.img #7390

Open
Cronick opened this issue Sep 27, 2023 · 13 comments
Open

Magisk doesn't install after flashing patched boot.img #7390

Cronick opened this issue Sep 27, 2023 · 13 comments
Labels
confirmed Issue confirmed to exist and the reason is known regression Something works in previous versions but not in the current one

Comments

@Cronick
Copy link

Cronick commented Sep 27, 2023

Can't seem to get Magisk installed after flashing the boot.img with fastboot in the bootloader.
Could seem like it doesn't flash the boot partition, but can't seem to spot anything weird with UART.

Device: A95XF1 (Amlogic S905W)
Android version: 13 (LineageOS 20)
Magisk version name: 26.3
Magisk version code: 26301

boot.img.zip
magisk_patched-26301_wyWJB.img.zip
magisk_install_log_2023-09-27T12.11.21.log
dmesg.txt
uart-bootloader-flashing-reboot.txt

@vvb2060 vvb2060 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 28, 2023
@osm0sis
Copy link
Collaborator

osm0sis commented Sep 28, 2023

Some "Legacy SAR" devices don't allow booting when one is added. Yours appears to fit this description, with hdr v2 and no ramdisk in the boot partition. Your only alternative would be to attempt to patch the recovery partition instead (if your device has one) and then you may boot rooted only by booting to recovery. Nothing else Magisk can do about these.

@vvb2060
Copy link
Collaborator

vvb2060 commented Sep 28, 2023

yes, this device has recovery partition

[    4.533357@2] meson-mmc: [mmcblk0p01]           bootloader  offset 0x000000000000, size 0x000000400000
[    4.533810@2] meson-mmc: [mmcblk0p02]             reserved  offset 0x000002400000, size 0x000004000000
[    4.534143@2] meson-mmc: [mmcblk0p03]                cache  offset 0x000006c00000, size 0x000046000000
[    4.534414@2] meson-mmc: [mmcblk0p04]                  env  offset 0x00004d400000, size 0x000000800000
[    4.534694@2] meson-mmc: [mmcblk0p05]                 logo  offset 0x00004e400000, size 0x000000800000
[    4.534967@2] meson-mmc: [mmcblk0p06]             recovery  offset 0x00004f400000, size 0x000001800000
[    4.535259@2] meson-mmc: [mmcblk0p07]                 misc  offset 0x000051400000, size 0x000000800000
[    4.535536@2] meson-mmc: [mmcblk0p08]                 dtbo  offset 0x000052400000, size 0x000000800000
[    4.535813@2] meson-mmc: [mmcblk0p09]             cri_data  offset 0x000053400000, size 0x000000800000
[    4.536192@2] meson-mmc: [mmcblk0p10]                param  offset 0x000054400000, size 0x000001000000
[    4.536525@2] meson-mmc: [mmcblk0p11]                 boot  offset 0x000055c00000, size 0x000001000000
[    4.536811@2] meson-mmc: [mmcblk0p12]                  rsv  offset 0x000057400000, size 0x000001000000
[    4.537094@2] meson-mmc: [mmcblk0p13]             metadata  offset 0x000058c00000, size 0x000001000000
[    4.537367@2] meson-mmc: [mmcblk0p14]               vbmeta  offset 0x00005a400000, size 0x000000200000
[    4.537633@2] meson-mmc: [mmcblk0p15]                  tee  offset 0x00005ae00000, size 0x000002000000
[    4.537913@2] meson-mmc: [mmcblk0p16]               vendor  offset 0x00005d600000, size 0x000014000000
[    4.538195@2] meson-mmc: [mmcblk0p17]                  odm  offset 0x000071e00000, size 0x000008000000
[    4.538479@2] meson-mmc: [mmcblk0p18]               system  offset 0x00007a600000, size 0x000062c00000
[    4.538776@2] meson-mmc: [mmcblk0p19]              product  offset 0x0000dda00000, size 0x000040000000
[    4.539062@2] meson-mmc: [mmcblk0p20]                 data  offset 0x00011e200000, size 0x00028d200000

@vvb2060 vvb2060 reopened this Sep 28, 2023
@vvb2060
Copy link
Collaborator

vvb2060 commented Sep 28, 2023

I checked the patched image and found that the kernel was not patched.

@vvb2060
Copy link
Collaborator

vvb2060 commented Sep 28, 2023

[ 0.000000@0] Kernel command line: init=/init console=ttyS0,115200 no_console_suspend earlycon=aml_uart,0xc81004c0 ramoops.pstore_en=1 ramoops.record_size=0x8000 ramoops.console_size=0x4000 otg_device=1 reboot_mode_android=normal androidboot.selinux=enforcing logo=osd1,loaded,0x3d800000,576cvbs maxcpus=4 vout=576cvbs,enable hdmimode=1080p60hz frac_rate_policy=1 cvbsmode=576cvbs hdmitx=,444,8bit cvbsdrv=0 irq_check_en=0 androidboot.firstboot=0 jtag=disable androidboot.veritymode=enforcing androidboot.hardware=amlogic androidboot.bootloader=U-Boot 2015.01-g2daced4fd4 androidboot.build.expect.baseband=N/A page_trace=on androidboot.rpmb_state=0 androidboot.serialno=1234567890 mac=1e:a9:33:35:cd:08 androidboot.mac=1e:a9:33:35:cd:08 androidboot.wificountrycode=US ro rootwait skip_initramfs androidboot.selinux=permissive root=/dev/mmcblk0p18 androidboot.dtbo_idx=0 hdr_policy=1 otg_device=1 buildvariant=userdebug

:/data/local/tmp # ./magiskboot unpack magisk_patched-26301_wyWJB.img
Parsing boot image: [magisk_patched-26301_wyWJB.img]
HEADER_VER      [2]
KERNEL_SZ       [9978926]
RAMDISK_SZ      [346584]
SECOND_SZ       [57276]
RECOV_DTBO_SZ   [0]
DTB_SZ          [57276]
OS_VERSION      [13.0.0]
OS_PATCH_LEVEL  [2023-08]
PAGESIZE        [2048]
NAME            []
CMDLINE         [androidboot.selinux=permissive root=/dev/mmcblk0p18 androidboot.dtbo_idx=0 hdr_policy=1 otg_device=1 buildvariant=userdebug]
CHECKSUM        [0ef295fa4c2f496ba24d9a1546f200de7137a2ca000000000000000000000000]
KERNEL_FMT      [gzip]
RAMDISK_FMT     [raw]
unexpected ASN.1 DER tag: expected SEQUENCE, got APPLICATION [1] (primitive)
VBMETA
:/data/local/tmp # strings kernel | grep initramfs
6Trying to unpack rootfs image as initramfs...
6rootfs image is not initramfs (%s); looks like an initrd
skip_initramfs
:/data/local/tmp #

@pndwal
Copy link
Contributor

pndwal commented Sep 28, 2023

Some "Legacy SAR" devices don't allow booting when one is added. Yours appears to fit this description, with hdr v2 and no ramdisk in the boot partition...

Strange fish if this TV box is A only L-SAR... I never heard of any other than launched with Android 9... (Google only made SAR from A7, A/B)... Appears this box first had Android 6 and they're being sold currently with Android 8.1 stock... Should be (launched as) legacy ramdisk boot type now converted to '2SI ramdisk SAR' with A10+ by rights...

@osm0sis
Copy link
Collaborator

osm0sis commented Sep 28, 2023

Bootloader does what it does, can't change that. But ah, I see vvb found something interesting about the kernel patching. We shall see! 👍

@canyie
Copy link
Collaborator

canyie commented Sep 28, 2023

@Cronick Attach /proc/mounts?

@osm0sis osm0sis added the needs investigation Reason of this issue is yet unkown label Oct 7, 2023
@Cronick
Copy link
Author

Cronick commented Oct 9, 2023

Sorry. Wasn't aware the question was for me.
mounts.txt

@canyie
Copy link
Collaborator

canyie commented Oct 11, 2023

/dev/block/system / ext4 ro,seclabel,nodev,relatime,block_validity,delalloc,barrier,user_xattr,acl 0 0
[    4.889579] EXT4-fs (mmcblk0p18): couldn't mount as ext3 due to feature incompatibilities
[    4.895391] EXT4-fs (mmcblk0p18): couldn't mount as ext2 due to feature incompatibilities
[    4.907615] EXT4-fs (mmcblk0p18): mounted filesystem without journal. Opts: (null)
[    4.911004] VFS: Mounted root (ext4 filesystem) readonly on device 179:18.
[    4.918701] devtmpfs: mounted
[    4.925428] Freeing unused kernel memory: 5376K
[    4.927728] vpu: switch_vpu_mem_pd: unsupport vpu mod: 12
[    5.096687] init: init first stage started!
[    5.097462] init: Unable to open /lib/modules, skipping module loading.
[    5.116826] init: [libfs_mgr]ReadDefaultFstab(): failed to find device default fstab
[    5.120228] init: Using Android DT directory /proc/device-tree/firmware/android/
[    5.163983] init: DSU not detected, proceeding with normal boot
[    5.164774] init: AVB is not enabled, skip verity setup for '/system'
[    5.171393] init: [libfs_mgr]superblock s_max_mnt_count:65535,/dev/block/system
[    5.179100] init: [libfs_mgr]__mount(source=/dev/block/system,target=/system,type=ext4)=0: Success
[    5.188687] init: Switching root to '/system'
[    5.192556] init: AVB is not enabled, skip verity setup for '/odm'
[    5.202541] EXT4-fs (mmcblk0p17): mounted filesystem without journal. Opts: barrier=1,inode_readahead_blks=8
[    5.212823] EXT4-fs (mmcblk0p19): mounted filesystem without journal. Opts: barrier=1,inode_readahead_blks=8
[    5.222755] EXT4-fs (mmcblk0p16): mounted filesystem without journal. Opts: barrier=1,inode_readahead_blks=8
[    5.232344] init: 9 output lines suppressed due to ratelimiting
[    5.275999] init: Skipping mount of system_ext, system is not dynamic.
[    4.538479] meson-mmc: [mmcblk0p18]               system  offset 0x00007a600000, size 0x000062c00000

The kernel sees skip_initramfs and root=/dev/mmcblk0p18, mounts /system as /, then init again mounts /system and switch root to /system.
/proc/mounts looks like rootfs-based 2SI, so skip_initramfs isn't patched out from kernel.

@canyie canyie added regression Something works in previous versions but not in the current one confirmed Issue confirmed to exist and the reason is known and removed needs investigation Reason of this issue is yet unkown labels Oct 11, 2023
@DamienCassou

This comment was marked as off-topic.

@tempoeric

This comment was marked as off-topic.

@DamienCassou

This comment was marked as off-topic.

Repository owner locked as off-topic and limited conversation to collaborators Nov 11, 2023
Repository owner unlocked this conversation Dec 16, 2023
@mtnstar

This comment was marked as off-topic.

Repository owner locked as off-topic and limited conversation to collaborators Jan 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
confirmed Issue confirmed to exist and the reason is known regression Something works in previous versions but not in the current one
Projects
None yet
Development

No branches or pull requests

8 participants