Closed onlycs closed 3 years ago
Is there any fix?
Also what about this? https://mobile.twitter.com/topjohnwu/status/1008056655001468928?lang=en
I have a phh build. (Andy Yan)
Edit: Got working, flash successful. But magisk manager says "Installed: N/A" and won't let me access modules.
:/
Latest Edit 2/23 How to Get Magisk Working on an Android 11-based GSI
Disclaimer
* I am not responsible for bricked devices, dead SD cards, thermonuclear war,
* or you getting fired because the alarm app failed. Please do some research
* if you have any concerns about features included in this tutorial
* before following it! YOU are choosing to make these modifications, and if
* you blame me in any way for what happens to your device, I will laugh at you.
Note - when you install magisk use 21.1 and then upgrade (if u want). Flashing above 21.1 will do weird things to the PATH (at least for me) and not let Magisk install be accessed by the manager. Don't upgrade to 21.4, it bootloops. I haven't tried 21.3, lmk if it works. The latest I have tested and confirmed is 21.1. make sure to get the old manager.
Part 0.5(Only if you have phhsu) Note: I haven't tried this myself. Also thanks to @hwti for help in getting rid of phhsu and it's files. If you are using this method, there is no need to do part 1 or part 2, just skip to bypassing SafetyNet if you want or be ok with just Magisk running.
phh-securize.sh
/system/bin/resetprop
to /system/bin/phh-resetprop
/system/bin/rw-system.sh
and /system/bin/phh-prop-handler.sh
to replace all cases of /system/bin/resetprop
in those files to /system/bin/phh-resetprop
/system/app/(package name)
Part 1: Flashing
/system_root/sbin
Part 2: Adding Stuff to PATH
adb root
then adb shell
, but make sure you allow root debugging in settings)su
. Magisk will ask for root access, allow.echo $PATH
, and copy output./init.environ.rc
# Stuff Here!!!
on early-init
export PATH /sbin:(echo $PATH output here)
# Stuff Here!!!
Of course, replace the "(echo $PATH output here)" with the actual output you copied on Part 2, step 3. DO NOT USE PARENTHESES!!
For me, it looks like:
on early-init
export PATH /sbin:/product/bin:/apex/com.android.runtime/bin:/apex/com.android.art/bin:/system_ext/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin
Part 3: Passing SafetyNet
Tested on Andy Yan's LineageOS 18.1 using a Moto G8 Plus (Doha).
@dragonBall561, thank you for the workaround
In my case on Essential PH-1 with phh's Android 11 GSI , before creating /sbin
, I had :
[ 13.331584] init: cannot execv('/dev/Thu8xtl/magisk'). See the 'Debugging init' section of init's README.md for tips: Permission denied
So something doesn't work with the new installation path.
Once the system is booted, the /dev/Thu8xtl/magisk
can be executed, so I don't know what is the issue.
Then the PATH
change allows /sbin/su
(Magisk) to be used instead of /system/xbin/su
(phh).
If you have ANY su installed, uninstall it. Make sure to create /sbin before flashing Magisk.
Also make sure you flash v21.1 because older versions bootloop.
PS: I'm not very good at understanding error messages, I'm just a beginner.
It seems there are two issues :
/system/bin/resetprop
to /system/bin/magisk
(target of resetprop
symlink) /dev/su/su
, and does a bind-mount to /system/bin/su
, which "replaces" the magisk
binary tooSo running phh-securize.sh
(which requires a GSI able to be remounted rw, and needs to be adapted to Magisk >=21 depending on when we launch the script) to remove the builtin su fixes the second problem.
But the resetprop issue must be fixed first, else I lose root. Removing /system/bin/resetprop
works, but it breaks the ROM use of the command in boot scripts (I don't know why the current Magisk resetprop doesn't seem to work).
Renaming /system/bin/resetprop
to phh-resetprop
, and adjusting /system/bin/rw-system.sh
and /system/bin/phh-prop-handler.sh
works.
Thanks I'll add it to the guide :) Also please lmn how to adjust /system/bin/rw-system.sh and /system/bin/phh-prop-handler.sh, or if I get it wrong in the guide.
@dragonBall561 You are doing too many things.
With the phh-securize.sh
and the renaming to phh-resetprop
, Magisk can be installed in the default Android 11 location, there is no need to create /sbin
and modify PATH
any more.
Running phh-securize.sh
before installing Magisk is installed like you suggested is actually easier that what I had to do manually, but it requires TWRP (and for example people upgrading from an Android 10 GSI and keeping their patched boot image).
Ideally, Magisk shouldn't overwrite itself when there is a resetprop in the ROM and phh-su should avoid overwriting Magisk. Then the phh-securize.sh could be improved to work even when Magisk runs over phh-su, like I did for the previous install location.
With the
phh-securize.sh
and the renaming tophh-resetprop
, Magisk can be installed in the default Android 11 location, there is no need to create/sbin
and modifyPATH
any more.
From what I tested on my Razer Phone 2 with Nusantara GSI (which is already securized), renaming to phh-resetprop
is indeed mandatory but I'm still not sure about the creating of /sbin
(I did anyway, and Magisk works).
Running
phh-securize.sh
before installing Magisk is installed like you suggested is actually easier that what I had to do manually, but it requires TWRP (and for example people upgrading from an Android 10 GSI and keeping their patched boot image).
Haven't tested this part as from my own experience, major upgrades from GSI to GSI is not straightforward and I usually just back things up with Migrate, make a clean flash, then restore the stuffs I have backed up once I verified everything important is working correctly.
Ideally, Magisk shouldn't overwrite itself when there is a resetprop in the ROM and phh-su should avoid overwriting Magisk. Then the phh-securize.sh could be improved to work even when Magisk runs over phh-su, like I did for the previous install location.
In case I really cannot do anything to the system partition (such as with the new Dynamic Partitioning), it's still necessary to look for ways to at least coexist with phh's resetprop
.
UPDATE: With latest Magisk, there's no need to create /sbin
anymore as Magisk can put itself to /bin
if /sbin
is not present. However, if your GSI has /sbin
but it's not in $PATH
(which is the case for some GSIs), you'll have to delete your /sbin
, or Magisk will put itself there which cannot be accessed directly and will not work. As this requires you to modify your system partition, if you're having this issue on a non-vndklite GSI (which can't mount system r/w directly), you'll have to use another one. See #4309 for more information about this.
i am on an android 13 gsi with no sbin and no twrp, also my boot.img doesn't have a ramdisk, flashing magisk on recovery doesn't work neither, if i do the procedure and release buttons at logo i get into recovery anyway, could you please provide instructions on how to install magisk into the system partition? I tried as well magisk delta system install but it doesn't work on f2fs
may i say this is working on gsi with magisk 25.2:https://github.com/HuskyDG/magisk-files/issues/118#issuecomment-2381384721 i just had to add on init.rc a service to set selinux permissive and magisk delta init.rc, i also created sbin artificially on init and symlinked/sbin/magisk to /system/bin/su, i'll grab everything Init_magisk.txt instructions as well:Instructions.txt. Seems modules won't work, i can enable the tab by updating the app to magisk 27, NOT update magisk as well, but even if i install a module at reboot it won't properly load. Sad
Hello! I have a Moto G8+ running a Lineage OS 18.1 GSI. Magisk doesn't work. Running v21 goes to bootloader on boot and v20 gets stuck in a bootloop.
I have successfully removed Magisk after each attempt. Could anyone please figure out what is going wrong?