Skip to content

fix(magisk): scrub any competing /system/xbin/su; Verify fails on a non-Magisk su#17

Merged
Jordan231111 merged 1 commit into
mainfrom
fix/scrub-competing-su-verify
Jun 2, 2026
Merged

fix(magisk): scrub any competing /system/xbin/su; Verify fails on a non-Magisk su#17
Jordan231111 merged 1 commit into
mainfrom
fix/scrub-competing-su-verify

Conversation

@Jordan231111

Copy link
Copy Markdown
Owner

Symptom

Magisk shows "Abnormal State — a su binary not from Magisk has been detected" on a freshly-rooted instance.

Root cause (investigated per "look at the last commits")

  • The competing su is /system/xbin/su — sha 185106…, 2,012,872 B = the engine''s classic-su binary (the old root method), left in the shared master Root.vhd.
  • Git proves no commit changed su handling: bsr_magisk.ps1 has only two commits ever (ac2af27 + the adb fix), and the only commit touching system/xbin/su is ac2af27. The v11 adb fix didn''t write any su — it just let the pipeline complete, so Magisk finally booted and flagged the pre-existing leftover.
  • Where that su came from: tests/Run-Live-E2E.ps1 rooted via the engine''s legacy classic-su path (-Action AdbRoot), which installs a setuid /system/xbin/su. Running it (a prior background re-root E2E) planted the su in the master.
  • Two real gaps: Prep/Clean scrubbed only the bootstrap su (bsr_su), never a pre-existing /system/xbin/su; and Verify only swept for bsr_su''s hash, so a competing su passed silently.

Fix

  • Prep + Clean now rm /system/xbin/su (+daemonsu) in the offline carve. Magisk''s own su (/system/bin/su→magisk, /sbin/su→magisk) is the only one. Re-running Clean repairs an already-rooted instance.
  • Verify enumerates every su in the standard PATH dirs and FAILS on any that isn''t a symlink to magisk (new pure, unit-tested Find-StraySu). The scan is pushed as a script file (the inline loop''s ; didn''t survive PS→adb→device quoting).
  • Run-Live-E2E.ps1 rewritten to drive the shipped bsr_magisk.ps1 -Action Auto pipeline and assert VERIFY PASS + no competing su across a reboot — correct package io.github.huskydg.magisk, revert via Magisk Undo. (It previously planted the competing su via classic-su.)

Verified live (Tiramisu64_9)

  • Enhanced Clean scrubbed /system/xbin/su (stat → File not found), Root.vhd updated.
  • Verify then reported competing su: noneVERIFY PASS (su -c id→uid=0, /system/bin/su./magisk, no bsr_su traces).

Tests

  • Run-Resolve-Tests.ps1: +7 Find-StraySu cases → 38/38
  • Run-Tests.ps128/28; Check-Embedded-Sync.ps1 in sync (re-embedded blueStackRoot.cmd)

…on-Magisk su

Magisk reported "Abnormal State -- a su binary not from Magisk has been
detected" on an instance whose shared master still carried a classic/engine
su at /system/xbin/su (sha 185106.../2012872B). The Magisk pipeline scrubbed
only its own bootstrap su (bsr_su) and Verify only swept for bsr_su's hash,
so a competing su passed silently. Git confirms NO commit ever changed su
handling (bsr_magisk.ps1: only ac2af27 + the adb fix); the adb fix simply let
the pipeline complete so Magisk booted and flagged the pre-existing leftover.
Root source of that su: the legacy Run-Live-E2E injected it via the engine's
classic-su path (-Action AdbRoot).

- Prep + Clean: rm /system/xbin/su (+ daemonsu) in the offline carve, so
  Magisk's su (/system/bin/su->magisk, /sbin/su->magisk) is the only one.
  Re-running Clean repairs an already-rooted instance.
- Verify: enumerate every su in the standard PATH dirs and FAIL on any that
  is not a symlink to magisk (new pure, unit-tested Find-StraySu). su scan is
  pushed as a script file (the inline loop's ';' didn't survive PS->adb quoting).
- Run-Live-E2E.ps1: rewritten to drive bsr_magisk.ps1 -Action Auto (the shipped
  pipeline) and ASSERT VERIFY PASS + no competing su across a reboot; correct
  package io.github.huskydg.magisk; revert via Magisk Undo. (It used to root via
  the classic-su path, which planted the competing su.)
- Run-Resolve-Tests: +7 Find-StraySu cases (38). Run-Tests (28) + Check-Embedded-Sync green.

Live-verified on Tiramisu64_9: Clean scrubbed the stray su; Verify then reported
competing su: none -> VERIFY PASS.
@Jordan231111 Jordan231111 merged commit bae454b into main Jun 2, 2026
1 check passed
@Jordan231111 Jordan231111 deleted the fix/scrub-competing-su-verify branch June 2, 2026 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant