[Guide] Root Pixel 4 XL with Magisk Android 13

Search This thread

dogeen

New member
Jan 2, 2022
4
2
First "oh no did I brick my device?" post of the year!

I was on Android 11 with an unlocked bootloader, magisk root on the stock rom, and tried doing a clean install, without the "Magisk Restore Images" step, because Magisk hadn't backed them up, and found myself with a device that doesn't have WIFI or mobile. Luckily, I had a backup of my persist.img, but my phone doesn't appear to like that persist.img anymore.

Note: I had modified my modemst1 because my device is from US and the Turkish government wanted me to pay ~$300 to not block it, so I changed my IMEI for the Turkish line to the IMEI of an old phone that belonged to a relative, and kept my US line with the original IMEI.

Here is what I tried:
- Right when Android 12 booted for the first time, mobile was gone, but WIFI was just flaky. It listed the networks and even started downloading my backup. That was followed by a boot loop, which may have been because of a button issue. I followed the instructions for flashing boot.img with --slot all. Again, WIFI was only flaky but after a few reboots it was gone entirely.

- Reflashed the stock 12 several times, didn't help.

- Reflashed the stock 11 version I was on, didn't help.

- fastboot erase/flash persist consistently fails with "Not allowed to flash" and "Not allowed to persist" even when I have root. This is very strange.

- dd if=<persist.img path> of=/dev/block/sda2 - seems to work but doesn't fix anything. Attempting to turn on the WIFI makes the UI unresponsive.

- Installed TWERP hoping it would provide a way to flash the persist.img but didn't really help. But it showed the persist partition size to be 0 bytes, which was a very interesting finding, confirming the persist partition corruption.

3 questions:
- Am I not flashing my persist.img correctly? If so, why not? I had backed it up with dd.
- I am guessing I might have to start looking for a Pixel 4XL persist.img, but where do I look for that? I am guessing all Pixel 4XLs have the same but the stock image downloads don't come with the persist.img for some reason.
- Is there anything else I should do?
 

madmuthertrucker

Senior Member
Jan 4, 2013
243
122
Tucson, Az
Google Pixel 7 Pro
Are you guys getting GPay working? I installed the Jan update and switched to magisk canary with safety net 2.2.1. I passed safety net, device is certified, banking apps all good. I denied Play store, Gpay, and Play Services. I noticed that Play services unchecks after reboot. Where am I going wrong? I'm not finding any recent info.
 

madmuthertrucker

Senior Member
Jan 4, 2013
243
122
Tucson, Az
Google Pixel 7 Pro
I got GPay working! Here is how.

Clear the cache and data for Google Play services, Google Play Store, and GPay. After which, I removed and reinstalled Google Pay and then added the payment method back in.

I had done this originally but not the uninstall & reinstall. That's what did it.
 
  • Like
Reactions: Homeboy76

pw1nce

Senior Member
Oct 12, 2013
403
36
mardan
First "oh no did I brick my device?" post of the year!

I was on Android 11 with an unlocked bootloader, magisk root on the stock rom, and tried doing a clean install, without the "Magisk Restore Images" step, because Magisk hadn't backed them up, and found myself with a device that doesn't have WIFI or mobile. Luckily, I had a backup of my persist.img, but my phone doesn't appear to like that persist.img anymore.

Note: I had modified my modemst1 because my device is from US and the Turkish government wanted me to pay ~$300 to not block it, so I changed my IMEI for the Turkish line to the IMEI of an old phone that belonged to a relative, and kept my US line with the original IMEI.

Here is what I tried:
- Right when Android 12 booted for the first time, mobile was gone, but WIFI was just flaky. It listed the networks and even started downloading my backup. That was followed by a boot loop, which may have been because of a button issue. I followed the instructions for flashing boot.img with --slot all. Again, WIFI was only flaky but after a few reboots it was gone entirely.

- Reflashed the stock 12 several times, didn't help.

- Reflashed the stock 11 version I was on, didn't help.

- fastboot erase/flash persist consistently fails with "Not allowed to flash" and "Not allowed to persist" even when I have root. This is very strange.

