Jump to content

Magisk Install - Step by Step [ROOT]


Recommended Posts

  • Replies 217
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

The typical installation method as described on XDA won't work yet on Pro1, because we don't have a fully working version of TWRP yet.  But never fear, it's still easy, five simple steps and you

For those getting their devices and wanting to root now, the recommended procedure has changed!     This method should allow you to take future OTA updates keeping root using the A/B method link

If someone need - i upload to google drive stock versions of  boot.img, backuped by Magisk from all versions i had:  - 20191028 - 20191111 - 20191129 - 20191210 - 20200106

Posted Images

38 minutes ago, david said:

I added this to my post above, but I'm duplicating it here in case anyone missed it because it is important.  If you don't follow the steps properly the first time you root, you won't be able to do what I documented above (which has also been documented elsewhere on the forums by other people, but for people reading this topic, and not seeing the others, it is good to have it here as well).

...

NOTE:  You have to originally achieve root in the proper way for this method to work.  And that proper way is for Magisk Manager to be given a non-patched boot image file that is identical to the one you are currently using.  It will make a backup of that file (for later use in the OTA process) and will also create a patched version of that file.  You then copy that patched file to your PC and use fastboot to flash it.  (https://android.gadgethacks.com/how-to/make-ota-updates-easy-by-rooting-your-pixel-3-with-magisks-boot-image-patch-0189139/)

If you don't go through the proper steps to acquire root with Magisk Manager, then you won't be able to use the Magisk Manager features to survive the next OTA update.  (Technically there is a way to hack it and give Magisk Manager a backup boot image that it didn't backup itself, but I haven't tried that.)

If anyone is in a phone state where they don't have root and have the 20200304 firmware on their phone, and they want to root it, let me know and I can upload the boot image for the 20200304 firmware so that you can have Magisk Manager patch it, etc.

Yeah, I think I finally can see the end to end steps and thus will think about rooting this week-end.  Since I don't see the boot.img file in the zip (I updated manually), I'd ppreciate the file.  Or tell me how to extract it.  BTW, are we sure the boot.img changed from January?

And, @EskeRahn really confused me, moving all this in the middle of my composing this post... 😉

  • Like 1
  • Haha 1
Link to post
Share on other sites
6 minutes ago, david said:

Thanks!  I put a pointer post in the other thread for people over there to follow back here if they are dealing with root issues.

OK, then we got two pointers... 😇🤣

  • Like 1
Link to post
Share on other sites
Just now, EskeRahn said:

OK, then we got two pointers... 😇🤣

I didn't see that you had a pointer over there.  I still don't see one by you. :-)

  • Haha 1
Link to post
Share on other sites
1 minute ago, Hook said:

Yeah, I think I finally can see the end to end steps and thus will think about rooting this week-end.  Since I don't see the boot.img file in the zip (I updated manually), I'd ppreciate the file.  Or tell me how to extract it.  BTW, are we sure the boot.img changed from January?

See a few posts prior to this for the link. 

The OTA format is different than a regular factory image format.  I've never messed with trying to do conversions, but I believe others documented this earlier in this topic.

No idea if anything in the boot image changed.  I guess, in theory, someone could use an old image and cross their fingers. :-)

Link to post
Share on other sites
6 minutes ago, david said:

No idea if anything in the boot image changed.  I guess, in theory, someone could use an old image and cross their fingers. :-)

I just compared the 20200106 boot image file to the 20200304 file with a hex compare tool and they are different.

  • Like 1
Link to post
Share on other sites
1 hour ago, david said:

Question on this.  Are you saying this is because there is no normal OTA process for LineageOS, so every time you update LineageOS, you'll lose root anyway, and have to re-flash magisk?

Yes.   The lineage install process is to use fastboot to flash lineage recovery to boot on one slot, then use lineage recovery to install lineageos then optionally a Google Apps package (mindthegapps or opengapps) and/or a root solution (lineage addon su or magisk) on the other slot.

When Lineage for our device leaves the test stage and becomes official, then we start getting official otas, and I'm pretty sure root persists then, if not magisk, certainly addon_su, but not sure until it happens.

 

Edited by Craig
  • Thanks 1
Link to post
Share on other sites
1 minute ago, Craig said:

Yes.   The lineage install process is install lineageos recovery, then use lineageos recovery to install lineage, gapps, root, etc.

When we do go official and start getting official otas, pretty sure root persists then, if not magisk, certainly addon_su, but not sure until it happens.

 

Do you know if there is a way in LineageOS, if you are using the built in root option, to disable that root without booting into LineageOS?  In other words, some way to disable it in LineageOS's recovery?

