• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[Guide]How to Root Your Pixel 3a and Install Magisk - Android 9 - 12

Search This thread

Completely_Clueless

Senior Member
Dec 21, 2011
56
15
Does anyone know how to fix a "Stock backup does not exist" message from Magisk? I followed the instructions in the OP to update to Android 11 but when I clicked Restore Images that popped up. Worse case I'll do a full uninstall of Magisk, take the OTA update, then reinstall Magisk and root Android 11.

Any help would be appreciated.
I just upgraded from Android 10 to Android 11 yesterday (using the factory image, not the OTA image). At the start of the process, I went to uninstall Magisk and received the same error about stock images not existing. I just selected the option to do a full uninstall, then rebooted, and everything was fine.
 
  • Like
Reactions: Vinotas

Vinotas

Senior Member
Jan 5, 2012
112
21
I just upgraded from Android 10 to Android 11 yesterday (using the factory image, not the OTA image). At the start of the process, I went to uninstall Magisk and received the same error about stock images not existing. I just selected the option to do a full uninstall, then rebooted, and everything was fine.

Thanks!

Just to be sure, what order was that in? Did you reboot after uninstalling Magisk, flash the update, then reinstall Magisk and root as per OP instructions? I just want to make sure I don't brick/bootloop the phone as it's my main work phone and I really do love it.
 

Completely_Clueless

Senior Member
Dec 21, 2011
56
15
Thanks!

Just to be sure, what order was that in? Did you reboot after uninstalling Magisk, flash the update, then reinstall Magisk and root as per OP instructions? I just want to make sure I don't brick/bootloop the phone as it's my main work phone and I really do love it.
The process I followed went like this:
  1. Uninstalled Magisk completely.
  2. Took the OTA update from inside the Android OS itself (i.e. not a sideload). I had to download and install multiple updates to reach the December 2020 build (RQ1A.201205.003).
  3. Created the patched boot image and flashed it to install Magisk
Now, at this point, I actually ended up with a bootloop. After some fretting, I realized why: I didn't set the Magisk Manager Update to the "Beta" channel! So, I actually patched the boot image for Magisk v20, which doesn't support Android 11!

So, don't make the same mistake I made! Ensure that, before you patch the boot image, you set the Update Channel to "Beta" in the Magisk Manager app settings! This will set the latest version to 21.1, which which change the way the boot image is patched. You can verify this by looking at the "Install" screen of Magisk Manager, under the "Method" block; you should see v21.1, and not v20.4. Also, Magisk Manager should output a sargo (Pixel 3a) "magisk_patched.img" that's about 64 MB in size. If it outputs "magisk_patched.img" that's about 32 MB in size, you used the wrong version, and will get a boot loop! (Again, I saw this the hard way!)

I eventually fixed my problem by flashing the factory image (without using the -w argument), and then redoing the rooting procedure after changing the Update Channel to "Beta." Now everything is working fine.
 

Vinotas

Senior Member
Jan 5, 2012
112
21
The process I followed went like this:
  1. Uninstalled Magisk completely.
  2. Took the OTA update from inside the Android OS itself (i.e. not a sideload). I had to download and install multiple updates to reach the December 2020 build (RQ1A.201205.003).
  3. Created the patched boot image and flashed it to install Magisk
Now, at this point, I actually ended up with a bootloop. After some fretting, I realized why: I didn't set the Magisk Manager Update to the "Beta" channel! So, I actually patched the boot image for Magisk v20, which doesn't support Android 11!

So, don't make the same mistake I made! Ensure that, before you patch the boot image, you set the Update Channel to "Beta" in the Magisk Manager app settings! This will set the latest version to 21.1, which which change the way the boot image is patched. You can verify this by looking at the "Install" screen of Magisk Manager, under the "Method" block; you should see v21.1, and not v20.4. Also, Magisk Manager should output a sargo (Pixel 3a) "magisk_patched.img" that's about 64 MB in size. If it outputs "magisk_patched.img" that's about 32 MB in size, you used the wrong version, and will get a boot loop! (Again, I saw this the hard way!)

I eventually fixed my problem by flashing the factory image (without using the -w argument), and then redoing the rooting procedure after changing the Update Channel to "Beta." Now everything is working fine.

I followed the same procedure, uninstalled Magisk, took the Android 11 OTA update, installed Magisk Manager, made sure I was on Beta Channel, then hooked up the phone to the computer and used ADB to flash the patched Sargo image (the 67.1mb one), then rebooted, but now my phone is stuck in Fastboot Mode. ADB doesn't recognize any devices attached to the computer either now. I can try to reboot into recovery but I get the little Android robot lying down with his stomach open and a red exclamation mark, all it says is No Command.