- dd if=<persist.img path> of=/dev/block/sda2 - seems to work but doesn't fix anything. Attempting to turn on the WIFI makes the UI unresponsive.

- Installed TWERP hoping it would provide a way to flash the persist.img but didn't really help. But it showed the persist partition size to be 0 bytes, which was a very interesting finding, confirming the persist partition corruption.

3 questions:
- Am I not flashing my persist.img correctly? If so, why not? I had backed it up with dd.
- I am guessing I might have to start looking for a Pixel 4XL persist.img, but where do I look for that? I am guessing all Pixel 4XLs have the same but the stock image downloads don't come with the persist.img for some reason.
- Is there anything else I should do?
Hi there, I understand your situation and I'm kind of in the same boat. Though I've figured out to fix the wifi and system ui crashing. I guess need some help from you though because we also have that stupid govt tax system. I'll send you a Private message and we can try to figure it out. Text me asap. Thanks
 

Lughnasadh

Senior Member
Mar 23, 2015
6,107
7,565
Google Nexus 5
Huawei Nexus 6P
Now that Magisk no longer can be installed on inactive slot, does that mean I can no longer apply OTA and maintain root? There is new OTA Android 12 QPR3 Beta 1 and I want to know if is there a way to apply it.
The option to install via inactive slot was re-introduced into Magisk with version 24.0. You should have that option again on the latest Canary, Beta and Stable versions.
 

fivefour

Senior Member
Jun 7, 2010
770
1,341
Emerald Coast
bit.ly
Could someone please share the boot image for 12 (SP2A.220305.012)?

