FORUMS

[Guide]How to Root Your Pixel 3a and Install Magisk (on Pie & Q) with or without TWRP

860 posts
Thanks Meter: 440
 
By sic0048, Senior Member on 11th June 2019, 09:16 PM
Post Reply Email Thread
I'm assuming you understand how to use ADB on your computer. If you need assistance with installing or using ADB, please refer to this XDA article for more information. However, here are some common issues that people have with ADB if it doesn't work initially for you. 1) Check the Android System Notification that appears in your phone's notifications after you plug in your USB cord. Your phone probably defaults to "No data transfer" and you need to change it to "file transfer" to allow the phone to connect. 2) Make sure you have USB debugging turned on in the Settings/System (advanced)/Developer options. 3) If this is your first time using this phone/computer combination, you will have to accept the connection when it pops up on your phone.

You also need an unlocked bootloader to complete these steps. If you need assistance with unlocking your bootloader, here is decent set of instructions. Those instructions are based on the Pixel 3 phone, but the steps are the same for the 3a devices.

Here are the official Magisk installation instructions. I will walk through them to help everyone understand them. Please note that while TWRP does work with Android 9 (Pie), it does not work currently with Android 10. If you are still on Pie for some reason you can choose either installation option, but if you have moved to Android 10, you must use the "Boot Image Patching" installation method.

Custom Recovery Installation Method - (available for Android Version 9/Pie only because TWRP does not work currently with the Android 10)
This is the easier installation method IMHO, but it does require using TWRP. If you don't know how to get TWRP for the Pixel 3a, please refer to the official TWRP for Pixel 3a thread
Step 1 - Download and install the Magisk manager app on your phone. (link to the latest stable version can be found here).
Step 2 - Using the Magisk manager app, select "Install Magisk" and select the "Download Zip Only" option. This simply downloads the installation zip to your phone's download folder. It doesn't attempt to install anything.
Step 3 - Boot into TWRP - (because TWRP is not permanent on the stock Pie OS, we must follow these instructions each time we want to boot into TWRP).
Step 3a - Download the latest TWRP image for the 3a to your computer (not your phone) from the official TWRP for 3a thread.
Step 3b - Connect to your phone via ADB on your computer. You should see the device listed if you type the command "adb devices".
Step 3c - Boot your phone into the bootloader (type the command "adb reboot bootloader").
Step 3d - Boot into TWRP using this command, "fastboot boot twrp-3.x.x-x.img" (where "twrp-3.x.x-x.img" = whatever the name of the TWRP download is). Please note you are not using the "flash" command as we are not permanently installing TWRP.
Step 4 - Once the device boots into TWRP, select "Install" and then find the Magisk.zip download from step 2. Swipe to confirm the installation
Step 5 - After the installation is complete, simply reboot system.
Step 6 - Enjoy your rooted phone and install any Magisk modules that appeal to you
Step 7 - Be sure to turn off the "Automatic System Updates" setting found in Developer settings (Settings /System (advanced) /Developer Options). This will prevent the phone from automatically installing an OTA update and instead allow you to follow the steps listed under the "Taking an OTA Update" section below

The Boot Image Patching Installation method - (the only method currently available under Android 10, but it also works with Pie).
Use this method if you are on Android 10 or you are on Android 9/Pie but you don't want to or can't use TWRP.
Step 1 - Obtain a stock boot.img file for the OS version/update that you are currently on. The easiest method is probably to download the applicable full stock image directly from Google. Unzip the files and unzip the second folder and you should find the boot.img file inside.
Step 2 - Copy the stock boot.img file to your phone's storage - probably to /sdcard or to /sdcard/downloads
Step 3 - Download and install the Magisk manager app on your phone. (link to the latest version can be found here). At one time early in the Android 10 cycle, users had to use the "Canary" Magisk builds. This is no longer true and you can use the stable version builds as long as it is version 20 or later. Of course users are still able to use the beta or Canary builds if they desire, but it is no longer a requirement.
Step 4 - Using the Magisk manager app, press "Install --> Install --> Select and Patch a File" - select the stock boot.img file that you put on your phone in step 2.
Step 5 - Magisk will modify the stock boot.img file and create a patched boot image file. It will save this modified file at "sdcard/Download/magisk_patched.img"
Step 6 - Connect to your phone via ADB on your computer. You should see the device listed if you type the command "adb devices".
Step 7 - Copy the patched boot image from your device to your PC and the adb folder. If you can’t find the file on your phone via MTP or Windows Explorer, you can pull the file by typing the command "adb pull /sdcard/Download/magisk_patched.img" - Please note, I would suggest double checking the "file modified date" prior to moving the file. Be sure to only move the file if it was last modified on the date you are doing this. I've had a strange situation before where the newly modified file didn't immediately show up and the file showed a modified date of the previous month. If you flash an old version, your phone will bootloop.
Step 8 - Boot your phone into the bootloader (type the command "adb reboot bootloader").
Step 9 - Flash the patched boot image to your device using this command, "fastboot flash boot magisk_patched.img"
Step 10 - Reboot (using command "fastboot reboot").
Step 11 - Enjoy your rooted phone and install any Magisk modules that appeal to you
Step 12 - Be sure to turn off the "Automatic System Updates" setting found in Developer settings (Settings /System (advanced) /Developer Options). This will prevent the phone from automatically installing an OTA update and instead allow you to follow the steps listed next.......

