Quick Links

Part of the beauty of owning a Google Pixel phone comes through the proper availability of firmware images that can be used to return the device to a factory state. Even if you unlock the bootloader, root the phone, or tinker a bit too much, you can always restore the stock configuration. Having said that, some users might find it difficult to keep root access and associated mods intact while retaining the ability to take monthly security updates. Although many hardcore Android fans will know exactly what to do, not everyone is as adept at getting their phone updated without losing root.

If you have access to a PC/Mac and are happy to take matters into your own hands, you can easily keep root access by performing a few extra steps in addition to sideloading the OTA update on your Google Pixel.

How rooting affects the capability of installing OTA updates

Pixel 6 Pro with bloom wallpaper on window sill

Rooting involves modifying parts of the Android boot image to gain superuser access. A regular monthly OTA or “over-the-air” update is incremental in nature, which means it can't apply the delta patch to upgrade the stock boot image due to an obvious binary mismatch in a rooted environment. While opting for the full update package is a viable solution to this problem, it will eventually overwrite the bits and pieces required for root access from the boot partition.

So for those of you who plan to get dirty with your Pixel and may need a savior down the road, we thought we’d make sure you know how to keep root access across monthly security updates. The process isn’t difficult, but it does require a few ADB and Fastboot commands.

How to keep root and take OTA updates on your Pixel

Before starting, note that this tutorial assumes you have an unlocked bootloader and are already rooted with Magisk. Moreover, make sure that you have the latest ADB and Fastboot binaries installed on your PC/Mac and that the target device can be detected by these tools. Windows users are also advised to install the latest OEM USB driver.

There are a few ways to get your Pixel updated to the latest official Android build while keeping root. You can restore the stock boot image of the base version, wait until your phone gets a notification that will prompt you to download any waiting updates to your phone (or sideload the update manually), then patch the updated boot image and flash it. This is a bit slower but recommended method for beginners.

A faster method is to flash the official factory image with a pre-patched boot image. Keep in mind that both methods rely on access to a PC or Mac. None of them requires you to wipe the device, but it’s good practice to back up any irreplaceable data in case something goes wrong.

Note that with the Google Pixel 7 series (and devices launching with Android 13), the generic ramdisk is removed from the boot image and placed in a separate partition called “init_boot.” As a result, you need to patch the init_boot image instead of the regular boot image in order to root these devices. If you have the Pixel 7 or Pixel 7 Pro, replace every occurrence of boot.img with init_boot.img for the tutorial below.

  1. Locate the exact version number of the currently installed software on your Google Pixel phone. Navigate to Settings > About phone and note down the text under the Build number section.
  2. Now we need to restore the untouched boot image corresponding to the installed build. As a precautionary measure, open Magisk, switch to the Modules tab, disable the active modules, and restart once before doing so.
    • Depending on the method of patching, the Magisk app might keep a backup of the stock boot image. In that case, you should be able to restore them through the Restore Images option under the Uninstall menu of the Magisk app. Nonetheless, we recommend flashing the untouched boot.img from the factory image to avoid any unforeseen issues.
  3. Download the fastboot-flashable factory image corresponding to the current Android build number for your Google Pixel phone on your PC/Mac. It should be named as <device codename>-<build number>-factory-<hash value snippet>.zip.
  4. Open the factory image using your favorite archive manager, locate the image-<device codename>-<build number>.zip file (yes, there’s a ZIP within a ZIP), and extract the boot.img file from it.
    Google Pixel 6a firmware stock boot image
  5. Install the stock boot.img for the current Android build number:
    1. Make sure USB debugging is enabled on the phone and the adb devices command on the computer returns the phone's serial number.
    2. Reboot the phone to the bootloader mode: adb reboot bootloader
    3. Flash the stock boot image: fastboot flash boot <full patch of the stock boot.img>
    4. Reboot: fastboot reboot
  6. You can now force your phone to pull any waiting updates by heading to Settings > System > System update > Check for updates. Alternatively, download the latest recovery-flashable full OTA image for your model and sideload it manually.
    • Don't choose the latest factory image for upgrading, as the inbox flashing script will wipe the device by default.
  7. Now that you're on the latest build, it's time to patch the boot image with Magisk for regaining root access. We have a dedicated tutorial for how to install Magisk, so take a look at it if you need any help.
  8. Once your phone has rebooted after flashing back the patched boot image, you should be safely updated with the very latest OTA with root access.

