Magisk: Incompatible with GSIs

Created on 9 Dec 2018  路  18Comments  路  Source: topjohnwu/Magisk

GSIs use tons of non standard hacks that I am not willing to spend time to support it.
ALL custom ROMs should aim to be as close to stock ROM as possible, it is impossible for me to keep track of all the incompatible custom changes in the wild unless it is from a major OEM.

wontfix

Most helpful comment

Watching dmesg logs with a working and non-working magisk, I saw some dependency:
If so, the magisk does not work

[ 0.858507] (1)[1:init]magiskinit: Early mount system
[ 0.859628] (1)[1:init]magiskinit: mount ->/system failed with 22: Invalid argument
[ 0.859895] (1)[1:init]magiskinit: Early mount vendor
[ 0.859948] (1)[1:init]magiskinit: mount ->/vendor failed with 22: Invalid argument
...
[ 0.876713] (0)[171:kworker/u16:2]mmc0: new HS400 MMC card at address 0001
[ 0.877380] (0)[171:kworker/u16:2]mmcblk0: mmc0:0001 DF4032 29.1 GiB
[ 0.877774] (0)[171:kworker/u16:2]mmcblk0boot0: mmc0:0001 DF4032 partition 1 4.00 MiB
[ 0.878169] (0)[171:kworker/u16:2]mmcblk0boot1: mmc0:0001 DF4032 partition 2 4.00 MiB
[ 0.878560] (0)[171:kworker/u16:2]mmcblk0rpmb: mmc0:0001 DF4032 partition 3 4.00 MiB

If so, the magisk work

[ 0.857096] (0)[114:kworker/u16:1]mmc0: new HS400 MMC card at address 0001
[ 0.857710] (0)[114:kworker/u16:1]mmcblk0: mmc0:0001 DF4032 29.1 GiB
[ 0.858087] (0)[114:kworker/u16:1]mmcblk0boot0: mmc0:0001 DF4032 partition 1 4.00 MiB
[ 0.858482] (0)[114:kworker/u16:1]mmcblk0boot1: mmc0:0001 DF4032 partition 2 4.00 MiB
[ 0.858860] (0)[114:kworker/u16:1]mmcblk0rpmb: mmc0:0001 DF4032 partition 3 4.00 MiB
...
[ 0.919170] (0)[1:init]magiskinit: Early mount system
[ 0.926204] (0)[1:init]magiskinit: Found system: [mmcblk0p28] (179, 28)
[ 0.949423] (0)[1:init]magiskinit: Early mount vendor
[ 0.949463] (0)[1:init]magiskinit: Found vendor: [mmcblk0p27] (179, 27)

So I decided to build magisk for the test and I add sleep(1); in early_mount and now the magisk seems to be working.

All 18 comments

I am currently running a GSI on my HTC U12+ I can confirm same issue is there any log I can provide to help fix this issue?

For Leagoo T8s found stable working version: 16.4

For Vernee T3 Pro (working versions)
Pie: 17.1 Above that version you have root but you are unable to grant root for more apps (dialog does not show)
Oreo: 18.1, didn't try 19

Any progress on this?
See my comments on #509

Also note:

Every gsi I tried on my moto G7 (Android 9, arm64-v8a, a/b partition) flashing magisk zip caused bootloops. Flashing patched image would boot until I installed magisk manager and complete environment setup, then bootloop. So it would seem to be an issue with how magisk sets up its environment

Tested gsi: Resurrection Remix, lineage OS, dirty unicorn, descendant

Tried version: 17.1-19.0 Canary

Phone: Leagoo T8s
Vendor: LeagooOS (android 8.1),
System: gsi AEX v6.5 arm64 aonly 20190509 (for phh-su and adb root)

I installed magisk canary build 4040a024 and found the magisk logs in dmesg.
And drew attention to this:

[ 0.858507] (1)[1:init]magiskinit: Early mount system
[ 0.859628] (1)[1:init]magiskinit: mount ->/system failed with 22: Invalid argument
[ 0.859895] (1)[1:init]magiskinit: Early mount vendor
[ 0.859948] (1)[1:init]magiskinit: mount ->/vendor failed with 22: Invalid argument
[ 0.860025] (1)[1:init]magiskinit: open: /proc/device-tree/firmware/android/fstab/product/dev failed with 2: No such file or directory
[ 0.860105] (1)[1:init]magiskinit: open: /proc/device-tree/firmware/android/fstab/odm/dev failed with 2: No such file or directory
[ 0.860151] (1)[1:init]magiskinit: sepol: no selinux

Full log: dmesg

Also making old versions found a commit with which problems begin: adf95ce3

Watching dmesg logs with a working and non-working magisk, I saw some dependency:
If so, the magisk does not work