I ask this, because a person might have an app that has super user privileges and it causing the phone to not boot into the OS.  With Magisk, there is a Magisk Core method to still allow Magisk to run and to disable all Magisk modules.  I've never done it, and it looks like a pain, but at least it is possible to do.

Or maybe with a built in switch in settings, a person could boot into safe mode and just turn off root there and then boot normally and uninstall the bad app?

I guess Magisk is still needed, even if there is a built in root in LineageOS, if someone wants to run EdXposed, since that runs as a Magisk Module.  If so, then the Magisk Core method is still probably needed if someone gets stuck with a bad rooted module (like EdXposed hook drivers).

So if Magisk is still needed for anyone wanting to run EdXposed (which I know @tdm doesn't like :-)), then there is still a question of whether root through Magisk can coexist with LineageOS OTAs.

I just looked online and found this.  It makes it sound like they (LineageOS OTAs and Magisk) don't coexist currently:

https://github.com/topjohnwu/Magisk/issues/1500

Link to post
Share on other sites
1 hour ago, david said:

Do you know if there is a way in LineageOS, if you are using the built in root option, to disable that root without booting into LineageOS?  In other words, some way to disable it in LineageOS's recovery?

The built-in root option only allows root from adb shell.  It doesn't give apps root permission.  To give apps permission (and get on device root shell) requires an add-on to be flashed from recovery. To get rid of it, you flash the remover from recovery.  They're both available from the official lineage extras download page: https://download.lineageos.org/extras

I suspect based on what you linked, you're right that to use Magisk with lineage ota updates one will still have to re-flash magisk after every update, or decrypt data for long term workaround.   I suspect the lineage add-on will persist thru lineage otas, but unconfirmed...

Edited by Craig
  • Thanks 2
Link to post
Share on other sites
5 hours ago, Craig said:

As to the quoted question, the built in option only allows root from adb shell.  It doesn't give apps root permission.  For that requires the add on, which is flashed from recovery. To get rid of it, you flash the undo from recovery.  They're both on the lineage extras download page: https://download.lineageos.org/extras

Thanks.  I haven't used LineageOS, only an older Cyanogenmod, and it didn't have the built in root option, so I didn't realize it didn't give apps root permission.  Nice that it can be flashed and undone from recovery though.

Quote

I suspect based on what you linked, you're right that one will have to re-flash magisk after lineage OTAs, or decrypt data for long term workaround.

I originally thought I would decrypt my /data partition (or at least try to do that), but I feel it is too risky.  Not because of security risks, but because if I slip up and reboot when I'm temporarily unrooted, or if the system restarts itself without my blessing when I'm temporarily unrooted, or I get in a boot loop and have to disable root, then it will re-encrypt it and I'll lose all my data.

I don't have a big problem with having to reflash Magisk after LineageOS OTAs though.  It is more work than the current stock method of retaining root during the OTA process, but it is easier than the hoops to jump through to patch a boot image in stock initially.

Edited by david
Link to post
Share on other sites
On 2/1/2020 at 5:07 PM, J_P said:

Finally got Magisk installed properly.

The issue was that I had an SD card in the phone, and Magisk manager automatically installed to the SD card which makes it not work.

Hopefully this info saves someone else some trouble.

THANK YOU

Link to post
Share on other sites

I was going to flash latest LOS image but tdm's repo seems to be down. So I decided to give a try to Magisk instead. Easy install with adb sideload, and seems that it works. Tested all my apps that didn't work due to 'rooted device', and all of them seem to work now. Magisk's safetynet test gives ctsProfile failure, is this something I have failed or is it related to SELinux state in LOS for example?

 

Screenshot_20200312-152203_Magisk_Manager.png

Link to post
Share on other sites

I am going to root stock using Magisk in order to do a Titanium Backup before moving to LOS.  Sorry for being pedantic—I did do this once before—and, since I expect to go to LOS almost immediately, I don't really need to care about being able to unroot for an OTA. However, since I am putting together several sources in this thread, I want to make sure I have sorted things out correctly. I'm pretty sure I have but I really need things to be explicit.  So here is what I plan to do.  Confirmations and corrections both appreciated.

1) Install Magisk Manager (I have downloaded the most recent, version 7.5.1)

2) Open Magisk Manager and patch boot image:

     a) Tap Install.  When pop-up shows tap "Install" again

     b) Select "Patch boot image file"

     c) Browse to boot image file location (I have the boot image file David supplied for  the 20200304 update which I applied.  It is located in the Download folder on my phone)

     d) Select file.  When MM is done patching file, tap close.

3) Copy patched boot.img  file to folder on PC with ADB and fashboot tools.

