Rooting a Pixel with Magisk
This guide shows how to unlock the bootloader, install Magisk, and root a Google Pixel device.
The flow is the usual Pixel/Magisk route: unlock the bootloader, download the factory image that matches the device build, patch the boot image with Magisk, flash it back, and verify su.
Prerequisites
- A Google Pixel with OEM unlocking available.
- A USB-C cable.
adbandfastbootinstalled.- The latest Magisk APK from the official GitHub releases page.
- The matching Pixel factory image from Google.
# macOS
brew install android-platform-tools
# Debian/Ubuntu
sudo apt install adb fastboot
# Verify
adb version
fastboot --version
Rooting the Pixel
Enable Developer Options
- Open Settings → About phone.
- Note the current Build number, for example
BD3A.251105.010.E1. You need this later for the factory image. - Tap Build number seven times.
- Go back to Settings → System → Developer options.
Enable OEM Unlocking and USB Debugging
- In Developer options, enable OEM unlocking.
- Confirm the warning dialog.
- Enable USB debugging.
- Connect the phone to your machine and accept the RSA debugging prompt.
adb devices
You should see the device listed as device, not unauthorized.
Unlock the Bootloader
Reboot into the bootloader:
adb reboot bootloader
Check that Fastboot can see the phone:
fastboot devices
Unlock the bootloader:
fastboot flashing unlock
- Use the volume keys to select Unlock the bootloader.
- Press the power button to confirm.
- The phone wipes itself and reboots.
- Go through minimal Android setup.
Download the Matching Factory Image
- Go to Google Factory Images for Nexus and Pixel Devices.
- Find your exact Pixel model.
- Download the image that matches the device Build number.
- Extract the downloaded archive.
- Inside it, extract the nested
image-*.zip.
For modern Pixels, the file you normally want is:
init_boot.img
Older Pixels may use boot.img instead. If both exist, follow the current Magisk install guidance for your device/Android version.
unzip image-*.zip
ls -lh init_boot.img boot.img
Install Magisk and Patch the Image
- Download the latest
Magisk-v*.apkfrom the official Magisk GitHub release. - Install it with ADB:
adb install Magisk-v*.apk
- Push the stock image to the device:
adb push init_boot.img /sdcard/Download/
- Open Magisk.
- Tap Install.
- Select Select and Patch a File.
- Choose
/sdcard/Download/init_boot.img. - Tap LET'S GO and wait for Magisk to write
magisk_patched_*.img.
Pull the patched image back to your machine:
adb pull /sdcard/Download/magisk_patched*.img
Magisk patching flow: Install → Select and Patch a File → choose the stock image → pull the generated magisk_patched_*.img.
Flash the Patched Image
Reboot back into the bootloader:
adb reboot bootloader
Flash the patched image:
fastboot flash init_boot magisk_patched_*.img
If your device uses boot.img instead of init_boot.img, flash the matching partition:
fastboot flash boot magisk_patched_*.img
Reboot:
fastboot reboot
Verify Root
Once Android boots, open Magisk and confirm that it shows as installed. Then verify from a shell:
adb shell
su
id
Expected result:
uid=0(root) gid=0(root) groups=0(root) context=u:r:magisk:s0
After Root: Frida Server
Once root is working, a common next step is to run frida-server from /data/local/tmp.
adb push frida-server /data/local/tmp/frida-server
adb shell
su
chmod +x /data/local/tmp/frida-server
/data/local/tmp/frida-server &
From your machine:
frida-ps -U
If the process list comes back, the device is ready for runtime instrumentation.
Useful Paths
| Path | Use |
|---|---|
/data/local/tmp | Temporary binaries, Frida server, PoCs, native tools. |
/data/app | Installed APK locations. |
/data/data/<package> | App-private data. Access normally requires root. |
/data/anr | ANR traces. |
/data/tombstones | Native crash dumps. |
Capture Logs and Crashes
# Live logs
adb logcat -v time
# Dump current logs
adb logcat -d > logcat.txt
# List tombstones
adb shell su -c "ls -lah /data/tombstones"
# Pull a tombstone
adb shell su -c "cp /data/tombstones/tombstone_00 /sdcard/"
adb pull /sdcard/tombstone_00
Common Fixes
Magisk Shows N/A After Flashing
- Make sure the factory image build exactly matches the installed Android build.
- Patch the correct image: usually
init_boot.imgon newer Pixels,boot.imgon older devices. - Re-patch using the latest Magisk APK and flash again.
Bootloop After Flashing
- Boot to Fastboot with Power + Volume Down.
- Flash the original stock image back:
fastboot flash init_boot init_boot.img
fastboot reboot
adb Works but fastboot Does Not
- Try another USB port/cable.
- On Linux, check udev rules.
- On Windows, reinstall the Google USB driver.
References
- Magisk Installation Guide
- Latest Magisk GitHub Release
- Google Factory Images for Nexus and Pixel Devices
- Android Debug Bridge documentation
- Awesome Android Root
Take It Into the Labs
Once the Pixel is rooted, use it against real Android targets. Mobile Hacking Lab has hands-on labs for Android application security, runtime instrumentation, and vulnerability research workflows.