*EDIT*
I got it from the full update zip from the OP, thank you @Homeboy76 for this thread. The OP should have far more likes...
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 20

    Introduction
    This Guide is for Pixel 4 XL owners that want to install a custom ROM and Root it. The Guide is divided into three parts: Information, Instructions, and Other.

    ~ ~ ~ Part I - INFORMATION ~ ~ ~
    1. Disclaimer

      1. I assume no responsibility for the malfunctioning/bricking of your phone.
    2. Prerequisites

      1. A Pixel 4 XL phone with an unlocked bootloader.
      2. A Computer with a working version of Platform-tools installed:
        Platform-tools 33.0.3
        Platform-tools 34.0.4 - Is Ok for sideloading OTA images.
      3. Important Notes:
        a. Before installing SDK Platform-tools, check for older versions of fastboot on your computer: Open a Command prompt and type fastboot --version at the prompt. If a adb/fastboot is found delete the folder containing them. Also, check the path environment for paths to them and remove it.​

        b. Update Platform Tools, regularly, for optimal performance.​

    3. NEW

    4. Update(s)

      1. Magisk Beta - Magisk v26.4.apk 4 Sep
      2. Magisk Canary - app-release (d7750b72) (26403).apk 13 Dec
      3. Magisk Stable - Magisk v26.4.apk 4 Sep
      4. SafetyNet - osm0sis Play Integrity Fork
      5. Platform-tools - 34.0.4 Jul 2023
      6. Custom ROMS and Kernels
    5. My Other Guides
    6. Credits/Thanks/Recognitions

      • bradical711 - Instructions to Pass Safety Net
    ~ ~ ~ Part II - INSTRUCTIONS ~ ~ ~
    (The Instructions listed below are not steps, they are individual sets of instructions for Pixel 4 XL.)

    1. Open a Command Prompt/Boot Fastboot Mode/Boot Recovery

      • Open a Command Prompt on Computer
        1. Open File Explorer, click the platform-tools folder ==> click the folder icon (left side of address bar) to highlight it type cmd and press enter.
        2. Open a Powershell Command Prompt on Computer: Open File Explorer, click the platform-tools folder ==> click the folder icon (left side of address bar) to highlight it type powershell and press enter.
        3. Notes:
          • Enable USB Debugging, on your phone: Settings ==> System ==> Advanced ==> Developer options ==> Scroll down to USB debugging and enable it.
          • When using the Powershell Command Prompt Commands must be preceeded with ./: i.e, ./fastboot devices
          • If you do not want to open a Command Prompt every time you want to use the fastboot command, add the path to the Platform-tools folder to Windows environment variables.
      • Boot fastboot mode (bootloader):
        • Power off phone, press and hold the power and volume down buttons until you see Start.
      • Boot Recovery
        • Power off phone, press and hold the power and volume down buttons until you see Start. Use volume up/down button until you see Recovery mode. Press power button.
    2. Test fastboot

      • Enable Developer Options - Tap Settings > About phone > Build number 7 times or until you should see 'you are a Developer'.
      • Enable USB Debugging - Tap Settings > System > Advanced > Developer options >
        Enable USB Debugging.
      • Open a Command Prompt on your computer in the Platform-tools folder.
      • Boot fastboot mode on your phone (#1)
      • Connect the phone to the Computer.
      • At the prompt type: fastboot devices to verify communication with phone. It should return your phone's serial number.
    3. Unlock Bootloader/Return Phone to Stock/Lock Bootloader

      • Unlock Bootloader

        1. This will erase all user data from the device!
        2. Backup your data
        3. Activate Developer Options: Tap Settings > About Phone > Tap Build Number 7 times or until you see you are a Developer. Tap back > System > Advanced > Developer Options. Enable OEM Unlock and, USB Debugging.
        4. Boot fastboot mode
        5. Connect the phone to the Computer with USB cord.
        6. Open a Command Prompt on your computer and type fastboot flashing unlock and press enter.
        7. You should see a request for confirmation on your phone, use the volume keys to scroll and the power key to select.
        8. Allow the process to complete and then type fastboot reboot at the Command Prompt and press enter.
        9. When your phone reboots disconnect your usb cable.
          Notes: After unlocking your bootloader, you'll see a warning: The bootloader is unlocked and... You will see this warning until, you relock the bootloader.
          Do not relock your bootloader until you have returned the device to Stock.
      • Return Phone to Stock

        1. Backup your data/Internal storage
        2. Settings > System > Advanced > Reset Options > Erase all data (factory reset)
        3. Log in
        4. Set up phone
      • Lock Bootloader

        1. Return the phone to Stock before locking the bootloader, failure to do so could brick your phone
        2. This will erase all user data from the device!
        3. Boot fastboot mode
        4. Open a Command Prompt and type this at the Prompt: fastboot flashing lock
        5. You should see a request for confirmation on your phone, use the volume keys to scroll and the power key to select.
        6. Allow the process to complete, then type this at the Command Prompt: fastboot reboot
        7. Enable Developer Options: Settings > About phone > Tap Build number 7 times or until you see 'you are a developer'.
        8. Tap Back > Developer options and toggle OEM Unlock off.
    4. ADB Sideload

    5. Pass Safety Net with Magisk module - Play Integrity Fork

      1. Download File(s)
      2. Install osm0sis PlayIntegrityFork
        • Open Magisk
        • Tap Modules icon
        • Tap Install from storage
        • Navigate to the osm0sis PlayIntegrityFork file you downloaded.
        • Tap the osm0sis PlayIntegrityFork file.
        • When you see the confirmation screen, tap Ok.
        • After it installs tap the Disc icon to save the log
        • Tap Reboot
      3. Settings for Magisk Canary
        • Open Magisk App
        • Tap the Setup icon.
        • Scroll down to App and set the Update Channel to Canary.
        • Scroll down to Check Updates and enable it.
        • Scroll down to Magisk and enable Zygisk.
        • Enable Denylist
        • Tap Configure DenyList => Tap 3 Dot Menu => Check ✓ Show system apps => Check ✓ Google Play Store, Google Pay, Google Wallet etc.
        • (Optional) Scroll down to Superuser and enable Enable Biometric Authentication.
      4. Get Device Certified
        • Flash the osm0sis PlayIntegrityFork module in Magisk
        • Turn Airplane mode on
        • Open Settings
        • Tap Apps & notifications
        • Tap see all...
        • Tap three dot menu
        • Tap Show system
        • Scroll to Google Wallet/Play Store/Play Services
        • Clear Google Wallet cache (if you have it)
        • Clear Google Play Store cache and data
        • Clear Google Play Services (com.google.android.gms) cache and data (Optionally skip clearing data and wait some time, ~24h, for it to resolve on its own)
        • Turn Airplane mode Off
        • Reboot
      5. Check Device Certification
        • Note: If after completeting Get Device Certified your device is not certifed or your device is certified but certain apps (Google Pay, NetFliks, etc.) are not working. Do this to verify you are passing Play Integrity.
          1. Open Google Play Store app
          2. Tap your profile icon (top right corner)
          3. Tap Settings.
          4. Open the About menu
          5. Tap the row labeled Play Store version seven times to unlock developer mode.
          6. Tap the back arrow (upper left corner)
          7. Tap your profile icon (top right corner)
          8. Tap Settings.
          9. Open the General menu
          10. Tap Developer options
          11. Tap Check integrity
          12. If you see Basic Integrity and Device Integrity, you're passing Play integrity.
    6. Set Magisk App Update Channel/Update Magisk

      • Set Magisk App Update Channel

        • Open Magisk App > Tap Settings icon > Update Channel > Select Stable, Beta, Canary or Custom.
      • Update Magisk

        1. When Magisk App notifies you of an update:
        2. Tap install.
        3. Select, Direct Install (Recommended)
        4. When it finishes installing
        5. Tap, Save Log
        6. Log location: /storage/emulated/0/Download
        7. Tap, Reboot
        8. Done!
    7. Install/Update Magisk Modules

    ~ ~ ~ Part III - OTHER ~ ~ ~
    1. Custom ROMs

      • Need help with a Custom ROM?

        1. If you are trying to install a Custom ROM, read and follow the Installation Instructions in the OP of the Custom ROM thread.
        2. If you have questions, search the thread of the Custom ROM you are trying to install for answer(s)/solution(s) to your question(s)/problem(s)[/B]: If you don't find a answer(s)/solution(s) to your question(s)/problem(s). Post your question(s)/request(s) for help in the Custom ROM thread you are trying to install.
        3. Try installing it with 📳🔥 PixelFlasher, a GUI tool for flashing / updating / rooting / managing Pixel phones..
        4. If you are trying to install a Addon(s) {Custom Kernel, Magisk, etc.} to the Custom ROM you installed: Search the thread of the Custom Kernel, Magisk, etc. you want to install for installation instructions, and answer(s)/solution(s) to your question(s)/problem(s) about the Custom Kernel, Magisk, etc. If you don't find an answer(s)/solution(s) to your question(s)/problem(s). Post your question(s)/request(s) for help in the Custom Kernel, Magisk, etc.) thread.
      • ROMs
    2. Themes, Apps, and Mods
    4
    Having problems passing SafetyNet when using Google Pay/Wallet? Try these Play Integrity Fixes:
    1. Riru - Play Integrity Fix
    2. Zygisk - @Displax's safetynet-fix-v2.3.1-MOD.zip
    Use this app to check the status of Play Integrity on your phone: Play Integrity API Checker
    4
    @Homeboy76 Just wanted to give you a heads up. With the latest Magisk Beta (21.2) that came out yesterday, the patched output file is no longer named "magisk_patched.img". He added a suffix to the name so each time you patch the stock boot image a different output name will result. Thought you might want to modify #7 to address this change (y)
    3
    For those on latest Canary 23014 (Zygisk with GPay added to deny list),to pass safetynet and enable contactless payments

    1) Clear data for both GPay and Google Play Services. Unfortunately this also meant adding cards back in GPay app (basically reverify already added cards in your GPay profile)

    2) Apply SafetyNet fix 2.2.0 (latest).

    On the bright side no longer need Riru, Riru core, LSPosed etc. etc. Just SNF 2.2.0 + Systemless hosts like old times.
    3
    Is rooting Android 12 with stable magisk actually possible? or do i need the beta or canary version?
    Yes, it's fine. I've been using Stable version 23.0 since the first beta was released and am currently using it on yesterdays official release of Android 12 stable. Everything is fine for me.

    People on other Pixels, specifically the Pixel 5 (and maybe others) have reported that they have to disable dm-verity (and maybe another thing or two) before rooting or it will just land you in the bootloader when trying to boot. However, on my Pixel 4 XL I did not have to do anything. Just patched the boot image as usual and everything is fine for me.

    Of course, your mileage may vary.