Curious what I did wrong and how to fix this?
 

Completely_Clueless

Senior Member
Dec 21, 2011
56
15
I followed the same procedure, uninstalled Magisk, took the Android 11 OTA update, installed Magisk Manager, made sure I was on Beta Channel, then hooked up the phone to the computer and used ADB to flash the patched Sargo image (the 67.1mb one), then rebooted, but now my phone is stuck in Fastboot Mode. ADB doesn't recognize any devices attached to the computer either now. I can try to reboot into recovery but I get the little Android robot lying down with his stomach open and a red exclamation mark, all it says is No Command.

Curious what I did wrong and how to fix this?
How do you know you're stuck in fastboot mode? What happens if you try to boot normally? The phone just doesn't boot at all? No "G" logo?

I'm not an expert at this, but maybe I can make a few guesses. Did you restart after you uninstalled Magisk? Perhaps the phone needed to boot from the stock image once before taking the OTA update. At least, that's what I did: uninstalled Magisk (completely), then restarted the phone to the home screen, then took the Android 11 upgrade, then restarted again to the home screen, then restarted into the bootloader, and finally flashed the patched boot image. I'm pretty liberal with restarting my phone when it comes to installing/uninstalling/modifying low-level files. Again, I'm not at all sure if this would make the difference.

What version of Magisk Manager did you use? Did you download the correct factory image to extract "boot.img" from? If you're installing the latest December 2020 build, the ZIP file should have the following SHA-256 hash:

f23d156401ef9b18cb2d034394ee821badefc7fb5b05129d6ed3318043e77ca6

In any case, since you at least have fastboot, I'd just flash the factory image using "flash-all.bat," and then follow the normal procedure to get root back. Make sure to remove the -w argument from the batch script if you want to keep your data! That's how I escaped my bootloop, and I think it should work in your case too.
 
  • Like
Reactions: Vinotas

Vinotas

Senior Member
Jan 5, 2012
112
21
That was my thought too, but I have never flashed a factory image before so want to make sure I do it correctly, and I would definitely prefer not wiping my data.

I should add that I used the patched image linked above, but I took an OTA update. I wonder if that was the difference? There do seem to be 2 different sites, one for factory images and one for OTA images. So perhaps I took a factory patch and applied it to a system that had an OTA update? Would that cause an issue?

Thanks so much for your assistance BTW, really appreciated. I love this phone and would hate to brick it. So I downloaded the factory image, unzipped it, removed the -w, clicked flash-all and it came back to life. Now I am getting an odd error when I try to flash the patched image, it says:

unknown partition 'magisk_patched.img'
fastboot: error: cannot determine image filename for 'magisk_patched.img'

What did I do wrong?
 
Last edited:

Completely_Clueless

Senior Member
Dec 21, 2011
56
15
Glad to hear that you got your phone back to life 🙂.

There are basically three methods to updating Android on the Pixel 3a (and perhaps other Google devices):
  1. Use the OTA from Android itself (the "normal" method, where Android downloads the OTA for you and prompts you to restart your phone to install it)
  2. Use the OTA image (the sideload method)
  3. Use the factory image
Note that the OTA image and factory image are not the same thing! You're correct; there are two different sites: one for the OTA images and one for the factory images! I have the sites bookmarked and names so that I don't get them mixed up. Magisk Manager needs to patch "boot.img" from the factory image, and it has to be the same build as the OTA you're on. As of December 2020, that's build RQ1A.201205.003, Dec 2020. If you open the two websites (the OTA images website and the factory images website) and look at the builds side-by-side, you'll see that they match up.

Now, I don't really understand what you mean by
I should add that I used the patched image linked above, but I took an OTA update.
Does this mean you first flashed "magisk_patched.img," then restarted your phone and took the OTA? I think that's the incorrect order, because that would remove Magisk. I believe that you should take OTA updates only on unmodified systems. In my past experience, when I tried to take an OTA from within Android (method 1), it would fail if Magisk was still installed.

So perhaps I took a factory patch and applied it to a system that had an OTA update?
So now this is a different order than what you said above: now you're saying you took the OTA, then flashed the factory image. I don't think this should cause a problem, as that's what I had to do to escape my bootloop. I took the OTA and successfully installed Android 11 up to the December 2020 build, then mistakenly flashed the wrong version of "magisk_patched.img." To get everything working correctly, I just downloaded the December 2020 build of the factory image, removed the -w argument, then executed "flash-all.bat." That restored Android back to "stock" system files, like radio, modem, boot image, etc.

