[Magisk] _sky.captain_:
How I recovered from this on a Pixel 2 XL

I'll chime in with my experience here, as it might save someone else a lot of time if they are at my skill level with this stuff (which is only moderate, I suppose, although I do always get things to work eventually!).

As of yesterday, I had a Pixel 2 XL, rooted with Magisk, and working great. This morning, during the middle of the night, Magisk innocently asks if I want to upgrade to a new version. I was very tired (in fact, I think I was sleeping when my phone buzzed to alert me of the upgrade message) and don't even know how I responded except that it was "yes" to the upgrade part. By the time I'd fully awakened, I had a phone that waw in a boot loop. I went back to sleep, figuring I'd have better luck looking at it after a little rest.

Getting out of the boot loop was easy: I just reinstalled the August 2018 factory image for the phone. However, getting Magisk reinstalled was an adventure. I saw posts that said I should run the Magisk uninstaller, but when I did it just said that Magisk was already uninstalled. And yet, whenever I tried to apply either v16.0 or v17.1, I got errors (error codes 1, 2, and 255 at different times).

Up until this event, I'd always upgraded Magisk by installing it via TWRP. However, that was not working, so I thought I needed to try patching the boot image, something I'd never done before. Because I'd never done it before, it took me a while to understand the steps, which are actually quite simple. This is where I'm hoping I might save someone some time. Basically, my fear was not knowing which file the "boot image" was. Seasoned Android veterans might get a chuckle out of this, and that's fine, but I was looking at the file in the factory image download and basically saw only two image files: bootloader-taimen-tmz20j.img and radio-taimen-g8998-00253-1805232234.img. I was trying to figure out if either of those could be the boot image, and they both seemed pretty big to be a boot image! Finally it dawned on me that the much larger file in the directory was a zip archive (named image-taimen-ppr1.180610.009.zip). I looked inside there, and sure enough, there was a rather small file named boot.img. I was pretty sure that was the "boot image" file!

Here's what I did after that, again just hoping to help anyone who finds themselves in the same predicament I was in: Magisk is broken, root isn't working, and I can't install any of the Magisk *.zip images via TWRP.

- First, I downloaded a copy of Magisk Manager: this version is named MagiskManager-v5.9.1.apk.

- Next, I ran a couple adb commands to send the Magisk Manager apk and the stock boot.img to my phone:

adb push MagiskManager-v5.9.1.apk /sdcard/Download
adb push boot.img /sdcard/Download

- Next, I installed /sdcard/Download/Magisk-Manager-v5.9.1.apk by nagivating to it (I use ES File Manager) and launching it from there.

- Next I opened Magisk Manager

- Magisk Manager detects that there is a newer version available and asks if I want to upgrade

- I said yes

- I told it that I wanted to patch a boot image

- I chose /sdcard/Download/boot.img as the "unpatched" (stock) boot image

- Magisk Manager churned away for maybe half a minute and then produced a new file called patched_boot.img, saved in the same directory as boot.img.

After that, all I had to do was run these commands:

adb reboot bootloader
fastboot flash boot patched_boot.img
fastboot reboot

As soon as the phone restarted, I opened Magisk Manager again and it verified that its upgrade was successful, and root began working for me again also.

Like I said, I hope this helps someone else. If not, it's probably good for me to just write it all out anyway.

Cheers,

Sky Captain