shevery icon indicating copy to clipboard operation
shevery copied to clipboard

Shevery keeps getting killed.

Open Spy-God opened this issue 2 months ago • 16 comments

Requirements

  • [x] I am using the latest version from GitHub Releases.
  • [x] I am using a standard, tested ROM (no custom/untested forks).
  • [x] I have searched existing issues and this is not a duplicate.
  • [x] I am providing text logs, not screenshots of logs.

Shizuku Version

latest. 2 days ago

Operation Mode

ADB Mode

Device Model & OS Version

Realme P1 5G Android 16 Realme UI 7

Steps to Reproduce

open the app and start the shivery.

And it will get killed after a while.

Even with background usage allowed to run in background.

Logcat / Crash Logs

App: Shevery 13.9.0.r38 (38) Android: 16 / SDK 36 / REL Service: stopped Server uid: -1 Server API: -1.-1 SELinux: unknown ADB permission: limited Authorized apps: 10 Local network: NEARBY_WIFI_DEVICES: granted

Spy-God avatar Sep 16 '26 17:09 Spy-God

🤖 AI Triage

Not enough information to confirm the service termination: no files were read from the repository and the provided logcat lacks daemon crash stack traces or server-side logs. Please provide the full logcat output captured while reproducing the issue.

Note: this is an automated AI bot (Gemini); its verdict isn't 100% accurate and can be wrong. The bot doesn't read or reply to further comments in this thread — if it got this wrong, ping a human maintainer.

github-actions[bot] avatar Sep 16 '26 17:09 github-actions[bot]

Image

I am using the very same issue. Shevery is allowed to run in background fully unrestricted in settings. It still keeps getting killed.

iQOO Neo 7 | OriginOS 6 | Android 16 | Shevery 13.9 r39

xd003 avatar Sep 21 '26 02:09 xd003

This started happening after the latest os update of 2.3 gb . After which this issue occurred. Now it just can't stay alive in background.

Spy-God avatar Sep 21 '26 03:09 Spy-God

Interesting. Since this is my first time using Shevery, I can’t really say whether it was caused by a recent OS update on my device. That said, it seems to be a fairly common issue across multiple Shizuku forks, even ShizukuPlus appears to be affected.

xd003 avatar Sep 21 '26 04:09 xd003

I noticed the issue is marked as "needs-info". If any additional logs, details, or testing from my side is required, please let me know. I’d really like to get to the bottom of this, as I’ve been facing the same issue for a long time across the original Shizuku as well as multiple forks.

xd003 avatar Sep 21 '26 14:09 xd003

Root Cause Analysis The recent 2+ GB OEM updates (specifically affecting ColorOS, Realme UI, and OriginOS) introduced an aggressive cgroup network-kill policy. When Android 11+ drops or switches Wi-Fi networks, the OS now executes a targeted SIGKILL on all background processes spawned under that specific Wi-Fi ADB session (uid=2000(shell)). This framework-level purge completely bypasses standard Android battery optimization whitelists, which is why setting the app to "Unrestricted" background usage no longer prevents the termination.

The Loopback Bypass (Workaround) You can bypass this limitation by forcing the ADB service off the monitored Wi-Fi interface (ports 30000-49999) and onto the device's internal offline loopback port (5555). The OEM network sweepers ignore this legacy TCP port during Wi-Fi/cellular transitions.

Run the following sequence via Termux (using the android-tools package) or a connected PC:

Turn ON Wireless Debugging in Developer Options and note your current IP and port (e.g., 192.168.x.x:39323).

Open your terminal and connect to the active Wi-Fi session:

adb kill-server adb connect 192.168.x.x:39323

Force Android's ADB daemon to open the offline TCP port: adb tcpip 5555

Note: The Wireless Debugging toggle in Android Settings may automatically switch off at this step. This is expected behavior as the daemon is shifting to the loopback.

Disconnect from the volatile Wi-Fi session:

adb disconnect

Reconnect securely via the internal offline loopback: Bash

adb connect 127.0.0.1:5555

Start Shevery over this new connection. If you are using a terminal, execute the standard Shizuku/Shevery startup script (e.g., sh /sdcard/Android/data/moe.shizuku.privileged.api/start.sh).

Once Shevery is started over 127.0.0.1:5555, the background service is permanently anchored to the device's internal hardware. It will survive all Wi-Fi disconnects, network changes, and cellular transitions 24/7.

Limitation: Android resets the tcpip 5555 state upon physical device restart. You will only need to repeat this sequence when the phone is rebooted.

Spy-God avatar Sep 25 '26 16:09 Spy-God

@Spy-God Thanks for the guide, is it working for you properly ? For me shivery still keeps getting killed

xd003 avatar Sep 26 '26 05:09 xd003

