Root with Magisk
Two ways to patch and flash the stock boot image with Magisk. Option A uses
the Magisk app’s GUI; Option B is fully terminal-only. Both end at a rooted
device. (Prefer zero-touch? The root_pixel.sh script automates
the middle of Option B - extract β patch β flash β pull.)
Remember the per-device partition (from the Android overview): Pixel 8a
(akita) β init_boot, Pixel 6a (bluejay) β boot.
Option A, patch with the Magisk app (GUI)
Host prereqs: Android platform-tools (
adb/fastboot) on PATH; confirm the device and note its EXACT build (it must match the factory image you download).On the phone, enable Developer options (tap Build number 7Γ), then turn on both OEM unlocking and USB debugging.
Unlock the bootloader, this WIPES the device, so back up first.
Download the factory image that EXACTLY matches your build from Google’s factory images (
akita-β¦for 8a,bluejay-β¦for 6a), then unzip twice to reach the stock partition image.Patch it with the Magisk app: install the APK, push the image, then in the app tap Install β “Select and Patch a File” and pick that
.img. Magisk writesmagisk_patched-XXXXX.imgtoDownload/; pull it back.Flash the patched image (mind the partition name per the table above).
Verify root.
May 2026 anti-rollback (Pixel). After a first successful boot into the May 2026 (or newer) build, Google recommends sideloading the matching full OTA so both A/B slots have a bootable bootloader, otherwise a failed flash can brick via the older inactive slot. See the note on the factory-images page.
Kernel-level alternatives on GKI 2.0 / kernel 5.10+ devices: KernelSU (https://kernelsu.org/) and APatch (https://apatch.dev/).
Version note (2026). Android 16 (kernel 6.12) is current; 17 (API 37) is next. Magisk v31.0 already ships Zygisk for it, so this path carries forward.
Option B, fully terminal-only (no Magisk GUI)
The GUI’s “Select and Patch a File” step is really just Magisk’s own
boot_patch.sh running on-device. You can invoke that script directly over
adb shell (no root needed to patch, only the later flash needs an unlocked
bootloader), which makes the whole flow headless/scriptable. The Magisk APK is
also a ZIP, so you extract the patcher binaries straight from it. Official
tool docs: https://topjohnwu.github.io/Magisk/tools.html Β·
https://github.com/topjohnwu/Magisk/blob/master/docs/install.md
Prefer the repo helper?
root_pixel.shdoes this extract β push βboot_patch.shβ pull for you (and can auto-fetch Magisk + the factory image and flash). The by-hand sequence below is what it automates.
Grab the Magisk APK and unzip it locally, it’s a normal ZIP archive (releases).
Stage everything
boot_patch.shneeds into ONE dir on the device (arm64-v8ais correct for Pixel 8a/6a; Magisk ships its binaries aslib*.so).Run Magisk’s patcher on-device (output is
new-boot.imgin that dir), pull it back, and tidy up.Get temporary root first (recommended, boots from RAM, writes nothing to any partition).
Make it permanent by flashing the same image (mind the partition per device).
Why
fastboot bootfirst? It loads the patched image into memory without touching the partition, if it bootloops or root doesn’t take, just reboot and you’re back to stock, no recovery needed. Onlyfastboot flash(step 5) makes it stick. This is the official “safe memory test” Magisk recommends.
Never patch on a different device or flash someone else’s patched image, Magisk bakes in device/AVB specifics. Always patch the image for the device you’re rooting.
Once you’re rooted, go to Verify Android artifacts. If a flash goes wrong, see Recover a bricked device.