Taking an OTA update in the future (if you used this method to install Magisk).
Taking OTA updates is very easy with the Pixel devices because of their A/B partition system. It allows us to uninstall Magisk, take the OTA update, and reinstall Magisk - all from the phone and all without rebooting during the process. Here are the offical Magisk OTA instructions. I will go through the steps to help explain them.

Step 1 - In the Magisk manager app: Click “Uninstall” then “restore images”. DO NOT REBOOT or press the reboot button.
Step 2 - Download and install OTA (in your phone's Settings/System/System Update). DO NOT REBOOT or press the reboot button.
Step 3 - Open the Magisk manager app and click “Install” next to Magisk (usually it says "Magisk is up to date") then “Install to second/inactive slot (After OTA)”
Step 4 - Press the Reboot button in Magisk.

That should be all it takes to install an OTA and keep root.

Please note, we are getting reports that users are getting notifications that an OTA update has been installed even when they have "Automatic Updates" turned off. If this happens to you, don't reboot the phone which is suppose to be the final step in the update process. Instead, follow the above instructions on taking an OTA update, but start in step 3. In other words, you shouldn't have to uninstall Magisk because the update has already been installed. All you need to do is install Magisk to the "second/inactive slot (After OTA)”. After completing that step, you can reboot your phone to complete the update process. Be sure to post your experiences in this thread to let us know if this process works or not.

Just remember that many custom parts (like kernels and Magisk modules) may need to be updated to any new OTA version. Please be sure to check out the forums for each custom kernel or module that you may want to install to ensure it has been updated to the lastest OS version. Don't assume anything or you may find yourself in a bootloop.

If the normal OTA method isn't working - sideload the OTA update
Taking an OTA update should be as easy as the above instructions. However there is another option available to install an OTA update called sideloading. Sometimes the update doesn't appear on the phone in a timely manner and you may want to manually install the update. Other times the OTA update seems to fail for some reason. In the end, you may decide to sideload the OTA instead of trying get it via the update feature on the phone. Surprisingly, it's actually faster to install the update via sideloading than it will be to take the OTA normally. I'll walk through the sideloading steps.....

Optional Step 1 - Uninstall Magisk (so that it restores the stock boot.img). If you find yourself unable to boot into recovery, you will have to restore the stock boot.img. I've run into this issue on some Android 10 images, but not all.
Step 2 - Download to your computer the correct OTA image from here
Step 3 - Connect to your phone via ADB on your computer. You should see the device listed if you type the command "adb devices".
Step 4 - Boot your phone into recovery (type the command "adb reboot recovery").
Step 5 - The phone will have a green android robot with a red sign over it's open access panel. Press the power button and then the volume up button while still holding down the power button.
Step 6 - Select "Apply update from ADB" using the volume buttons to highlight the choice and the power button to select it to enter the sideload mode.
Step 7 - Using your computer, type "adb sideload ota_file.zip" where ota_file.zip is the name of the OTA file you downloaded in step 2.
Step 8 - Once the update finishes, reboot the phone to complete the update process. (See note below about initial boot times).
Step 9 - To obtain root again, please use one of the two root methods listed above

Please note, the initial boot may take quite a while. I've seen the process take upwards of 20 minutes and longer. I think part of the reason it can take so long is that it optimizes the apps during this boot process. The more apps you have, the longer the process may take. With an OTA update, the phone will change to a screen where is specifically tells you it is optimizing the apps and counts up as the apps are optimized to give you status updates. With the side-load process, it all happens with just the regular boot animation running and without any status updates. Because of this, it is easy to assume something has gone wrong with the boot process while in fact the phone is working through the process normally. If it isn't boot looping (showing the initial power screen before moving back to the boot animation), everything is fine and you just be patient and let the phone complete the process.

My rant about using these "Pre-patched Boot image" files
I started this thread during a period of time where there was a another thread on this forum started by pbanj that showed users how to root their phone by using some pre-patched boot image files. This method is not the generally accepted method and while it works, there are major shortcomings with it (see explanation below). Because it was the only root thread available at the time and he only showed the "pre-patched boot image" method, many people blindly followed his directions only to be confused when it came time to update the software on their phones. I wrote this thread in an effort to show people the official Magisk installation method. Pbanj has since updated his thread and it now includes the preferred method as well. With his edits, the two threads are sharing the same information now, although Pbanj thread still offers people the "pre-patched boot image" method (which I don't recommend people using).

EDIT - Yet another thread pushing a pre-patched root method has been started. It suffers the same issues as listed below.

Shortcomings with using the "pre-patched boot image" method.
As I already mentioned, there is a huge shortcoming with using the "pre-patched boot image" method described in the other root thread. Because he provides a pre-patched boot.img file, you skip some normal installation steps. In the end you have the exact same patched file (which is why his method works), but you cripple the system when it comes to taking any future OTA. That's because the first step in taking an OTA update is having Magisk reflash the stock boot.img effectively uninstalling itself. This step fails if you used his pre-patched boot image method because you skip the step where Magisk creates the backup of the stock boot.img that it needs to uninstall itself.

I already used the "pre-patched boot image" method to gain root. What can I do?
First, let me clarify and say that there is nothing wrong with your phone or root privileges. Your phone will work exactly as expected and root and Magisk will work exactly as expected. That being said, in the near future you will want to update your phone to the latest Android update and this is where the "pre-patched boot image" method is much more cumbersome. The best option is to simply undo his root method and re-root using the method described above. To do this, flash the correct stock boot.img file to your boot partition and then follow the steps above to reinstall Magisk. Jbanj has confirmed this method will work. The other option is just wait until you need to take an update and then sideload the OTA update following the instructions above. This will remove root and you can then follow one of the two methods to obtain root as outlined in this thread.

Notes
- Please be sure you are on the latest adb and drivers which can be found here.
- You do not need to keep the stock boot.img file (from step 2 of the Boot Image Patching method) on your phone after completing these steps. Magisk saves the stock boot.img backup at /root/data in a file with the name "stock_boot_XXXXXXXXXXXX.img.gz"

Thanks to.......
@ZVNexus for getting TWRP working on the 3a and 3a XL phones
@topjohnwu for making Magisk what it is today
The Following 34 Users Say Thank You to sic0048 For This Useful Post: [ View ] Gift sic0048 Ad-Free
11th June 2019, 10:16 PM |#2  
Junior Member
Thanks Meter: 0
 
More
Made it to step 7/8, went to reboot, and entered bootloop. Not sure exactly what happened, gonna fix this and give it another go.

EDIT: Should I be flashing in fastboot or recovery mode?

EDIT 2: Working! Thanks!
11th June 2019, 10:22 PM |#3  
jmtjr278's Avatar
Senior Member
Thanks Meter: 570
 
More
You know there are more ways to skin a cat, right? This is another method to acquire root. I don't think you need to bash the work that pbanj has done. He provides modified boot.img and also offers help on getting it working. I think acting like your method is the only acceptable way to gain root is extremely pompous and arrogant.

Sent from my Pixel 3a using Tapatalk
The Following 2 Users Say Thank You to jmtjr278 For This Useful Post: [ View ] Gift jmtjr278 Ad-Free
12th June 2019, 12:25 AM |#4  
OP Senior Member
Thanks Meter: 440
 
More
Quote:
Originally Posted by jmtjr278

You know there are more ways to skin a cat, right? This is another method to acquire root. I don't think you need to bash the work that pbanj has done. He provides modified boot.img and also offers help on getting it working. I think acting like your method is the only acceptable way to gain root is extremely pompous and arrogant.

Sent from my Pixel 3a using Tapatalk

I don't think that this method is the only way to get root, nor is this "my method". It is however the method spelled out by the Magisk developers and it is the only method that uses Magisk strengths when trying to take an OTA update.. I'll simply leave it at that......
The Following 3 Users Say Thank You to sic0048 For This Useful Post: [ View ] Gift sic0048 Ad-Free
12th June 2019, 12:42 AM |#5  
jmtjr278's Avatar
Senior Member
Thanks Meter: 570
 
More
Quote:
Originally Posted by sic0048

I don't think that this method is the only way to get root, nor is this "my method". It is however the method spelled out by the Magisk developers and it is the only method that uses Magisk strengths when trying to take an OTA update.. I'll simply leave it at that......

Sure. It's the way I do it also. But show some class and don't call out other, helpful members in this fashion and crap all over what they do. I have seen your posts and know your a helpful members also, let's respect each other and be classy.

Sent from my Pixel 3a using Tapatalk
The Following 2 Users Say Thank You to jmtjr278 For This Useful Post: [ View ] Gift jmtjr278 Ad-Free
12th June 2019, 01:03 AM |#6  
alliance1975's Avatar
Senior Member
Flag Alliance College
Thanks Meter: 106
 
More
@sic0048
Thank you. I got to admit it was pretty tense for a while. Thanks to you I made it. Had to do a sideload, had to do some stupid things but I made it. Now, I got through all the steps and I have two items; Having done this transition can I now do the magisk-uninstall-restore images for all future OTAs and is step 9 performing the magisk install process a second time?
12th June 2019, 01:13 AM |#7  
OP Senior Member
Thanks Meter: 440
 
More
Quote:
Originally Posted by Bankuu

Made it to step 7/8, went to reboot, and entered bootloop. Not sure exactly what happened, gonna fix this and give it another go.

EDIT: Should I be flashing in fastboot or recovery mode?

EDIT 2: Working! Thanks!

I've edited the steps and added a few more going into greater detail to try and make it even clearer for users. Let me know if you have any suggestions.
The Following 3 Users Say Thank You to sic0048 For This Useful Post: [ View ] Gift sic0048 Ad-Free
12th June 2019, 01:30 AM |#8  
OP Senior Member
Thanks Meter: 440
 
More
Quote:
Originally Posted by alliance1975

@sic0048
Thank you. I got to admit it was pretty tense for a while. Thanks to you I made it. Had to do a sideload, had to do some stupid things but I made it. Now, I got through all the steps and I have two items; Having done this transition can I now do the magisk-uninstall-restore images for all future OTAs and is step 9 performing the magisk install process a second time?

You should be able to use the normal Magisk OTA update instructions for future updates.

I've updated the thread and I think the "step 9" you listed isn't the same anymore, but I think I understand your question. Actually I think my original instructions were inaccurate as far as that step. I've always gone back into Magisk after flashing the modified boot.img and I thought I hit install to install the Magisk framework (if that is the correct term). But after reading some other guides, I think my memory is incorrect and you don't really have to install anything after the flashing portion of the steps.

Once you reboot after flashing, that should be all you have to do. I'll uninstall Magisk here in a while and walk through the steps myself to ensure this is correct howeve.
The Following 2 Users Say Thank You to sic0048 For This Useful Post: [ View ] Gift sic0048 Ad-Free
12th June 2019, 01:40 AM |#9  
alliance1975's Avatar
Senior Member
Flag Alliance College
Thanks Meter: 106
 
More
The OP should be made a sticky.
12th June 2019, 03:02 AM |#10  
MPAI's Avatar
Senior Member
Flag Mumbai
Thanks Meter: 57
 
More
Cool guide. Can the method be applied to Q beta 4 ?
12th June 2019, 03:33 AM |#11  
jmtjr278's Avatar
Senior Member
Thanks Meter: 570
 
More
Quote:
Originally Posted by MPAI

Cool guide. Can the method be applied to Q beta 4 ?

No root for Android q on our devices yet afaik.

Sent from my Pixel 3a using Tapatalk
The Following 2 Users Say Thank You to jmtjr278 For This Useful Post: [ View ] Gift jmtjr278 Ad-Free
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes