topjohnwu/Magisk

Magisk does not work on PineNote

DorianRudolph opened this issue · 6 comments

I'm trying to root the PineNote, which I am aware is an odd device.
I use the method of patching the boot.img

Install log:
magisk_install_log_2021-12-26T21_27_19Z.log

The Magisk app does not detect the installed magisk.
Running su or magisk --daemon both result in the output No daemon is currently running!.

Boot log from UART:
boot.log

Below are the parts that seemed relevant to me.

[    2.448899] magiskinit: Kernel cmdline info:
[    2.448946] magiskinit: skip_initramfs=[0]
[    2.448973] magiskinit: force_normal_boot=[0]
[    2.448997] magiskinit: rootwait=[1]
[    2.449021] magiskinit: slot=[]
[    2.449043] magiskinit: dt_dir=[]
[    2.449067] magiskinit: fstab_suffix=[]
[    2.449091] magiskinit: hardware=[rk30board]
[    2.449114] magiskinit: hardware.platform=[]
[    2.449170] magiskinit: open: /proc/bootconfig failed with 2: No such file or directory
[    2.449200] magiskinit: Boot config info:
[    2.449221] magiskinit: skip_initramfs=[0]
[    2.449236] magiskinit: force_normal_boot=[0]
[    2.449249] magiskinit: rootwait=[1]
[    2.449263] magiskinit: slot=[]
[    2.449287] magiskinit: dt_dir=[]
[    2.449310] magiskinit: fstab_suffix=[]
[    2.449332] magiskinit: hardware=[rk30board]
[    2.449355] magiskinit: hardware.platform=[]
[    2.449489] magiskinit: Device tree:
[    2.450143] magiskinit: Found pattern [selinux_setup]
[    2.450233] magiskinit: FirstStageInit
[    2.450427] magiskinit: Found fstab file: fstab.rk30board
[    2.450895] magiskinit: Write fstab file: fstab.rk30board
[    2.483768] magiskinit: Unmount [/sys]
[    2.500155] mmc_host mmc1: Bus speed (slot 0) = 375000Hz (slot req 300000Hz, actual 187500HZ div = 1)
[    2.513815] magiskinit: Unmount [/proc]
[    2.517568] mmc_host mmc1: Bus speed (slot 0) = 375000Hz (slot req 375000Hz, actual 375000HZ div = 0)
[    2.529292] init: init first stage started!
...
[    2.644511] init: Skipped setting INIT_AVB_VERSION (not in recovery mode)
[    2.645711] magiskinit: SecondStageInit
[    2.646549] magiskinit: Switch root to /system_root
[    2.651507] magiskinit: Cleaning rootfs
[    2.653646] magiskinit: Setup Magisk tmp at /dev/RRx3e
[    2.665489] magiskinit: Setup userdata: [mmcblk2p16] (179, 16)
[    2.666118] EXT4-fs (mmcblk2p16): VFS: Can't find ext4 filesystem
[    2.666285] magiskinit: mount /dev/RRx3e/.magisk/block/data->/dev/RRx3e/.magisk/mirror/data failed with 22: Invalid argument
[    2.666348] magiskinit: Setup cache: [mmcblk2p11] (179, 11)
[    2.669409] EXT4-fs (mmcblk2p11): mounted filesystem with ordered data mode. Opts: (null)
[    2.680093] magiskinit: Replace [/system/etc/selinux/plat_sepolicy.cil] -> [xxx]
[    2.721920] magiskinit: Replace [/sepolicy] -> [/dev/.se]
[    2.726596] magiskinit: sepol: split policy
[    2.727925] magiskinit: /system/etc/selinux/plat_sepolicy_and_mapping.sha256=[b139ab91cc2467475af0cd0ab2498bf7977550a49352f0748a5cc82b0f336f45]
[    2.727956] magiskinit: /odm/etc/selinux/precompiled_sepolicy.plat_sepolicy_and_mapping.sha256=[b139ab91cc2467475af0cd0ab2498bf7977550a49352f0748a5cc82b0f336f45]
[    2.728890] magiskinit: /product/etc/selinux/product_sepolicy_and_mapping.sha256=[e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855]
[    2.728916] magiskinit: /odm/etc/selinux/precompiled_sepolicy.product_sepolicy_and_mapping.sha256=[e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855]
[    2.730156] magiskinit: /system_ext/etc/selinux/system_ext_sepolicy_and_mapping.sha256=[28e96515cb035ba6ec86936746c6cdeef79fd8afac21b8c84682e26beb2dd9e3]
[    2.730178] magiskinit: /odm/etc/selinux/precompiled_sepolicy.system_ext_sepolicy_and_mapping.sha256=[28e96515cb035ba6ec86936746c6cdeef79fd8afac21b8c84682e26beb2dd9e3]
[    2.730194] magiskinit: Load policy from: /odm/etc/selinux/precompiled_sepolicy
[    2.795336] magiskinit: opendir: /dev/RRx3e/.magisk/mirror/cache/magisk failed with 2: No such file or directory
[    2.795376] magiskinit: Dumping sepolicy to: [/dev/.se]
[    2.850734] magiskinit: Restore backup files locally
[    2.856933] magiskinit: Inject magisk services: [pGl3f9lRb] [dEj4J9U] [2dzEwkC2yfk1mF]
[    2.859681] dwmmc_rockchip fe2c0000.dwmmc: Successfully tuned phase to 220
[    2.862596] mmc1: new ultra high speed SDR104 SDIO card at address 0001
[    2.873285] magiskinit: Replace [d30138f2310a9fb9c54a3e0c21f58591] -> [y0FBISP5ZbDTl]
[    2.891349] magiskinit: Replace [d30138f2310a9fb9c54a3e0c21f58591] -> [y0FBISP5ZbDTl]
[    2.892610] magiskinit: Mount [.magisk/rootdir/system/etc/init/hw/init.rc] -> [/system/etc/init/hw/init.rc]
[    2.892730] magiskinit: Mount [.magisk/rootdir/system/lib64/libselinux.so] -> [/system/lib64/libselinux.so]
[    2.892793] magiskinit: Mount [.magisk/rootdir/init] -> [/init]
[    2.916272] magiskinit: Unmount [/dev/RRx3e/.magisk/mirror/system_root]
[    2.943319] magiskinit: Unmount [/dev/RRx3e/.magisk/mirror/cache]
[    3.081769] init: Loading SELinux policy
...
[    5.655662] init: processing action (post-fs-data) from (/system/etc/init/hw/init.rc:1107)
[    5.655780] init: Command 'rm /dev/.magisk_unblock' action=post-fs-data (/system/etc/init/hw/init.rc:1109) took 0ms and failed: unlink() failed: No such file or directory
[    5.655935] init: starting service 'pGl3f9lRb'...
[    6.300117] init: wait for '/dev/.magisk_unblock' took 641ms
[    6.300224] init: Command 'wait /dev/.magisk_unblock 40' action=post-fs-data (/system/etc/init/hw/init.rc:1111) took 641ms and succeeded
[    6.300361] init: Service 'pGl3f9lRb' (pid 201) exited with status 0 oneshot service took 0.643000 seconds in background

