termux / termux-app

Termux - a terminal emulator application for Android OS extendible by variety of packages.
https://f-droid.org/en/packages/com.termux
Other
37.05k stars 3.89k forks source link

[Not A Bug]: Android 13 allows running Termux without process phantom killing #3506

Closed freebrowser1 closed 1 year ago

freebrowser1 commented 1 year ago

Problem description

Two years ago this was detected:

> NOTICE: Termux may be unstable on Android 12+. Android OS will kill any (phantom) processes greater than 32 (limit is for all apps combined) and also kill any processes using excessive CPU. You may get [Process completed (signal 9) - press Enter] message in the terminal without actually exiting the shell process yourself. Check the related issue https://github.com/termux/termux-app/issues/2366, issue tracker, phantom cached and empty processes docs and https://github.com/termux/termux-app/issues/2366#issuecomment-1237468220 on how to disable trimming of phantom and excessive cpu usage processes. A proper docs page will be added later. An option to disable the killing should be available in Android 12L or 13, so upgrade at your own risk if you are on Android 11, specially if you are not rooted.

While I don't have a real Android 13 device, I made an emulator using Android Studio on a Mac M1, so Android runs natively ARM64 / ARMv8.

I first ran these commands from this site: https://kskroyal.com/disable-phantom-process-killer-in-android-12-13/

# These commands will disable the phantom process killer.
adb shell "/system/bin/device_config set_sync_disabled_for_tests persistent"
adb shell "/system/bin/device_config put activity_manager max_phantom_processes 2147483647"
adb shell settings put global settings_enable_monitor_phantom_procs false 

# To verify you need to run these two commands one by one.
adb shell "/system/bin/dumpsys activity settings | grep max_phantom_processes"
adb shell "/system/bin/device_config get activity_manager max_phantom_processes"

The verify returned 2147483647 (and not 32) and also after reboots, so it survives a reboot. The VM is not rooted.

Then I installed Termux, did apt update && apt upgrade -y and installed some basic Linux tools, like zip, curl, wget, etc. Then I installed the Andronix app and installed Ubuntu 22.04 unmodded with XFCE which worked flawlessly, so no processes were terminated.

Steps to reproduce the behavior.

See above.

What is the expected behavior?

No response

System information

sylirre commented 1 year ago

I guess you checked the linked article: https://github.com/agnostic-apollo/Android-Docs/blob/master/en/docs/apps/processes/phantom-cached-and-empty-processes.md. If not, read it please (everything else on Internet is typically repost from this article). We already know that phantom process killer can be disabled: currently with ADB, on Android 14+ there should be added toggle in Android developer settings.

With default configuration Termux is still considered to be unstable.

P.S. Changing max_phantom_processes on Android 13 is not needed.