[Google Pixel 4 XL Guides, News, & Discussion] GrimEcho:
Alternative Method for applying OTAs

Alternative Option For Applying December (or any other OTA updates) without using ADB or Fastboot.

Pros:

+ No need for fastboot or ADB

+ Can be done without a PC

+ OTA is applied from within Android, using Android's normal update process

+ Retains root

+ Retains any installed Magisk Modules

Cons:

- Until Magisk is updated, requires that you fake a backup by compressing a stock boot image and renaming the resulting file.

- Only works on phones with duel partitions

The Pixel 4/4XL has duel partitions. This allows for an alternative option for installing OTA updates without losing root (Magisk) or wiping data. The process is outlined in the Magisk guide here: https://github.com/topjohnwu/Magisk/blob/master/docs/tutorials.md

The problem with following that guide is that since there is no TWRP for Pixel 4 / Android 10, most of us patched Magisk into a stock boot image manually, leaving us without an automatically created backup. Then, when you attempt to uninstall Magisk and restore the backup boot image, you get a message stating "No backup image found". However, it is easy to copy a stock boot image to your phone and have Magisk treat it as a backup. Magisk can then uninstall itself, you apply the OTA without restarting, reinstall Magisk by patching OTA image in the inactive partition, then reboot. After reboot you will be running the OTA version with Magisk patched in.

The process is a little easier if you have a PC, but it can be done completely on the phone itself, without any other hardware.

Here is a full process:

Requirements:

A rooted Pixel with Magisk Manager installed

A file explorer app that has a root broswer (I use Total Commander)

A text editor that can open arbriatry files (I used Quick Edit)

A tool to zip files (I used 7-Zip on a Windows PC, then transfered the file via USB, but you can do this completely without a computer)

The unpatched boot.img file that corresponds to your current build. (Get it from https://developers.google.com/android/images#coral

Create a backup image that Magisk can auto-restore

On your Android phone, open the following file: /sbin/.magisk/config

Copy the SHA1 hash (you want to copy everything after the = sign)

Download the factory image that corresponds to your current build. Extract the zip, then from the zip extract the boot.img file (Yes, there is a zip within a zip). This is easier to do on a computer, but can be done directly on the phone.

Create a new .gz archive that contains the boot.img file and nothing else. On Windows, I used 7zip for this, selecting gzip as the method, and using all of the defaults.

Rename the .gz achive to the following: 'stock_boot_<hash>.img.gz' where <hash> is the SHA1 hash that you coped from the Magisk config file.

Copy the .gz file to your phone and place it in the /data directory. The full path on your phone should be /data/stock_boot_<hash>.img.gz.

You can now follow the rest of the guide from https://github.com/topjohnwu/Magisk/blob/master/docs/tutorials.md, but an abbreviated version is included

Uninstall Magisk and Apply the OTA

Launch Magisk Manager on your phone

Select "Uninstall", then choose "Restore Images". Magisk will be uninstalled and you will be back to running stock boot.

Go to Settings --> Systems --> Advanced --> System Update, then check for and apply updates. You will need to select "resume" to force the update to happen immediately. DO NOT RESTART THE PHONE. The December update can take a while. I was on the "optimizing apps" message for a good 20 - 30 minutes.

After the udpate has been installed, the screen will have the option to restart. Don't select it.

Install Magisk to the updated boot and restart

Start Magisk Manager

Select Install (we are installing Magisk, not Magisk Manager)

When prompted, choose to install to an inactive partition

Read the warning and confirm. The OTA boot image will be patched with Magisk.

Restart your phone.

You should now have the OTA update (verified by checking Settings --> About Phone --> Build number)

You should also have a new stock_boot_<hash>.img.gz file in your /data directory. Next time there is an OTA update, you can skip the first part of this and go straight to uninstalling Magisk and applying the OTA.

Thanks to reyqn and Nephiel for commenting on https://github.com/topjohnwu/Magisk/issues/1870.