Regarding, [ 2.666118] EXT4-fs (mmcblk2p16): VFS: Can't find ext4 filesystem, I think the userdata partition is in f2fs format.

Device: PineNote
Android version: 11
Magisk version name: 92546e8
Magisk version code: 23016

userdata partition is in f2fs format

this is expected, and Magisk can handle this case properly.
You problem is, magiskd gets killed by init:

[    5.655935] init: starting service 'pGl3f9lRb'...
[    6.300117] init: wait for '/dev/.magisk_unblock' took 641ms
[    6.300224] init: Command 'wait /dev/.magisk_unblock 40' action=post-fs-data (/system/etc/init/hw/init.rc:1111) took 641ms and succeeded
[    6.300361] init: Service 'pGl3f9lRb' (pid 201) exited with status 0 oneshot service took 0.643000 seconds in background
[    6.300403] init: Sending signal 9 to service 'pGl3f9lRb' (pid 201) process group...
[    6.306288] libprocessgroup: Successfully killed process cgroup uid 0 pid 201 in 5ms
[    6.306588] init: Killed 1 additional processes from a oneshot process group for service 'pGl3f9lRb'. This is new behavior, previously child processes would not be killed in this case.

magiskd should escape from current cgroup to prevent itself from being killed. May you upload /proc/mounts?

Here is /proc/mounts
mounts.txt

Just for fun, I also tried Magisk 22 and 22.1, both of which did work even less because they did not even install the su file and took significantly longer to even boot. Log file:
boot_22.log

looks like a normal cgroup v2 mount structure... please test this build: https://github.com/canyie/Magisk/actions/runs/1627522914
If it still doesn't work, please open /etc/cgroups.json, check every key named Path, open them in file explorer, and check if it has some subfolder named in "uid_" format (like "uid_0" "uid_1000").

EDIT: Download link updated since github action broken.

Thanks a lot, this seems to work now!