(WIP) Magisk/Root installation

Search This thread

skaforey

Senior Member
Nov 5, 2009
569
364
San Diego, CA
So this morning, we finally got our hands on some factory images. That is the good news. The bad news is that so far I am unable to get Magisk to work. Anyone else get it to work yet?

Here is what I have done:
1) Download the latest (5.4) magisk manager apk [Thread | Direct Link]
2) Set the update channel to both stable (14.0) and beta (14.3)
3) Choose install from stock boot img (with and without keep dm-verity and force encryption)
4) Copy the patched boot img from your phone:
Code:
adb pull /sdcard/MagiskManager/patched_boot.img .
4) Flash the modified boot.img in fastboot
Code:
fastboot flash boot patched_boot.img

Results:
1) With 14.0, the system boots up fine, but magisk isn't installed
2) With 14.3, I get bootloops, and have to reflash the stock boot.img in order to get it to boot.

Might be worth noting that the patched boot img is significantly smaller than the original one (about 25mb vs 40mb)
 
Last edited:

stevetrooper

Senior Member
Jul 6, 2010
218
82
Kansas
I tried the same thing with 14.3 only and it says it patches the boot.img that I pulled from the image. I then reboot and I am not rooted. Is there suppose to be an option to patch the second slot?
 

skaforey

Senior Member
Nov 5, 2009
569
364
San Diego, CA
Once you patch the stock boot.img it should tell you where it placed the patched img. For me it was /sdcard/MagiskManager/patched_boot.img

You need to pull that img file, reboot to bootloader and fastboot flash that.
 
  • Like
Reactions: AdamT6

stevetrooper

Senior Member
Jul 6, 2010
218
82
Kansas
Once you patch the stock boot.img it should tell you where it placed the patched img. For me it was /sdcard/MagiskManager/patched_boot.img

You need to pull that img file, reboot to bootloader and fastboot flash that.

Ok, I see you have to manually apply the patched boot img. This is my first Pixel, came from a 6P where I just used twrp to install magisk. Guess we need to wait for a newer Magisk.
 

skaforey

Senior Member
Nov 5, 2009
569
364
San Diego, CA
Ok, I see you have to manually apply the patched boot img. This is my first Pixel, came from a 6P where I just used twrp to install magisk. Guess we need to wait for a newer Magisk.

Can you try flashing the patched boot.img? If you get into a bootloop, simply hold power and volume down to get back into bootloader mode and reflash the stock boot img
 

stevetrooper

Senior Member
Jul 6, 2010
218
82
Kansas
Can you try flashing the patched boot.img? If you get into a bootloop, simply hold power and volume down to get back into bootloader mode and reflash the stock boot img

My PC is at home, will have to try later tonight. I suspect that it will boot loop like yours, since the patched img is only 25 megs and the original was 40.
 

DaMadOne

Senior Member
May 30, 2010
383
258
I dont have my 2XL yet, but I grabbed the factory image and yanked the boot out of it then used Magisk Manager on my MXPE to patch the img. I've unpacked both images to compare them and it's definitely patching it and the patched one doesn't seem to be missing anything so I'm fairly certain the size difference is due to the patched image not being padded to the 40MB size of the boot partition. So probably not something to worry about.

It looks like my device will be here wednesday. If nobody else has cracked this case by then I'll start poking around. If anyone else is poking around and looking for ideas. I would start by unpacking and repacking the normal boot.img and flashing it just to make sure it boots. Assuming it does then modify the default.prop on the patched_boot.img to enable insecure adb during boot so that adb logcat can be run while it's booting and maybe get an idea of what's going on.
 

DaMadOne

Senior Member
May 30, 2010
383
258
The only problem I see with your process is patching it in another device will likely cause problems because it was patched using the wrong vendor image.

Oh yeah, I wouldn't try to flash what I made from another device. I mainly wanted to see what, if anything magisk manager would do with it. If someone wants to upload a patched_boot.img they made on their 2XL so I can look into it when I get home from work tomorrow that would be appreciated.

Maybe I'll get lucky and get mine tomorrow.
 

skaforey

Senior Member
Nov 5, 2009
569
364
San Diego, CA
update:
I mounted both the stock boot.img file and patched boot.img files and it does appear that changes are being made.
Here are the files that are different between the 2:
Code:
ramdisk/init

The patched boot img contains additional files that seem normal:
Code:
ramdisk/overlay/sbin/magisk (binary file)
ramdisk/overlay/init.magisk.rc

In addition, I found the backup of the main init file that was changed in ramdisk/.backup/init

Here are the contents of the init.magisk.rc file
Code:
# Triggers

on post-fs
    start logd
    start magisk_daemon
    wait /dev/.magisk.unblock 5
    rm /dev/.magisk.unblock
    start magisk_pfs
    wait /dev/.magisk.unblock 10

on post-fs-data
    load_persist_props
    rm /dev/.magisk.unblock
    start magisk_pfsd
    wait /dev/.magisk.unblock 10

# Services

# Self recoverable service
service magisk_daemon /sbin/magisk --daemon
    user root
    seclabel u:r:su:s0

# launch post-fs script
service magisk_pfs /sbin/magisk --post-fs
    user root
    seclabel u:r:su:s0
    oneshot

# launch post-fs-data script
service magisk_pfsd /sbin/magisk --post-fs-data
    user root
    seclabel u:r:su:s0
    oneshot

# launch late_start script
service magisk_service /sbin/magisk  --service
    class late_start
    user root
    seclabel u:r:su:s0
    oneshot
# STOCKSHA1=6d4d920f9d0b6eee52de8a95614a9884ef80d732

Not sure if this is useful to anyone, but maybe it will be.
One thing I noticed was the the . rc file contained references to /dev/.magisk and /sbin/magisk but I do not see those files in the patched boot img (only in the overlay folder, and maybe that's all that's needed, I don't know nearly enough about this to say for sure).
But, perhaps that's part of the problem?
 
Last edited:

davidcw6

Member
Feb 23, 2010
20
1
Could the title of this thread be changed? Very clearly not a guide or even a WIP.. It's a question/discussion on what might work to get Magisk working.
 

Top Liked Posts

Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone