LigeageOS regain root priviledges (New version)
This tutorial is made to especially to linux computers, but will work on other operating systems with little modifications to commands.I updated my LineageOS fajita (oneplus 6t) mircog phone and lost my magisk root. And I managed to regain my root without factoryresetting my phone thanks to guide in topjohnwu.github.io installation page and forum post from xda-developers [1]
Thanks for reddit user mashuptwice to notifying for that method not being recommended [2]
Here is a shorted quide how I did it:
Step 0 (Update):
Update your LineageOS phone. Most likely you have already done this.
Step 1 (Set up adb):
Set up `fastboot` on your computer. [3]
Step 2 (Install Magisk):
Install Magisk app from github [4] to your phone
Step 3 (Dowload you LineageOS zip):
Go to LineageOS download page and download your phone version of LineageOS [5]. I use mircog version of LineageOS so I downloaded it from microg's website [6]
Step 4 (Locate boot.img):
This was hardest part for me. First you need to unzip that zip what you downloaded in step 3. Then you have file named `payload.bin`. If you do not have that you are try redoing steps 3 and 4.
With pip download payload_dumper `pip install --user payload_dumper` [7][8]. And run command `payload_dumper payload.bin`
And then in sources you should see directory named `output`. In there is the `boot.img` file
Step 5 (Patch your boot.img file):
You have now located your boot.img file. Transfer it into your phone (Step 2 Magisk installed). Open Magisk app and press `Install` button left of `Magisk`. You should have only one option `Select and Patch a File`. Click it. Magisk opens file manager. Open (find and click) your `boot.img` file. Then press `LET'S GO`. It's done when Magisk says `All done`. Before quiting Magisk take note where Magisk saved that file. File name should be `magisk_patched-XXXXXXXX.img`
Step 6 (Transfer patched file to your computer):
Transfer `magisk_patched-XXXXXXXX.img` to your computer
Step 7 (Use fastboot):
Run command `fastboot flash boot /path/to/magisk_patched.img`. And when it's done reboot your phone.
Step 7 (Celebrate):
You have now successfully regaint root
Sources:
- https://topjohnwu.github.io/Magisk/install.html read 11.03.2022
- https://www.reddit.com/r/Magisk/comments/t851yw/help_magisk_gone_after_lineageos_update/hzlvecc/ read 11.03.2022
- https://wiki.archlinux.org/title/Adb read 11.03.2022
- https://github.com/topjohnwu/Magisk read 11.03.2022
- https://download.lineageos.org/# read 11.03.2022
- https://download.lineage.microg.org/ read 11.03.2022
- https://pypi.org/project/pip/ read 11.03.2022
- https://pypi.org/project/payload-dumper/ read 11.03.2022