So you can flash a factory image after taking an OTA; my understanding is that it's like a dirty flash. It basically restores all the components of the base Android operating system, because it's a factory image.

I'm really not entirely sure what went wrong in your case. It seems to me that you either flashed the wrong file, or did things out of order, but I'm afraid I really can't be more helpful than that.

Now I am getting an odd error when I try to flash the patched image, it says:

unknown partition 'magisk_patched.img'
fastboot: error: cannot determine image filename for 'magisk_patched.img'
Some questions:
  • What version of Magisk Manager and Magisk are you using to create "magisk_patched.img"?
  • What image ZIP file from here did you download to extract the stock "boot.img" from? Again, you need to download the factory image that matches you current Android build. Go into your Android settings, then select "About phone," then scroll to the bottom. Note what the build number is. If you already flashed the Dec. 2020 build using "flash-all.bat," then you should see you're on build RQ1A.201205.003, Dec 2020. So you can extract "boot.img" from the same ZIP file that contains "flash-all.bat" that you just flashed to get your phone back to life, and that should be the right one. It should have something like "f23d..." in the filename.
  • Are you running the latest version of Android Debug Bridge (ADB)? Type adb --version in Command Prompt to see your current version. I updated my ADB by downloading a fresh copy here. The latest version is 30.0.5-6877874.
  • Is your phone recognized by ADB when you boot into Android and have it connected to your computer? Type adb devices -l in Command Prompt to list your devices, and your phone's serial number should be displayed.
  • Is your phone recognized by fastboot when you boot into fastboot and have it connected computer? Type fastboot devices -l in Command Prompt to list your devices, and your phone's serial number should be displayed.
  • Check the path where "magisk_patched.img" is, and verify that you're copying and pasting it into the fastboot flash boot command correctly.
 
  • Like
Reactions: Vinotas and AndDiSa

Vinotas

Senior Member
Jan 5, 2012
112
21
So here's what I initially did:
  1. uninstalled Magisk (latest version)
  2. took the OTA update, rebooted, all good
  3. reinstalled Magisk (latest version), ensured I was on Beta Channel
  4. downloaded the patched boot.img file from Post 338 (I was tired and it was late and I was being lazy, my bad, I admit)
  5. hooked up the phone to the computer and used ADB to flash the patched Sargo image (the 67.1mb one), then rebooted
  6. got stuck in Fastboot Mode
  7. freaked out
  8. followed your instructions, used flash-all.bat to reinstall the Factory version, and everything seemed OK. During the install, I did notice a few messages about missing .img files, and that's when I realized I hadn't unzipped the image-sargo...003.img file
All versions are up to date, and I am on the Factory image of the update. I was just not rooted. So this morning, after many cups of coffee, I did the following:
  1. unzipped the image-sargo...003.img file into the same folder as the factory update
  2. flash-all.bat
  3. all good, everything up to date as of 12/22/20
  4. install Magisk, ensure I'm on Beta Channel, version 21.1 Magisk and version 8.0.3 (314) (14) of Manager
  5. copy boot.img to Download folder on phone
  6. click Magisk -> Install -> Select and Patch a File -> Select Boot.img, let it do its thing
  7. connect phone, confirm via ADB that it's there
  8. copy/paste patched boot file to the ADB folder on my computer
  9. ADB reboot bootloader
  10. flash patched image
  11. reboot
  12. ROOTED!
