The Google Pixel 2 and the Pixel 2 XL can now be rooted using Magisk. If you’re one of those users who like to mod their smartphones, then having root can give you access to several cool and useful features.

To root the new Pixel phone, you will first need to unlock the bootloader. Unlocking the bootloader on the new Pixel 2 is pretty easy and if you know what you’re doing, it’ll take only a few minutes.

Generally, rooting an Android device requires TWRP recovery. But with a modified boot image, you can root your Pixel 2 by flashing the Magisk patched modified boot directly from Fastboot to your device. This way you can root your Pixel 2/2 xL without installing TWRP recovery.

How to root Pixel 2 and Pixel 2 XL with Magisk

Note: Make sure you take a complete backup of all important files on your Pixel 2 or Pixel 2 XL before attempting to root your device. Unlocking the bootloader will completely wipe all data on your Pixel phone, so a backup will come in handy.

  1. Unlock bootloader on your Pixel 2 / 2 XL:
    1. Setup ADB and Fastboot on your PC.
    2. Enable USB debugging and OEM Unlock on your Pixel device.
    3. Now go ahead and connect your Pixel 2 to the PC using a USB cable.
    4. Open a command prompt window on your PC.
    5. Type in the following command to boot your Pixel 2 into the bootloader mode:
      adb reboot bootloader

      └ You may get a request to authorize USB debugging on the device, accept it.

    6. Once your device is in bootloader mode, type the following command to unlock the bootloader:
      fastboot flashing unlock
    7. You’ll get a confirmation screen on your Pixel 2. Press Volume Up button to highlight Yes and press Power button to select it. This will begin bootloader unlocking process, which shouldn’t last more than a couple of minutes.
    8. Once bootloader is unlocked, your device will reboot into bootloader mode. You need to boot into system now, either press Power button to reboot OR issue the following command:
      fastboot reboot
    9. During reboot, your Pixel 2 will go through a factory reset and then finally boot into system.
  2. Get the correct boot image for your :
    1. Download the factory image for your Pixel phone variant from this page.
    2. Extract the factory image zip file on your PC. You’ll get a few files along with another .zip file inside. Extract/unzip the second .zip file and you’ll get a boot.img file.
    3. Transfer the boot.img file to your Pixel 2 or Pixel 2 XL.
  3. Patch boot.img with Magisk Manager app:
    1. Download the Magisk Manager APK, and install it on your Pixel phone.
    2. Open Magisk Manager app on your phone and tap on Install » select “Patch boot image file” » select the boot.img file you transferred to your device in Step 1.3 above to patch it with Magisk..
    3. Once Magisk successfully patches the boot.img file, it’ll export it to your phone’s internal storage inside the MagiskManager directory as patched_boot.img file.
  4. Flash patched_boot.img to your Pixel 2 or Pixel 2 XL:
    1. Copy the patched_boot.img from your phone to a separate folder on your PC.
    2. Connect your Pixel 2 phone to the PC.
      └ Make sure USB debugging is enabled on the phone.
    3. Now open a command window inside the folder where you saved the patched_boot.img file on your PC. To do that, “Shift + Right click” on any empty white space inside the folder and then select “Open command window here” from the context menu.
    4. Once command window is open, issue the following command to boot into bootloader mode:
      adb reboot bootloader
    5. When your device boots into bootloader mode, issue the following command to install/flash the patched_boot.img file to your Pixel 2 or Pixel 2 XL:
      fastboot flash boot patched_boot.img
    6. Once the file is flashed, issue the following command to reboot your phone:
      fastboot reboot

Once your Pixel phone boots, download/install any root checker app from the Play Store to verify root access. Cheers!