Quick method

  1. Download the factory image corresponding to the latest update for your Pixel phone on your PC/Mac.
  2. Unpack the factory image using your favorite archive manager, locate the image-<device codename>-<build number>.zip file, and extract the boot.img file from it.
  3. Patch the stock boot image using Magisk, but don't flash it on your phone yet.
  4. Copy the Magisk-patched boot image from your phone to your PC/Mac and rename it to boot.img.
  5. Open the image-<device codename>-<build number>.zip file from step 2 with the archive manager of your choice and replace the stock boot image file in it with the one from step 4.
    • We suggest Windows users 7-Zip so that a simple drag-and-drop should be enough to push the patched file into the archive.
    • Linux and macOS users can use the built-in zip utility to replace the stock boot image with the patched boot image in the factory firmware:
              zip image-<device codename>-<build number>.zip boot.img
          
  6. In order to remove the data wipe routine, modify the flashing script like the following:
    • If you’re on Windows, then open the file named “flash-all.bat” with Notepad (or your favorite text editor), remove the "-w" parameter from the fastboot flashing segment, and save the file.
      Google Pixel 6a October 2022 flash-all.bat original
    • For Linux and macOS, open the file named “flash-all.sh” with your favorite text editor, remove the "-w" parameter from the fastboot flashing segment, and save the file.
  7. Reboot your Pixel phone to the bootloader mode and perform the flashing operation using Fastboot.
  8. If everything goes right, the phone should reboot automatically into the latest OS version — that too with a pre-rooted boot image.

Google Pixel 6a running Android 13 October 2022 build rooted with Magisk

Optional: GUI method

In case you don't want to fiddle with the command line tools, XDA Recognized Contributor badabing2003 offers a handy application named PixelFlasher to streamline the job. The aptly named open-source GUI wrapper around ADB and Fastboot is coded in Python, hence you can run it on every major desktop OS, including Windows, macOS, and Linux.

PixelFlasher UI

As you can see, the UI is pretty straightforward. The app can automatically detect the location of the ADB and Fastboot binaries from your PATH environment variable, or you can also manually select the location. Next, you need to connect the target Pixel phone to your PC, and click on the Scan button to detect the device. PixelFlasher can identify a rooted device (tagged with a checkmark ✓) as well, but you need to grant root permissions to shell in Magisk.

Here's how you can use PixelFlasher to install OTA updates on your Pixel phone while keeping root: ​

  1. Grab the factory image corresponding to the latest update for your Pixel phone.
  2. Next, select the factory image, the application will recognize the phone model from the image name.
  3. Process the factory image. PixelFlasher will extract boot.img file (init_boot.img for Pixel 7 series and newer) from the factory image and populate it in the list below.
  4. Select the boot.img from the list for patching via Magisk.
    • If Magisk is not installed on your phone, PixelFlasher will install it for you.
  5. Select the newly added entry corresponding to the patched boot image.
  6. Now select the Flash Mode as Keep Data.
  7. Click on the Flash Pixel Phone button to begin flashing.
  8. That's it!

Don't have access to a computer? While it is possible to direct Magisk to install itself to the inactive slot before taking an incremental OTA and keep root after the update, you might stumble on some unexpected roadblocks in this process. Thus, we recommend patching the boot image yourself and flashing it using a PC.

Verification

A simple way to check if you have followed all of these steps correctly is to head to Settings > About phone > Android version. You should see the exact patch and build number that you have sideloaded on your Google Pixel device.

Next, open the Magisk app from app drawer and the Magisk build number should be listed beside the “Installed” parameter, indicating that you’ve successfully managed to complete the process.

And there you go! You now know how to install monthly OTA updates on the Google Pixel series of phones while keeping root. If you have any questions regarding rooting your Pixel, make sure to leave them in the comment section below.