Somewhere along the line last night I must have mixed up the OTA and Factory files. Or at least that's what I think happened. Now I just need to figure out how to reinstall AdAway too and all will be good. I'm not in tech (I'm in the wine biz) so I dabble just enough to be dangerous, which is why I ask so many questions. Thank you so much for your assistance with this, you rock!
 
  • Like
Reactions: Completely_Clueless

Completely_Clueless

Senior Member
Dec 21, 2011
56
15
You're welcome! I'm happy to hear everything is working right! 😁

And yes, mixing up the factory images with the OTA images has tripped up a few people before, including me. Although it's interesting that you had to unzip the second ZIP file, which may not necessarily be required. I have the program 7-Zip installed, which can open ZIP files and extract individual files from them. So what I do is I download the factory image, and then completely extract this file to a folder somewhere. Then I open this folder, and see the 2nd ZIP file that's inside, along with the flashing scripts. But for this 2nd ZIP file, I just open it in 7-Zip, and the only file I need from this archive is "boot.img," so I tell 7-Zip to extract only this file, and leave the ZIP file alone. Running "flash-all.bat" with the 2nd ZIP file unextracted works fine. Hopefully that makes sense.

But this is nitpicky, and if extracting both ZIP files works for you, then that's great. You don't have to change your approach if it worked. Just make sure to not mix up the images. Feel free to pour one out now that it's working! 🍷
 
  • Like
Reactions: Vinotas

Zaman_333

Member
Jun 27, 2016
9
0
The Boot Image Patching Installation method - (the only method currently available under Android 10 or 11, but it also works with Pie).
Use this method if you are on Android 10 or 11 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). If we are early in the Android 11 cycle, users will need to use the "Canary" Magisk builds.
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.

Noob question here, does this prepatched flashing method wipes data? anyone tried?
I'm using pixel 3a, android 11 December update. Please let me know.
TIA
 

Uzephi

Recognized Contributor
Apr 20, 2012
3,439
1,890
Phoenix
Google Pixel 3a
Thank you for the info. So, if I flash a prepatched file, it is kind of an OS update so it doesn't wipe data?
You would extract the zip file. In the zip file there is a .bat file and .sh file (bat for windows and sh for Linux). Be sure to edit the file and remove the -w flag. That is the wipe data flag. With that removed, it will just flash and keep user data in tact. (If you are doing an update this way, otherwise, just extract the boot image, patch in Magisk and flash it.)
 

Zaman_333

Member
Jun 27, 2016
9
0
I seem to face a problem here. That is , fastboot flash magisk_patch.img command returns that fastboot allowed to flash. I have enabled OEM unlocking from the menu, but a quick google search suggests that I need to unlock bootloader first, which essentially wipes data. I have very little knowledge about that, but looks like someone did it on Mi phones without losing data.

You would extract the zip file. In the zip file there is a .bat file and .sh file (bat for windows and sh for Linux). Be sure to edit the file and remove the -w flag. That is the wipe data flag. With that removed, it will just flash and keep user data in tact. (If you are doing an update this way, otherwise, just extract the boot image, patch in Magisk and flash it.)
Are you suggesting to replace the original boot.img with patched boot.img and remove the -w flag from flash.bat file, then pack the image and flash it?
Thank you
boot.PNG
 

AndDiSa

Senior Member
Dec 2, 2009
3,583
4,766
Heidelberg
@Zaman_333 yes, you need to unlock the bootloader and yes, it will wipe all your data. There is no other possibility and I would not relay on some misterious hints or tips how to unlock preventing the wipe ... most likely you will run into issues some time later.
 

bigw34

Senior Member
Jun 10, 2010
221
51
FL

daddylonglegs

Senior Member
Oct 23, 2009
506
104
Vermont
I am having a huge issue getting Magisk to work on my Pixel 3A.

I have used Magisk religiously since my Pixel 1 and never had any problems flashing it numerous times on that phone and my current Pixel 3A. I was on Android 10 and using it just fine, and decided to update to the January Android 11 release by installing the full firmware with the -w flag removed so I would keep my data.

The phone updated just fine to Android 11. However, I cannot get Magisk working for the life of me.

I am on the latest Magisk Manager beta release. I took the boot.img from the January 2021 firmware zip. I put the boot.img on my phone, opened Magisk, and had Magisk patch it.

I then go into ADB and run the command fastboot flash boot magisk_patched_e9284yh5.img or whatever it spit out.

Every single time I do it my phone no longer boots and fastboot shows me the error NO VALID SLOT TO BOOT

The only way to get rid of that error is to sideload the OTA update for January 2021. Doing flash-all.bat with -w removed for the full firmware DOES NOT WORK for some reason. I *have* to sideload an OTA update to get my phone to boot again.

I have no idea what's going on. I cannot flash Magisk boot without getting the NO VALID SLOT TO BOOT error. I've been googling this problem for two days now and there's tons of people with this issue, with absolutely no resolution on how to flash Magisk without getting this error.

I am pretty desperate to get Magisk working again so any advice would be really appreciated.
 

AndDiSa

Senior Member
Dec 2, 2009
3,583
4,766
Heidelberg
After flashing the OTA, do you let the system boot at least once without installing Magisk? I would suggest you to at least do one reboot before you try to flash a new boot.img. The bootloader holds flags which slot was used the last time when booting and in addition whether booting was successful or not. If both boot slots are marked as "unbootable" I suppose you will get this error message ...
 
  • Like