I am using termux with this https://github.com/jronminh/termux-adb-bridge

And using that technique I can keep starting shizuku.

Spy-God avatar Sep 26 '26 05:09 Spy-God

I an currently using old shizuku instead of shevery,though both get killed the same way.

Spy-God avatar Sep 26 '26 05:09 Spy-God

To be very frank, I don't think the main issue is Shevery getting killed, that could simply be our OEM's aggressive process killing. The actual problem is that the watchdog service isn't reliable in either Shevery or Shizuku+.

The best results I've had so far are with the thedjchi fork. Its watchdog works pretty solidly, except when the device is locked. It can't revive Shizuku while locked, but the moment I unlock the device, it starts Shizuku immediately.

With Shevery and Shizuku+, even unlocking the device doesn't revive Shizuku, so I have to start it manually every time, which makes the watchdog practically unusable for me.

I'll probably just fork the thedjchi version and try to get its watchdog working even while the device is locked, its has been most stable otherwise.

xd003 avatar Sep 26 '26 05:09 xd003

For me the main reason is shizuku getting killed, it mostly happens when wifi turns off.Previously even if wifi debugging was turned off the shizuku didnt turn off or get killed.

And in my device shizuku gets killed even after removing shadow killer. Currently the legacy method still works.

Spy-God avatar Sep 26 '26 05:09 Spy-God

New discovery,athena keeps killing shevery connection as soon as the screen turns off and none of the resurrection method work.

resurrection methods can use adb method to start shevery everytime it gets killed so that it doesnt have to rely on wifi debugging being enabled or wifi being present all the time.

And Hal namely a java component inside system server is the main reason for the kill. Its proprietory realme battery saving and management system.

This came into light when the app was still getting killed even after I disabled athena with shizuku plus canta. Since hal was a java system it was not possible to modify it on a unrooted device.

This is the case with realme os. Not sure about others. Maybe they have the same underlying killer.

Spy-God avatar Oct 12 '26 17:10 Spy-God

@Spy-God that's interesting to know. How are you confirming this exactly, i will try to do the same on my device and see if it's something along same lines.

xd003 avatar Oct 13 '26 02:10 xd003

I asked gemini ai to find out the issue and it gave me multiple commands to check out the logcat of the system to know what is killing what and why.

I was trying to create a script that can resurrection shevery as soon as it gets killed and then I tried to solve the root problem but failed.

Spy-God avatar Oct 13 '26 02:10 Spy-God

I have finally fixed this this issue

Cause: This wasn't Shizuku or battery optimization. When Shizuku is started over ADB, its server runs inside the process group of the system's adb service (adbd). Whenever adbd restarts, the system kills everything in that group, including Shizuku.

On my device (iQOO Neo 7, OriginOS 6), Developer options → Default USB configuration was set to File transfer. With that setting, the phone switches USB mode on every lock, unlock and cable unplug. On this ROM, every USB mode switch restarts adbd, so Shizuku was killed each time the screen locked. The watchdog could only bring it back after unlocking, because adbd stayed down while the phone was locked. Fix: Set Developer options → Default USB configuration to No data transfer. The USB mode then stays the same when you lock or unlock, adbd isn't restarted, and Shizuku keeps running. Verified: Over several lock, unlock and unplug cycles across about 9 minutes, the Shizuku server and adbd kept the same process IDs, so neither was restarted. Note: Anything else that restarts adbd will still kill Shizuku in ADB mode, such as turning USB debugging off and on, switching to File transfer from the USB notification, or adb tcpip. Starting Shizuku with root avoids this.

xd003 avatar Oct 21 '26 07:10 xd003

From the system logs provided above (Going to sleep due to power_button -> USB state teardown -> DeadSystemException), the OEM firmware (OriginOS / Realme UI) stops the adbd service when the screen locks or USB state changes. When init stops adbd, the kernel kills the entire adbd cgroup with SIGKILL. In non-root ADB mode (UID 2000), shizuku_server and the native starter supervisor lack CAP_SYS_ADMIN / root privileges to move out of adbd's cgroup, so they cannot survive an OEM-initiated adbd service stop.

On the manager side, 2398cc49 prevents redundant adb_wifi_enabled toggles and duplicate background restarts when a session or TCP port 5555 is already live. To minimize adbd teardowns on Realme UI / OriginOS:

  1. Enable TCP mode (5555) and Wi-Fi ADB Reassert in Shevery settings.
  2. Grant android.permission.WRITE_SECURE_SETTINGS so AdbStartWorker can automatically re-arm adb_wifi_enabled after unlock.
  3. Keep Auto-disable USB debugging off and enable Disable adb authorization timeout in Developer Options.

HmnDev-Tech avatar Oct 21 '26 16:10 HmnDev-Tech