Skip to content

Improve daemon failure observability and manager diagnostics - #1084

Open
zzzzyppp wants to merge 1 commit into
JingMatrix:masterfrom
zzzzyppp:fix/mipad-daemon-diagnostics
Open

zzzzyppp wants to merge 1 commit into
JingMatrix:masterfrom
zzzzyppp:fix/mipad-daemon-diagnostics

Conversation

@zzzzyppp

Copy link
Copy Markdown

Summary

This makes Vector's failure state honest and diagnosable, without changing injection behaviour.

  • Manager: adds FrameworkStatus.daemonReachable. When no daemon binder answers, the status page shows — (daemon not running) for the SELinux / system framework / dex2oat rows — instead of rendering the default false values as "not loaded / not injected" — and adds a DaemonDownCard with the two checks worth making. This matters on KernelSU/SukiSU LKM late-load boots, where post-fs-data is skipped and nothing starts.
  • Daemon: distinguishes "lock held by another process" from "lock file could not be opened" in FileSystem.tryLock(), and uses a neutral log line when the lock is already held.
  • Launcher (zygisk/module/daemon): keeps the parent shell instead of exec, captures stderr to /data/adb/lspd/log/bootstrap.log, appends vectord exited with code N, and exits with the child's status. Previously >/dev/null 2>&1 discarded every trace of a daemon that exits before main.

No sepolicy, native, API or ABI changes; no automatic restart, soft reboot, or forced activation.

Why

On a Xiaomi Pad 9 Pro Max (HyperOS 4 / Android 17) with SukiSU KernelSU LKM late-load:

  • KernelSU: post-fs-data skipped (late load) leaves the module's policy unapplied and zygote/system_server uninjected;
  • vectord is still launched from the services stage but exits before main (3 ms–3 s, no stderr), so there is no daemon at all;
  • the manager then reported "SELinux not loaded / framework not injected", which were only default values, and the launcher had discarded the exit status.

This PR is the diagnostics half. It does not attempt to fix late-load or restart system_server/zygote.

Testing

  • ./gradlew --no-daemon :daemon:assembleDebug :zygisk:assembleDebug — BUILD SUCCESSFUL.
  • ./gradlew --no-daemon :manager:assembleDebug zipAll — BUILD SUCCESSFUL (490 tasks).
  • git diff --check, sh -n zygisk/module/daemon — clean.
  • Manager/daemon ktfmtCheck — only pre-existing baseline failures.
  • On-device (an earlier debug build of this patch series): after ksud post-fs-data + zygote restart, cli status = Framework 2.2 / VersionCode 3118 / API 102 and the manager status source reports systemServerRequested=true. The manager UI itself was not re-tested with this debug-signed build (device has release-signed manager 3080).
  • Launcher exit-status path: stub app_process exiting 7 → bootstrap.log contains vectord exited with code 7, wrapper exits 7; unwritable log dir falls back to /dev/null without breaking launch.
  • The final wrapper restructuring was not re-deployed on-device; only the earlier build of this series was. Flagging that explicitly.

Notes

  • Strings are English only; translations go through Crowdin.
  • No manual version bump: the build derives versionCode from the commit count, so it becomes 3119 with this commit.

- Manager: track whether the daemon was actually reachable and render
  "— (daemon not running)" plus a DaemonDownCard when it was not, instead of
  presenting default HealthIssue values as the framework's own report.
- Daemon: log lock contention separately from IO/SELinux failures, and use a
  neutral message when another daemon already holds the lock.
- Launcher: keep the parent shell, capture stderr to
  /data/adb/lspd/log/bootstrap.log, append "vectord exited with code N", and
  propagate the exit status instead of discarding all launch evidence.

No sepolicy, native, API, or ABI changes; no automatic restart or forced
activation.
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