Reactions: daddylonglegs

Uzephi

Recognized Contributor
Apr 20, 2012
3,439
1,890
Phoenix
Google Pixel 3a
It could be a bad module also. I would suggest using the below command when booting with Magisk and reinstall your modules one by one.

adb wait-for-device shell magisk --remove-modules
 
  • Like
Reactions: AndDiSa

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    @sic0048 for pixel 3a and pixel 3a XL rooting Android 12 is the same as for Android 11, no further steps required especially no flashing / changing vbmeta.
    1
    @sic0048 for pixel 3a and pixel 3a XL rooting Android 12 is the same as for Android 11, no further steps required especially no flashing / changing vbmeta.
    Thanks. I've noted this in the OP.
    1
    @Vinotas I never take the OTA but do the update manually, i.e. I download the factory image, extract the boot.img patch the boot.img with Magisk installed on the phone and push it back to my pc.
    After that I unhide Magisk-Manager and boot to bootloader. I modify the flash-all script by removing the -w and disable rebooting after flashing is finished and execute the flash-all script.
    After flashing is finished I manually boot to bootloader again and flash the prepared patched boot.img and finally do the boot of the system.
    Last step is hiding Magisk-Manager again ... I think hiding/unhiding is not even needed.
    1
    @Vinotas well, I do want to be secure to have a working phone without loosing root a single moment, that's the reason I am doing the updates manually.
    1
    @Vinotas Well, "fastboot flash ..." is flashing into the current selected slot and overwrites everything installed already there. But I agree the process is a bit longer and one needs to get familiar with it.
  • 43
    Edit - just an FYI for complete transparency. I have moved from the Pixel 3a XL to the Pixel 6. I no longer own my Pixel 3a XL. While I've been told (thanks @AndDiSa) that the root process for Android 12 is the same as it historically has been, I no longer can test things myself. (The root process for the Pixel 6 is different and more complicated than this phone). If you run into any problems or issues, please post in this thread and someone will hopefully be able to answer them.

    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 or 11. If you are still on Pie for some reason you can choose either installation option, but if you have moved to a later Android version, 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/11)
    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, 11 or 12, but it also works with Pie).
    Use this method if you are on Android 10 or 11 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). If you are early in the Android 12 cycle, you probably need to use a Canary build of Magisk.
    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 you find yourself in a bootloop after upgrading an already rooted phone
    If you find yourself in a bootloop after updating to a new OS version and flashing the magisk_modified boot.img again, it is likely due to an installed Magisk module not being compatible with the new update. To uninstall all Magisk modules to fix the bootloop, follow these steps:

    Step 1 - Connect your phone to the computer you use ADB on.
    Step 2 - In ADB type the command "adb wait-for-device shell magisk --remove-modules"
    Step 3 - Start your phone again or wait for it to go through another bootloop cycle.
    Step 4 - as soon as ADB is available (which occurs even during a bootloop) the command will activate, the modules will be removed, and the phone will reboot.

    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 a couple Android 10 images, but most do not require this step.
    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, while the initial boot is usually pretty quick, it can take longer. I've occasionally seen the process take upwards of 20 minutes and longer. I think part of the reason it can take so long is that sometimes it optimizes the apps during this boot process. The more apps you have, the longer the process may take. When you take an regular 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. When you use the side-load method, 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 need 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
    4
    @Completely_Clueless you can apply OTA without wiping, you can also apply a new factory image without wiping, so all your data will be kept in that way. When updating to a new version, I always do it in the following way:
    - fastboot flash boot.img <unpatched_boot.img for your current version
    - fastboot reboot (now you are no longer rooted (!))
    - then I do apply the OTA (in parallel Iam downloading the new factory image and do extract the boot.img for that version)
    - after the OTA is applied and the device restarted the new version (you are still unrooted) I am transferring the new boot.img to the device
    - patch the new boot.img with MagiskManager
    - get the patched_boot.img
    - fastboot flash boot patched_boot.img
    - fastboot reboot
    and you are rooted again ..

    These are some (quite easy) steps but I never had problems in updating the phone yet.

    For having a backup solution, I started Android Backup and Restore Tools which gives me the chance to do a backup (and restore) even without having TWRP available and without the need to store data on the device twice (original and backup).
    4
    @sic0048 I've updated my thread
    3
    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
    3
    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......