4) Flash patched boot.img to phone.

     a) Type "ADB devices" to confirm connection

     b) Type "ADB reboot bootloader" to, well, reboot to bootloader on phone. 😉 (I told you I was pedantic)

     c) Type "fastboot flash boot magisk_patched.img"

     d) Finally, type "fastboot reboot"

5) Open Magisk Manager on phone to verify root status.

 

Does that seem about right?  It is mostly a little more filled in version of the first post, but noobs take nothing for granted.  😄 Thanks in advance.

 

 

Link to post
Share on other sites
1 hour ago, Hook said:

I am going to root stock using Magisk in order to do a Titanium Backup before moving to LOS.  Sorry for being pedantic—I did do this once before—and, since I expect to go to LOS almost immediately, I don't really need to care about being able to unroot for an OTA. However, since I am putting together several sources in this thread, I want to make sure I have sorted things out correctly. I'm pretty sure I have but I really need things to be explicit.  So here is what I plan to do.  Confirmations and corrections both appreciated.

1) Install Magisk Manager (I have downloaded the most recent, version 7.5.1)

2) Open Magisk Manager and patch boot image:

     a) Tap Install.  When pop-up shows tap "Install" again

     b) Select "Patch boot image file"

     c) Browse to boot image file location (I have the boot image file David supplied for  the 20200304 update which I applied.  It is located in the Download folder on my phone)

     d) Select file.  When MM is done patching file, tap close.

3) Copy patched boot.img  file to folder on PC with ADB and fashboot tools.

4) Flash patched boot.img to phone.

     a) Type "ADB devices" to confirm connection

     b) Type "ADB reboot bootloader" to, well, reboot to bootloader on phone. 😉 (I told you I was pedantic)

     c) Type "fastboot flash boot magisk_patched.img"

     d) Finally, type "fastboot reboot"

5) Open Magisk Manager on phone to verify root status.

 

Does that seem about right?  It is mostly a little more filled in version of the first post, but noobs take nothing for granted.  😄 Thanks in advance.

 

 

Sounds right to me.  The only thing I would add is that Titanium Backup doesn't work on new apps that use split APKs.  Swift Backup might work for those.

And if you have any media, you would want to copy off that too.

If your backups go to the internal storage, you'll want to copy them off.  Swift Backup states that it will wipe backups on the SD card too, if you uninstall it.  No idea what happens if you reinstall SB in LOS and it finds a backup on the SD card, so copying off is a good idea there too.

 

  • Thanks 1
Link to post
Share on other sites
40 minutes ago, david said:

Sounds right to me.  The only thing I would add is that Titanium Backup doesn't work on new apps that use split APKs.  Swift Backup might work for those.

And if you have any media, you would want to copy off that too.

If your backups go to the internal storage, you'll want to copy them off.  Swift Backup states that it will wipe backups on the SD card too, if you uninstall it.  No idea what happens if you reinstall SB in LOS and it finds a backup on the SD card, so copying off is a good idea there too.

 

Split apks?  What is that?

I always back up Titanium to SD card and cloud, And, yes, I do know that going to LOS will wipe userdata.

Not familiar with Swift backup, but don't like the sound of a program wiping *my* data when you uninstall it.

Edited by Hook
Link to post
Share on other sites
1 hour ago, Hook said:

Split apks?  What is that?

Short answer is that it is a new modular way to package and deploy apps.  You might hear it referred to as app bundles too.  

Longer answer:  https://medium.com/google-developer-experts/exploring-the-android-app-bundle-ca16846fa3d7

For whatever reason, Titanium Backup doesn't seem to be actively supported, at least not in a meaningful way, or else they would have added support for this new format quite a while ago.  You might be able to re-install the app from the Play Store and then restore the data from Titanium Backup, even if Titanium Backup can't restore the app itself.

1 hour ago, Hook said:

I always back up Titanium to SD card and cloud, And, yes, I do know that going to LOS will wipe userdata.

Not familiar with Swift backup, but don't like the sound of a program wiping *my* data when you uninstall it.

Yeah, I don't like it either, but writing the backup to the SD card is a experimental feature that you have to enable in the app.  Apparently it uses APIs that encapsulate that functionality (of wiping the app's data, of which the backups are considered) if you uninstall the app.  I have it installed and I have AppWereRabbit installed (for backing up app data), and I ran TB, SB, and AWR before the last OTA, just to be on the safe side.  I haven't played around with doing a lot of testing on SB or AWR.

Also, if you use things like WhatsApp or Viber, you'll want to manually back-up the media files.  Viber doesn't include those at all in its backup and WhatsApp appears to have a limit on how far back it will restore with its built in google cloud backup option.

  • Like 1
Link to post
Share on other sites
12 minutes ago, david said:

Short answer is that it is a new modular way to package and deploy apps.  You might hear it referred to as app bundles too.  

