Skip to content

Query Magisk su-policy DB without the bundled 32-bit sqlite3 - #91

Open
Loukious wants to merge 1 commit into
zalexdev:mainfrom
Loukious:fix/sqlite3-magisk-sqlite
Open

Query Magisk su-policy DB without the bundled 32-bit sqlite3#91
Loukious wants to merge 1 commit into
zalexdev:mainfrom
Loukious:fix/sqlite3-magisk-sqlite

Conversation

@Loukious

@Loukious Loukious commented Sep 7, 2026

Copy link
Copy Markdown

Problem

Every app launch logs this error (visible in Settings → Debug):

/data/data/com.zalexdev.stryker/files/sqlite3: not executable: 32-bit ELF file

checkMagiskNotification() / disableMagiskNotification() unconditionally
shell out to the sqlite3 binary bundled in assets, which is a 32-bit ARM
ELF
. Devices that ship 64-bit-only arm64 builds (no 32-bit ABI support —
increasingly common on new hardware) cannot exec it at all, so the
Magisk su-notification check fails on every launch.

Fix

Both methods now go through a new private magiskSql(String) helper with a
fallback chain:

  1. magisk --sqlite "..." — Magisk 20.3+ ships its own sqlite frontend that works on every arch
  2. No /data/adb/magisk.db? → return empty immediately. KernelSU, KernelSU-Next, APatch and other managers have no Magisk policy DB at all — shelling out can never produce a useful result, so don't
  3. /system/bin/sqlite3 — some ROMs ship a native sqlite3; prefer it over the bundled binary
  4. Bundled 32-bit binary — last resort, still works on 32-bit devices

Verification

On a 64-bit-only arm64 device (Android 17, KernelSU-Next):

  • Fresh launch logs show the new probe sequence: [ -x /data/adb/magisk ] → false, [ -f /data/adb/magisk.db ] → false → early return, no sqlite3 exec attempt
  • Zero sqlite3 / not executable entries in the debug log DB after relaunch
  • On Magisk 20.3+ devices branch 1 is exercised instead (binary verified present/runnable on-device where available)

checkMagiskNotification()/disableMagiskNotification() always shelled out
to the sqlite3 binary bundled in assets, which is a 32-bit ARM ELF. On
64-bit-only arm64 devices the kernel refuses to exec it
("not executable: 32-bit ELF file"), so the su-notification check
failed on every app launch.

Route both methods through a new magiskSql() helper with a fallback
chain:
- `magisk --sqlite` (Magisk 20.3+ ships its own frontend, any arch)
- no /data/adb/magisk.db -> return empty (KernelSU and other managers
  have no policy DB; don't shell out at all)
- /system/bin/sqlite3 when the ROM ships one
- bundled 32-bit binary as last resort for 32-bit devices

Verified on a KernelSU-Next device (64-bit-only, Android 17): the
probes now resolve to false/false and return immediately, with zero
sqlite3 errors in the debug log DB.
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