What this is
Section titled “What this is”A walkthrough of unlocking the bootloader and installing Magisk on a Samsung Galaxy A05 (SM-A055M, region
GTO, firmware A055MUBU5CXH1, Android 14, MediaTek MT6769), done from the Linux host that runs the phone provider,
with the phone’s USB on that host. Other models differ in details (partition names, how the bootloader is unlocked,
which tool can flash it); the shape of the work is the same.
What root gives Holtdroid later: Frida for DevTools on release builds, reading app data, changing the system language. What it costs on a Samsung: the Knox fuse blows the moment the bootloader is unlocked and never un-blows — Samsung Pay, Secure Folder, Samsung Health’s secure parts and the warranty are gone for good, OTA updates stop, and the boot screen warns about an unofficial OS from then on.
Tools and sources used
Section titled “Tools and sources used”| What | Where | Used for |
|---|---|---|
platform-tools (adb) |
developer.android.com/tools/releases/platform-tools (or nixpkgs android-tools) |
Talk to the phone, reboot to download mode, patch headlessly |
| Stock firmware | samfw.com — model SM-A055M, region GTO, build A055MUBU5CXH1 |
Source of the matching boot.img and vbmeta.img |
| Magisk | github.com/topjohnwu/Magisk — Magisk-v30.7.apk |
Patch boot.img, grant root |
| Thor (Odin reimplementation) | github.com/Samsung-Loki/Thor | Flash on Linux where heimdall fails on modern Samsung |
lz4 |
distro package / nixpkgs | Decompress *.img.lz4 from the firmware tar |
Things that did not work and why, so you don’t repeat them:
- heimdall (
brew/nixpkgs) detects the device but failsbegin odinwithProtocol initialisation failed!on this Samsung — its download protocol is too old. Thor handshakes fine. - samfirm.js / samloader CLIs hit
403 / Access Deniedfrom Samsung’s FOTA server for this model+region, so the firmware was downloaded from samfw.com through a browser instead. - There is no
init_bootpartition in this firmware — the ramdisk is inboot.img(header v2). Patchboot.img, notinit_boot.img.
Step 1 — allow the unlock
Section titled “Step 1 — allow the unlock”On the phone: Settings → About phone → Software information → tap Build number 7× to unlock Developer options, then Settings → Developer options → OEM unlocking → on. If the toggle is greyed out, the phone has to be online for a while first (Samsung’s RMM/KG state); leave it on Wi-Fi with a SIM and try again later.
Confirm from a computer:
adb shell getprop sys.oem_unlock_allowed # want: 1Step 2 — unlock the bootloader (wipes the phone)
Section titled “Step 2 — unlock the bootloader (wipes the phone)”This factory-resets the device and trips Knox. On Samsung the unlock screen is not reachable with
adb reboot download — that lands in plain Odin mode, which has no unlock prompt. Use the key combo:
- Power the phone off.
- Hold Volume Up + Volume Down together and plug in the USB cable; keep holding.
- On the blue warning screen, long-press Volume Up to reach the unlock screen, then Volume Up again to confirm. The phone wipes itself and reboots.
Verify after it boots and you re-enable USB debugging:
adb shell getprop ro.boot.flash.locked # 0adb shell getprop ro.boot.verifiedbootstate # orangeadb shell getprop ro.boot.vbmeta.device_state # unlockedStep 3 — get boot.img and vbmeta.img from stock
Section titled “Step 3 — get boot.img and vbmeta.img from stock”Download the exact firmware (SM-A055M / GTO / A055MUBU5CXH1) from samfw.com. It is one big *_fac.zip
containing AP_*.tar.md5, BL, CP, CSC and HOME_CSC. You only need the AP. To avoid unpacking ~7 GB, stream
just the two images out of it:
unzip -p SAMFW.COM_SM-A055M_GTO_A055MUBU5CXH1_fac.zip 'AP_*.tar.md5' \ | tar -xv boot.img.lz4 vbmeta.img.lz4lz4 -d boot.img.lz4 boot.imglz4 -d vbmeta.img.lz4 vbmeta.imgStep 4 — patch boot.img with Magisk (headless)
Section titled “Step 4 — patch boot.img with Magisk (headless)”A racked phone has no screen to tap, so patch from the command line instead of the Magisk GUI. Unpack the APK’s
native binaries (they ship as lib*.so) and its scripts, push them with boot.img to the phone, and run
boot_patch.sh with the right flags — this is the trap that bootlooped the device the first time:
KEEPVERITY=trueandKEEPFORCEENCRYPT=true— the Magisk app sets both for Samsung. With themfalse,boot_patch.shstripsfileencryption=…,keydirectory=/metadata/…from the fstab,/datawon’t mount, and the phone reboots into the “data may be corrupt” recovery (rescue party) forever.PATCHVBMETAFLAG=true— patches the vbmeta flags inside the boot image.
# on the host, from the unpacked Magisk apk directory:mkdir mp && cd mpcp lib/arm64-v8a/libmagiskboot.so magiskbootcp lib/arm64-v8a/libmagiskinit.so magiskinitcp lib/arm64-v8a/libmagisk.so magiskcp lib/arm64-v8a/libinit-ld.so init-ldcp assets/boot_patch.sh assets/util_functions.sh assets/stub.apk .cp /path/to/boot.img .
adb push . /data/local/tmp/mpadb shell chmod 0755 /data/local/tmp/mp/magiskboot /data/local/tmp/mp/magiskinit \ /data/local/tmp/mp/magisk /data/local/tmp/mp/init-ldadb shell "cd /data/local/tmp/mp && \ KEEPVERITY=true KEEPFORCEENCRYPT=true PATCHVBMETAFLAG=true sh ./boot_patch.sh boot.img"adb pull /data/local/tmp/mp/new-boot.img new-boot.imgFailed to patch lines about the dtb during the run are normal — magiskboot patches verity in the dtb only where it
finds the pattern. What matters is Repack to boot image: [new-boot.img] at the end.
Step 5 — disable verification in vbmeta
Section titled “Step 5 — disable verification in vbmeta”With an unlocked bootloader the patched boot still needs verification off, or the phone drops to the red
“An error has occurred while updating the device software” download screen. Clear the AVB flags (byte offset 120,
set to 3 = disable verity + disable verification):
python3 - <<'PY'import structb = bytearray(open("vbmeta.img","rb").read())assert b[:4] == b"AVB0"b[120:124] = struct.pack(">I", 3)open("vbmeta_disabled.img","wb").write(b)PYStep 6 — pack an Odin tar
Section titled “Step 6 — pack an Odin tar”Odin/Thor flash tar archives whose entry names match the device’s partitions. Put the patched boot and the disabled
vbmeta in one ustar tar:
mkdir fw && cp new-boot.img fw/boot.img && cp vbmeta_disabled.img fw/vbmeta.img( cd fw && tar -H ustar -cf AP_fix.tar boot.img vbmeta.img )Keep a rollback tar with the stock boot.img + stock vbmeta.img the same way — if the phone bootloops, flash
that to get a clean, unrooted (but still unlocked) phone back without reflashing the whole firmware.
Step 7 — flash with Thor
Section titled “Step 7 — flash with Thor”heimdall cannot flash this phone; Thor (a .NET Odin reimplementation) can. Download the Linux build from its
releases, make it executable, and run it. On NixOS a foreign ELF needs an FHS wrapper (steam-run); on an ordinary
distro run it directly. Root is needed for raw USB, and the host’s cdc_acm module can grab the device in download
mode — unload it if connect finds nothing:
sudo modprobe -r cdc_acm # only if the device isn't foundsudo ./Thor-Linux # NixOS: sudo steam-run ./Thor-LinuxPut the phone in download mode first (adb reboot download, or the Volume Up + Volume Down + cable combo), then in
the Thor shell:
connectbegin odinflashTar <directory-with-AP_fix.tar>reboot normalexitPick the device at connect, tick boot and vbmeta at flashTar, confirm. reboot normal boots straight into
the system instead of shutting down. First boot with Magisk takes a minute or two; the “not running official
software” warning on boot is expected now.
Step 8 — finish Magisk and grant root
Section titled “Step 8 — finish Magisk and grant root”Install the Magisk app and open it; it asks to do additional setup and reboots once more. After that, root works,
but the adb shell user is denied by default — grant it:
adb install Magisk-v30.7.apk# in Magisk: Superuser tab → enable the toggle for "[SharedUID] Shell" (com.android.shell)adb shell su -c id # want: uid=0(root) ... context=u:r:magisk:s0That su then works from the provider’s adb too, so the host — and Holtdroid’s agent — has root on the phone.
If it bootloops
Section titled “If it bootloops”Flash the stock rollback tar from step 6 (stock boot.img + stock vbmeta.img) with Thor and reboot normal.
The phone comes up unrooted, data wiped, bootloader still unlocked; re-enable USB debugging and start again from step
4 with the correct flags. A failed flash never bricks on its own: the device stays in download mode and can always be
reflashed with full stock firmware.