Longer answer:  https://medium.com/google-developer-experts/exploring-the-android-app-bundle-ca16846fa3d7

For whatever reason, Titanium Backup doesn't seem to be actively supported, at least not in a meaningful way, or else they would have added support for this new format quite a while ago.  You might be able to re-install the app from the Play Store and then restore the data from Titanium Backup, even if Titanium Backup can't restore the app itself.

Yeah, I don't like it either, but writing the backup to the SD card is a experimental feature that you have to enable in the app.  Apparently it uses APIs that encapsulate that functionality (of wiping the app's data, of which the backups are considered) if you uninstall the app.  I have it installed and I have AppWereRabbit installed (for backing up app data), and I ran TB, SB, and AWR before the last OTA, just to be on the safe side.  I haven't played around with doing a lot of testing on SB or AWR.

Also, if you use things like WhatsApp or Viber, you'll want to manually back-up the media files.  Viber doesn't include those at all in its backup and WhatsApp appears to have a limit on how far back it will restore with its built in google cloud backup option.

Thanks for the heads up. Over my head and looks suspiciously like Google doing the M$ thing of making it harder and harder of letting users have control. May be inevitable eventually, but I have mostly old apps and TB has never let me down.  Don't so Whatsapp or Viber, but I know that backup doesn't do media for apps. If I run into problems with TB, I'll look at Swift.

Link to post
Share on other sites
3 hours ago, Hook said:

Thanks for the heads up. Over my head and looks suspiciously like Google doing the M$ thing of making it harder and harder of letting users have control. May be inevitable eventually, but I have mostly old apps and TB has never let me down.  Don't so Whatsapp or Viber, but I know that backup doesn't do media for apps. If I run into problems with TB, I'll look at Swift.

I had mostly old apps too, but I was forced to upgrade WhatsApp on the old phone and I did upgrade Viber to try to get notifications to work (which they did not).  I don't know why some of the other apps were of the newer variety.  They might have been more recently installed.  When you have hundreds of apps and the restore program hangs when it hits one, it is a pain in the @ss to do a batch restore.  It took me hours to restore my apps to the Pro1 from my old phone.  Of course, part of that was that I didn't get smart until near the end of the process and started filtering out restoring the apps that it had already restored.  :-/

Other than that issue, it had only hung on a restore of an app in a blue moon in the past when I used it for batch restores.  I didn't have to do batch restores much in the past, because I'd use nandroid backups and restores when changing from one old phone to the next, when the previous would stop working.

I did have some apps where notifications didn't work properly when restored with TB.  I don't *think* that was just because it was an older version of the app running on newer android.  I think something just didn't work right when it was restored for some reason.  Uninstalling them, installing them from the play store, and then restoring just data from TB to the apps got around that issue.

The problem with going from Pro1 to Pro1 (Stock to LOS) is that once you go to LOS, you'll have lost the ability to do another backup with another app, since your /data partition will be wiped.  That's the only reason I mention doubling up on backup apps.  You won't find out you have a problem until you go to restore.  However, I don't believe I had any *data* restore issues, other than the media issues, which had nothing to do with TB, since it doesn't back up that (or at least I don't have it set to back up that even if it does do it).   So if you do have problems restoring apps with TB, you can exclude them from the batch restore and then go back later to manually install and then restore the data from TB.

I'll also add that Swift Backup is very intuitive and it is difficult to tell what the various options mean/do. 

Good luck and let us know how the transition from stock to LOS goes. :-)

  • Like 1
Link to post
Share on other sites
1 hour ago, rtuz2th said:

I rooted my Pro1 following this guide, thank you very much for sharing. Currently I'm on 20200106, stock with magisk. Has anyone figured out the best way to install the new OTA without losing root or having to redo my whole setup?

See this: https://community.fxtec.com/topic/2537-magisk-install-step-by-step-root/?do=findComment&comment=46379

 

And this: https://community.fxtec.com/topic/2537-magisk-install-step-by-step-root/?do=findComment&comment=46403

 

  • Like 1
  • Thanks 1
Link to post
Share on other sites

My instructions (to myself) worked perfectly.  Titanium Backup even found the backup folder it used before on my SD card the last time I was rooted.  Will do a backup to the cloud and play around a bit, and work on data backups (personal files) getting ready for the LOS wipe.  Thanks all, especially @david

  • Like 2
Link to post
Share on other sites
3 hours ago, rtuz2th said:

Thank you so much! I'll try and report back! 🙂

Okay. After uninstalling Magisk (no, i did not reboot) my phone froze, shut down and now gives me the little android robot saying 'no command'. Yiha, this will be one night of trying to revive my pro1.

  • Sad 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Terms