install magisk gives a working root, but Zygisk can never initialise. The Magisk app shows Zygisk: No whatever the Zygisk setting is, and nothing anywhere explains why. Every Zygisk
module (LSPosed, Shamiko, PlayIntegrityFix, …) is therefore unusable.
General.install() runs:
self.copy()# writes the overlay tree; shutil.copyfile carries no exec bitself.extra1()# -> Magisk.setup() -> copytree(overlay, <data_dir>/adb/magisk)...self.set_perm()# walks only self.files, i.e. paths under copy_dir (the overlay)
set_perm() fixes the overlay copy to 0755, but never the /data/adb/magisk copy that setup() made a moment earlier — that path is not in self.files. Those binaries keep the 0644 they inherited from the apk extraction, so magisk_env() cannot execute /data/adb/magisk/magisk64 and aborts at post-fs-data.
su keeps working because it runs from the overlay copy, which is what makes this so easy to
misdiagnose as "Zygisk is unsupported on Waydroid".
The fix
setup() now applies to its own destination the same 0755 that Magisk.set_path_perm()
already applies to magisk paths. Four functional lines, plus a comment explaining the ordering
so it does not regress.
Verified
On Waydroid 1.6.3 / Android 13 (LineageOS 20 VANILLA, waydroid_x86_64) / Magisk Delta 26301,
with nothing changed but these permissions:
tests/test_magisk_setup_perms.py is self-contained — no Waydroid install, no root, no
dependencies beyond the stdlib:
$ python3 tests/test_magisk_setup_perms.py
ok test_plain_copytree_loses_exec_bit
ok test_setup_makes_data_copy_executable
ok test_setup_is_idempotent
ok test_perm_helper_tolerates_missing_dir
all 4 tests passed
Against the unpatched stuff/magisk.py it fails, so it is a real regression guard:
ok test_plain_copytree_loses_exec_bit
FAIL test_setup_makes_data_copy_executable: files left non-0755: {'magisk64': '0o644', ...}
FAIL test_setup_is_idempotent:
ERROR test_perm_helper_tolerates_missing_dir: AttributeError(... no attribute 'set_data_magisk_perm')
3 test(s) failed
This adds the first tests/ directory. Happy to drop it, move it, or wire it into CI if you
would rather it lived somewhere else.
Side note for the docs / future debugging
/debug_ramdisk is not a valid way to check whether Zygisk is up on this installer: magisk --path is /dev/magisk_<random>, so /debug_ramdisk stays empty even when Zygisk is
working. grep -c zygisk /proc/$(pgrep -f zygote64 | head -1)/maps is reliable.
Fixes #283
### The bug
`install magisk` gives a working root, but **Zygisk can never initialise**. The Magisk app shows
`Zygisk: No` whatever the Zygisk setting is, and nothing anywhere explains why. Every Zygisk
module (LSPosed, Shamiko, PlayIntegrityFix, …) is therefore unusable.
`General.install()` runs:
```python
self.copy() # writes the overlay tree; shutil.copyfile carries no exec bit
self.extra1() # -> Magisk.setup() -> copytree(overlay, <data_dir>/adb/magisk)
...
self.set_perm() # walks only self.files, i.e. paths under copy_dir (the overlay)
```
`set_perm()` fixes the **overlay** copy to `0755`, but never the `/data/adb/magisk` copy that
`setup()` made a moment earlier — that path is not in `self.files`. Those binaries keep the
`0644` they inherited from the apk extraction, so `magisk_env()` cannot execute
`/data/adb/magisk/magisk64` and aborts at `post-fs-data`.
`su` keeps working because it runs from the overlay copy, which is what makes this so easy to
misdiagnose as "Zygisk is unsupported on Waydroid".
### The fix
`setup()` now applies to its own destination the same `0755` that `Magisk.set_path_perm()`
already applies to magisk paths. Four functional lines, plus a comment explaining the ordering
so it does not regress.
### Verified
On Waydroid 1.6.3 / Android 13 (LineageOS 20 VANILLA, `waydroid_x86_64`) / Magisk Delta 26301,
with nothing changed but these permissions:
```
before: -rw-r--r-- magisk64 Zygisk: No 0 zygisk mappings in zygote64
after: -rwxr-xr-x magisk64 Zygisk: Yes 6 zygisk mappings in zygote64
/cache/magisk.log after:
zygisk64: replaced com/android/internal/os/Zygote#nativeForkAndSpecialize
zygisk64: replaced com/android/internal/os/Zygote#nativeForkSystemServer
zygisk64: replaced com/android/internal/os/Zygote#nativeSpecializeAppProcess
```
Zygisk modules then install and load normally.
### Test
`tests/test_magisk_setup_perms.py` is self-contained — no Waydroid install, no root, no
dependencies beyond the stdlib:
```
$ python3 tests/test_magisk_setup_perms.py
ok test_plain_copytree_loses_exec_bit
ok test_setup_makes_data_copy_executable
ok test_setup_is_idempotent
ok test_perm_helper_tolerates_missing_dir
all 4 tests passed
```
Against the unpatched `stuff/magisk.py` it fails, so it is a real regression guard:
```
ok test_plain_copytree_loses_exec_bit
FAIL test_setup_makes_data_copy_executable: files left non-0755: {'magisk64': '0o644', ...}
FAIL test_setup_is_idempotent:
ERROR test_perm_helper_tolerates_missing_dir: AttributeError(... no attribute 'set_data_magisk_perm')
3 test(s) failed
```
This adds the first `tests/` directory. Happy to drop it, move it, or wire it into CI if you
would rather it lived somewhere else.
### Side note for the docs / future debugging
`/debug_ramdisk` is not a valid way to check whether Zygisk is up on this installer:
`magisk --path` is `/dev/magisk_<random>`, so `/debug_ramdisk` stays empty even when Zygisk is
working. `grep -c zygisk /proc/$(pgrep -f zygote64 | head -1)/maps` is reliable.
wbruno
merged commit b7e1c37e14 into main2026-10-12 14:00:20 -04:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Fixes #283
The bug
install magiskgives a working root, but Zygisk can never initialise. The Magisk app showsZygisk: Nowhatever the Zygisk setting is, and nothing anywhere explains why. Every Zygiskmodule (LSPosed, Shamiko, PlayIntegrityFix, …) is therefore unusable.
General.install()runs:set_perm()fixes the overlay copy to0755, but never the/data/adb/magiskcopy thatsetup()made a moment earlier — that path is not inself.files. Those binaries keep the0644they inherited from the apk extraction, somagisk_env()cannot execute/data/adb/magisk/magisk64and aborts atpost-fs-data.sukeeps working because it runs from the overlay copy, which is what makes this so easy tomisdiagnose as "Zygisk is unsupported on Waydroid".
The fix
setup()now applies to its own destination the same0755thatMagisk.set_path_perm()already applies to magisk paths. Four functional lines, plus a comment explaining the ordering
so it does not regress.
Verified
On Waydroid 1.6.3 / Android 13 (LineageOS 20 VANILLA,
waydroid_x86_64) / Magisk Delta 26301,with nothing changed but these permissions:
Zygisk modules then install and load normally.
Test
tests/test_magisk_setup_perms.pyis self-contained — no Waydroid install, no root, nodependencies beyond the stdlib:
Against the unpatched
stuff/magisk.pyit fails, so it is a real regression guard:This adds the first
tests/directory. Happy to drop it, move it, or wire it into CI if youwould rather it lived somewhere else.
Side note for the docs / future debugging
/debug_ramdiskis not a valid way to check whether Zygisk is up on this installer:magisk --pathis/dev/magisk_<random>, so/debug_ramdiskstays empty even when Zygisk isworking.
grep -c zygisk /proc/$(pgrep -f zygote64 | head -1)/mapsis reliable.