[ 0.858507] (1)[1:init]magiskinit: Early mount system
[ 0.859628] (1)[1:init]magiskinit: mount ->/system failed with 22: Invalid argument
[ 0.859895] (1)[1:init]magiskinit: Early mount vendor
[ 0.859948] (1)[1:init]magiskinit: mount ->/vendor failed with 22: Invalid argument
...
[ 0.876713] (0)[171:kworker/u16:2]mmc0: new HS400 MMC card at address 0001
[ 0.877380] (0)[171:kworker/u16:2]mmcblk0: mmc0:0001 DF4032 29.1 GiB
[ 0.877774] (0)[171:kworker/u16:2]mmcblk0boot0: mmc0:0001 DF4032 partition 1 4.00 MiB
[ 0.878169] (0)[171:kworker/u16:2]mmcblk0boot1: mmc0:0001 DF4032 partition 2 4.00 MiB
[ 0.878560] (0)[171:kworker/u16:2]mmcblk0rpmb: mmc0:0001 DF4032 partition 3 4.00 MiB

If so, the magisk work

[ 0.857096] (0)[114:kworker/u16:1]mmc0: new HS400 MMC card at address 0001
[ 0.857710] (0)[114:kworker/u16:1]mmcblk0: mmc0:0001 DF4032 29.1 GiB
[ 0.858087] (0)[114:kworker/u16:1]mmcblk0boot0: mmc0:0001 DF4032 partition 1 4.00 MiB
[ 0.858482] (0)[114:kworker/u16:1]mmcblk0boot1: mmc0:0001 DF4032 partition 2 4.00 MiB
[ 0.858860] (0)[114:kworker/u16:1]mmcblk0rpmb: mmc0:0001 DF4032 partition 3 4.00 MiB
...
[ 0.919170] (0)[1:init]magiskinit: Early mount system
[ 0.926204] (0)[1:init]magiskinit: Found system: [mmcblk0p28] (179, 28)
[ 0.949423] (0)[1:init]magiskinit: Early mount vendor
[ 0.949463] (0)[1:init]magiskinit: Found vendor: [mmcblk0p27] (179, 27)

So I decided to build magisk for the test and I add sleep(1); in early_mount and now the magisk seems to be working.

I noticed that ianmacd version solved my bootloop issue on Descendant sGSI on a moto g6 if that helps

Here's a new one: The latest Magisk won't respond to su requests on any GSI ROM that I've tested. It just times out and returns permission denied. Manually editing magisk.db to enable specific apps works perfectly fine. It seems that MagiskSU cannot open the dialog to ask whether it should allow the app to use root.

Edit: I don't have much useful information right now. I couldn't get any of the Magisk logs and I couldn't find anything useful in logcat either. I'll add stuff in when I find more information.

As it turns out, it wasn't Magisk's fault. The shared library libdirect-coredump.so was missing from /system/lib / /system/lib64, so I copied it from /vendor and Magisk started working perfectly.

As it turns out, it wasn't Magisk's fault. The shared library libdirect-coredump.so was missing from /system/lib / /system/lib64, so I copied it from /vendor and Magisk started working perfectly.

This fix works on Vernee T3 Pro on GSI AOSP 9.0 v113.
Good job @nonnymoose
@phhusson This looks interesting.

Any updates on this?

As it turns out, it wasn't Magisk's fault. The shared library libdirect-coredump.so was missing from /system/lib / /system/lib64, so I copied it from /vendor and Magisk started working perfectly.

helped for me too

For users with devices such as the Moto G7 Power removing init.mmi.hab.sh from /vendor/bin/ may fix boot loops when installing magisk. Dm-verity will need to be disabled. Take a look at this.

That'll do it yes

For those who are curious, that script looks like it verifies boot, vendor, and system and refuses to boot if any fails verification. Which obviously with Magisk boot image verification will fail. And possibly with a GSI too but that's OT

Good catch 馃憤

As it turns out, it wasn't Magisk's fault. The shared library libdirect-coredump.so was missing from /system/lib / /system/lib64, so I copied it from /vendor and Magisk started working perfectly.

This is Magisk fault. This error happen only on permissive contexts, or on contexts that allow noatsecure, that's why it works on STOCK UNMODIFIED NO MAGISK boot.img + GSI.
This issue has absolutely nothing to do with GSI.
There is no reason to add noatsecure to contexts not related to Magisk.

@topjohnwu maybe an issue that needs looking at. Doesn't seem like a desired behavior for magisk to modify any selinux policies outside of it's own context

As it turns out, it wasn't Magisk's fault. The shared library libdirect-coredump.so was missing from /system/lib / /system/lib64, so I copied it from /vendor and Magisk started working perfectly.

This is Magisk fault. This error happen only on permissive contexts, or on contexts that allow noatsecure, that's why it works on STOCK UNMODIFIED NO MAGISK boot.img + GSI.
This issue has absolutely nothing to do with GSI.
There is no reason to add noatsecure to contexts not related to Magisk.

As it turns out, it wasn't Magisk's fault. The shared library libdirect-coredump.so was missing from /system/lib / /system/lib64, so I copied it from /vendor and Magisk started working perfectly.

I dont have those files in /vendor ... What do i do?

Was this page helpful?
0 / 5 - 0 ratings