Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Root Pixel 2 & 2 XL via Magisk Without TWRP

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Rooting your Pixel 2 or Pixel 2 XL with Magisk lets you gain superuser access while keeping the stock boot image intact, allowing systemless modifications like ad-blocking or app-level tweaks. This method does not require TWRP recovery—you'll patch the stock boot image directly on your phone using Magisk's built-in installer. Before starting, your bootloader must be unlocked, and you'll need a computer with ADB and Fastboot tools installed. The entire process takes about 20 minutes and carries a small risk of data loss, so back up your phone first.

What You'll Need

  • A Pixel 2 or Pixel 2 XL with an unlocked bootloader (unlocking wipes all data, so do this before setting up your phone).
  • A computer with ADB and Fastboot installed. If you don't have them, download the official platform-tools from Google's developer site.
  • The stock boot image for your exact device model and Android version. Download it from Google's factory images page (e.g., taimen for Pixel 2 XL, walleye for Pixel 2).
  • The latest Magisk APK file (download from the official Magisk GitHub releases page).
  • A USB cable that supports data transfer.

Step-by-Step

  1. Back up your device. Since you'll be flashing a modified boot image, there's a small risk of bootloops. Use Google's built-in backup or copy important files to your computer.
  2. Enable Developer Options and USB debugging. Go to Settings > About phone and tap “Build number” seven times. Then go to Settings > System > Developer options and turn on “USB debugging” and “OEM unlocking” (the latter only if you haven't unlocked the bootloader yet).
  3. Unlock the bootloader (if not already done). Connect your phone to the computer, open a command prompt/terminal, and run adb reboot bootloader. Once in fastboot mode, run fastboot flashing unlock. Confirm on the phone screen. This erases all data, so do it before you have anything important on the device.
  4. Download the correct factory image. Go to Google's factory images page and find your device (walleye for Pixel 2, taimen for Pixel 2 XL). Download the build that matches your current Android version (check in Settings > About phone > Android version). Extract the ZIP file. Inside, you'll find another ZIP containing boot.img—extract that as well.
  5. Install Magisk on your phone. Transfer the Magisk APK to your phone and install it by tapping the file. If your phone blocks installation from unknown sources, allow it in the browser or file manager prompt.
  6. Patch the boot image with Magisk. Open the Magisk app. Tap “Install” next to “Magisk” (not “Recovery mode”). Select “Select and Patch a File,” then navigate to the boot.img you extracted and select it. The app will create a patched file in your Downloads folder, usually named magisk_patched-xxxxx.img.
  7. Copy the patched image to your computer. Use a USB cable or any file transfer method to move the patched image from your phone to the same folder where you have ADB tools.
  8. Boot your phone into fastboot mode. On the phone, run adb reboot bootloader from your computer, or power off and hold Volume Down + Power.
  9. Flash the patched boot image. In your command prompt/terminal, navigate to the folder with the patched image and run fastboot flash boot magisk_patched-xxxxx.img (replace the filename with yours).
  10. Reboot your phone. Run fastboot reboot. Your phone will boot normally. After boot, open the Magisk app—it should show “Magisk installed” and “Installed” under the Magisk section. If it asks to fix the ramdisk, tap “Yes” and reboot again.
  11. Verify root access. Install a root checker app from the Play Store, or open a terminal emulator and run su. If a superuser prompt appears, root is working.

Common Mistakes

  • Using the wrong boot image. The boot image must match your exact device model and Android security patch level. A mismatch can cause a bootloop.
  • Skipping the bootloader unlock. If you haven't unlocked the bootloader, fastboot will refuse to flash. Unlock it first (this wipes data).
  • Flashing to the wrong partition. Some guides say “flash boot_a” or “boot_b.” This method uses the generic fastboot flash boot which automatically targets the active slot. Do not specify a slot manually unless you know exactly what you're doing.
  • Not waiting for the first boot. After flashing, the first boot can take up to 5 minutes. Don't panic if it stays on the Google logo for a while.
  • Using an outdated Magisk version. Always download the latest stable Magisk APK. Older versions may not support your Android version.

Tips

  • Keep a copy of the original boot.img on your computer. If you ever need to unroot, you can flash it back with fastboot flash boot boot.img.
  • After rooting, you can update Magisk through the app itself—just tap “Install” and select “Direct Install (Recommended)” when an update is available.
  • If you plan to install custom kernels or modules, make sure they are compatible with Magisk and your Android version.
  • Use a reliable USB cable and a direct USB port on your computer (not a hub) to avoid disconnections during flashing.
  • If you're on Android 10 or later, the boot image is stored in the payload.bin file inside the factory image. You'll need to extract it using a tool like payload-dumper-go or a Python script. Search for “extract boot.img from payload.bin” for a reliable tool.

Troubleshooting

  • Phone boots into bootloop. This usually means the boot image is wrong or corrupted. Re-download the correct factory image, re-patch it, and flash again. If it still loops, you can flash the original boot image to restore your phone.
  • Magisk app says “Magisk is not installed.” This can happen if the patched image wasn't flashed correctly. Reboot into fastboot and re-flash the patched image. Also ensure the app has storage permission to detect the installation.
  • Fastboot doesn't recognize your device. Install the proper USB drivers (Google USB driver for Windows) and try a different USB port. On Linux, you may need to add a udev rule.
  • “FAILED (remote: not allowed)” error. Your bootloader is locked. Unlock it first.
  • Root works but some apps say no root. Some apps hide root detection. You can use Magisk's “MagiskHide” feature (if available in your version) or install the “Magisk Hide” module. Note that MagiskHide was removed in newer versions, so check the Magisk documentation for alternatives.

Frequently Asked Questions

Does rooting void my warranty?

Yes, unlocking the bootloader and rooting typically voids the manufacturer warranty. However, you can restore the stock boot image and relock the bootloader to regain warranty status (though relocking may not restore warranty if the bootloader was ever unlocked).

Will I still get OTA updates after rooting?

You can still receive OTA updates, but installing them will likely remove root. To update, you'll need to download the full factory image, patch the new boot image with Magisk, and flash it manually. The Magisk app also has a “Install to Inactive Slot” option for OTA updates.

Can I unroot later?

Yes. Simply flash the original boot image you saved earlier with fastboot flash boot boot.img. That removes root. If you also want to relock the bootloader, run fastboot flashing lock (this wipes data again).

Is it safe to use banking apps after rooting?

Most banking apps will detect root and refuse to run. You can try MagiskHide or the “Shamiko” module to hide root, but it's not guaranteed. Some banks also detect an unlocked bootloader even without root.

What if I have the Verizon version of Pixel 2?

Verizon Pixel 2 and 2 XL have a permanently locked bootloader and cannot be rooted this way. There is no known workaround. You'll need an unlocked (Google Store) version.

Do I need to wipe data after flashing the patched boot image?

No. Flashing the patched boot image does not wipe data. The only step that wipes data is unlocking the bootloader, which you do once before this process.