termux / termux-app

Termux - a terminal emulator application for Android OS extendible by variety of packages.

Home Page:https://f-droid.org/en/packages/com.termux

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: Android 12 Phantom Processes Killed "[Process completed (signal 9) - press Enter]"

V-no-A opened this issue · comments

Edit: Check this comment for solution.


Problem description

I get a message saying [Process completed (signal 9) - press Enter] at, seemingly, random intervals. Once I press Enter, Termux closes. This may happen while I am running a Python script or simply under the "Welcome to Termux!" text after leaving Termux idle for a while (leaving the app/turning off the screen) and not having run any commands.

Steps to reproduce the behavior.

I upgraded my Pixel 3a phone to Android 12 and downloaded Termux from F-Droid as well as Termux:API. I did the termux-setup-storage command and gave the app unrestricted battery usage under the Android Apps settings. Lastly, I installed Python using pkg install python.

What is the expected behavior?

Previously, on Android 11, I had installed Termux from the Google Play Store. Not once did I ever get that [Process completed (signal 9) - press Enter] message. I was able to leave Termux running in the background indefinitely.

System information

  • Termux application version:
    0.117
  • Android OS version:
    12
  • Device model:
    PIxel 3a

Do you get anymessages in an adb logcat when termux is killed?

adb logcat

I'm looking at the logcat.txt file right now but I do not know exactly what I should be looking for since this is my introduction to them.

What should I show you? Everything around the time that I hit Enter? Or everything since I open up Termux up to when I get the "[Process completed (signal 9) - press Enter]" message?

Something like all messages from when termux is killed and 15 s before and after should be interesting (you could also share the entire log if you are confident it does not contain sensitive information).

What I am curious about is if there is any messages from "android"/"system"/"low memory killer" or something else that indicates that termux is killed, and in that case why.

I don't think any maintainer has a device with android 12 yet, so might be specific for recent android versions

Something like all messages from when termux is killed and 15 s before and after should be interesting (you could also share the entire log if you are confident it does not contain sensitive information).

I'll do the 15 seconds before and after since I'm not confident the entire log won't contain anything I wouldn't want public. I'll show more if needed. Though it'll have to be in 12 hours or so.

I don't think any maintainer has a device with android 12 yet, so might be specific for recent android versions

I'm leaning on it being Android 12 related. Reason I reinstalled Termux was because I got an error on it (cannot recall if it was this same one) right after I updated the phone. I was looking for a reason to change to the F-Droid version from the Google Store and did it immediately without thinking much about the message I got.

Sorry, I was having a hard time getting the error message again.

Since I did not exactly know what to include from the logcat, I created and ran a Python script that writes the time to a txt file. The last written time was "2021-10-29 16:25:52.242" before being interrupted by [Process completed (signal 9) - press Enter] once again. Here are a few messages at and around that time:

10-29 16:25:50.345  3942  4103 D SharedPreferencesImpl: Time required to fsync /data/user/0/com.weather.Weather/shared_prefs/ALCrashTracker.xml: [<1: 5, <2: 62, <4: 104, <8: 767, <16: 78, <32: 2, <64: 4, <128: 1, <256: 1, <512: 0, <1024: 0, <2048: 0, <4096: 0, <8192: 0, <16384: 0, >=16384: 0]
10-29 16:25:52.246  1664  1834 I ActivityManager: Killing PhantomProcessRecord {4cb7847 6789:17247:python/u0a383}: Trimming phantom processes
10-29 16:25:52.247  1664  1834 I ActivityManager: Killing PhantomProcessRecord {7320874 6756:17247:bash/u0a383}: Trimming phantom processes
10-29 16:25:52.256  1664  1848 I libprocessgroup: Successfully killed process cgroup uid 10383 pid 6789 in 0ms
10-29 16:25:52.257  1664  1848 I ActivityManager: Process PhantomProcessRecord {7320874 6756:17247:bash/u0a383} died
10-29 16:25:52.257  1664  1848 I ActivityManager: Process PhantomProcessRecord {4cb7847 6789:17247:python/u0a383} died
10-29 16:25:52.257  1664  1848 I libprocessgroup: Successfully killed process cgroup uid 10383 pid 6756 in 0ms
10-29 16:26:06.077  3750  4042 I WorkerManager: dispose()
10-29 16:26:13.233   968  1224 I CHRE    : @ 9785.504: [ImuCal] [NanoSensorCal:GYRO_RPS] Offset | Temperature [C]: 0.000231, -0.000705, -0.001613 | 38.16

I should've probably mentioned, although wakelock was on, I have gotten the message with it turned off.
And, even though this happened while running the Python script, this has happened (like mentioned before) while just having Termux idle:
Screenshot_20211029-025556

@V-no-A You should use logcat within ADB and not under Termux, as the latter will hide information about system activity.

P.S. On Pixel 5 with Android 12 it doesn't get suddenly killed.

@xeffyr I thought I used logcat within ADB. I ran adb logcat > logcat.txt on Windows and copied and pasted those several lines from the txt file. Can you point me to tutorial of how I am supposed to being doing this?

I ran adb logcat > logcat.txt on Windows

Then ok. But log is still too short, try capturing about 30 lines.


Btw, I'm running now overnight test for this issue, leaving Termux just opened with no utilities running except shell. Screen off, no wakelock, recent apps list cleared.

Android 12 via 15755084 and updated via 5706277f has added a mechanism to monitor forked child processes started by apps and kills them if they consume too much CPU if app is in background.

Track the child processes that are forked by app processes

Apps could use Runtime.exec() to spawn child process and framework
will have no idea about its lifecycle. Now track those processes
whenever we find them - currently during the cpu stats sampling
they could be spotted. If it's consuming too much CPU while its
parent app process are also in the background, kill it.

By default we allow up to 32 such processes; the process with the
worst oom adj score of their parents will be killed if there are
too many of them.

Check PhantomProcessList commit history here. The Trimming phantom processes log entry is from here.

Basically, not a Termux issue and users upgrading to android 12 should expect killing of background processes even from AOSP, like OEM crazy killing wasn't enough.

When you detect the killing, you can run adb logcat -d > logcat.txt to dump the entire logcat buffer instead of starting realtime monitoring. And are you sure you are not starting some other processes, like a sshd daemon, etc or something else, check ps -ef.

Then ok. But log is still too short, try capturing about 30 lines.

Will do.

Btw, I'm running now overnight test for this issue, leaving Termux just opened with no utilities running except shell. Screen off, no wakelock, recent apps list cleared.

I think I always had at least 2 other apps in my recent list.

When you detect the killing, you can run adb logcat -d > logcat.txt to dump the entire logcat buffer instead of starting realtime monitoring.

Thanks for that. Is it advisable to share the whole logcat or should I actually spend several minutes going through and remove lines that might contain sensitive information?

And are you sure you are not starting some other processes, like a sshd demon, etc or something else, check ps -ef.

All I use Termux for is to run Python scripts inside my downloads directory. Here is that message after running ps -ef and while having 7 other apps opened in the background with the screen turned off (several minutes passed between running ps -ef and receiving that message):
Screenshot_20211029-195259

I haven't looked much at the code, but it seems that 32 process limit may be for phantom processes of all apps combined, so termux processes may get killed even if other apps have background processes running. But even if the limit were to be per app, then even then, termux would still be limited to max 32 processes, which may get killed anytime android decides.

Post output of following to see if there are other phantom processes running. What are your other apps doing?

adb shell "/system/bin/dumpsys activity settings | grep max_phantom_processes"
adb shell "/system/bin/dumpsys activity processes -a"

Or if you want to run from inside termux, first grant one time permissions over adb. You will require github actions debug build, or wait till v0.118 is released. PACKAGE_USAGE_STATS was recently requested via 865f29d, DUMP was available in v0.109.

adb shell pm grant com.termux android.permission.PACKAGE_USAGE_STATS
adb shell pm grant com.termux android.permission.DUMP

then run

/system/bin/dumpsys activity settings | grep max_phantom_processes
/system/bin/dumpsys activity processes -a

The -a flag minimizes the output. The ActivityManagerService dumps phantom processes list and it should show entries for All Active App Child Processes and All Zombie App Child Processes.

$ adb shell "/system/bin/dumpsys activity settings | grep max_phantom_processes"
  max_phantom_processes=32

$ adb shell "/system/bin/dumpsys activity processes -a"
...
All Active App Child Processes:
    proc #0: PhantomProcessRecord {747692e 7216:6914:bash/u0a147}
      user #0 uid=10147 pid=7216 ppid=6914 knownSince=-29m34s22ms killed=false
      lastCpuTime=20 timeUsed=+30ms oom adj=0 seq=16

I can reproduce the issue by running following. Sometimes termux gets killed as soon as I run the loop while its still in foreground, sometimes when I switch to another app and come back, and sometimes takes a few minutes. The frequency of sampling for the processes usage is likely the cause, considering that All Active App Child Processes does not get updated quickly.

for i in $(seq 40); do
sha256sum /dev/zero &
done

You can monitor cpu usage with top command and run killall sha256sum to kill the processes started.

Basically, unless this is somehow fixed or exempted, this would be like the end of termux (and tasker) or at least will be very unreliable. This should be reported to google since this is just crazy, possibly crazier than OEM killing.

Edit: It also happens with battery optimizations disabled for termux, don't see any related code either. Adaptive battery disabled too.

dumpsys activity processes log
  All Active App Child Processes:
    proc #0: PhantomProcessRecord {304e913 12355:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12355 ppid=6914 knownSince=-12s230ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #1: PhantomProcessRecord {fcd3750 12356:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12356 ppid=6914 knownSince=-12s230ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #2: PhantomProcessRecord {91b1d49 12357:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12357 ppid=6914 knownSince=-12s229ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #3: PhantomProcessRecord {2ede64e 12358:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12358 ppid=6914 knownSince=-12s229ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #4: PhantomProcessRecord {9cb036f 12359:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12359 ppid=6914 knownSince=-12s229ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #5: PhantomProcessRecord {d56787c 12360:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12360 ppid=6914 knownSince=-12s229ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #6: PhantomProcessRecord {26f4505 12361:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12361 ppid=6914 knownSince=-12s229ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #7: PhantomProcessRecord {746195a 12362:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12362 ppid=6914 knownSince=-12s229ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #8: PhantomProcessRecord {a2e678b 12363:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12363 ppid=6914 knownSince=-12s229ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #9: PhantomProcessRecord {9d0a068 12364:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12364 ppid=6914 knownSince=-12s229ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #10: PhantomProcessRecord {7242c81 12365:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12365 ppid=6914 knownSince=-12s229ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #11: PhantomProcessRecord {cbc7126 12366:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12366 ppid=6914 knownSince=-12s229ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #12: PhantomProcessRecord {19f167 12367:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12367 ppid=6914 knownSince=-12s229ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #13: PhantomProcessRecord {f435b14 12368:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12368 ppid=6914 knownSince=-12s228ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #14: PhantomProcessRecord {ae60fbd 12369:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12369 ppid=6914 knownSince=-12s228ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #15: PhantomProcessRecord {5ee79b2 12370:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12370 ppid=6914 knownSince=-12s228ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #16: PhantomProcessRecord {14a3d03 12371:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12371 ppid=6914 knownSince=-12s228ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #17: PhantomProcessRecord {e851480 12372:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12372 ppid=6914 knownSince=-12s228ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #18: PhantomProcessRecord {5e8eab9 12373:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12373 ppid=6914 knownSince=-12s228ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #19: PhantomProcessRecord {fc67efe 12374:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12374 ppid=6914 knownSince=-12s228ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #20: PhantomProcessRecord {8a9a65f 12375:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12375 ppid=6914 knownSince=-12s228ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #21: PhantomProcessRecord {d66f8ac 12376:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12376 ppid=6914 knownSince=-12s228ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #22: PhantomProcessRecord {5a47975 12377:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12377 ppid=6914 knownSince=-12s228ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #23: PhantomProcessRecord {9878d0a 12378:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12378 ppid=6914 knownSince=-12s228ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #24: PhantomProcessRecord {b6c497b 12379:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12379 ppid=6914 knownSince=-12s228ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #25: PhantomProcessRecord {ba0f398 12380:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12380 ppid=6914 knownSince=-12s227ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #26: PhantomProcessRecord {d5037f1 12381:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12381 ppid=6914 knownSince=-12s227ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #27: PhantomProcessRecord {1996fd6 12382:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12382 ppid=6914 knownSince=-12s227ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #28: PhantomProcessRecord {3ec0257 12383:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12383 ppid=6914 knownSince=-12s227ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #29: PhantomProcessRecord {a7db144 12384:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12384 ppid=6914 knownSince=-12s227ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #30: PhantomProcessRecord {21f622d 12385:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12385 ppid=6914 knownSince=-12s227ms killed=false
      lastCpuTime=0 oom adj=0 seq=48
    proc #31: PhantomProcessRecord {314b362 12386:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=12386 ppid=6914 knownSince=-12s227ms killed=false
      lastCpuTime=0 oom adj=0 seq=48

  All Zombie App Child Processes:
    proc #0: PhantomProcessRecord {244efbb 11686:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=11686 ppid=6914 knownSince=-10m12s335ms killed=true
      lastCpuTime=0 oom adj=0 seq=45
    proc #1: PhantomProcessRecord {98b26d3 11827:6914:sha256sum/u0a147}
      user #0 uid=10147 pid=11827 ppid=69

Is it advisable to share the whole logcat or should I actually spend several minutes going through and remove lines that might contain sensitive information?

Well that is the question. Its advisable to review it first, but one may not always know what's sensitive.

So based on device_config shell command for the activity_manager namespace and max_phantom_processes key, which when updated, triggers PhantomProcessList.trimPhantomProcessesIfNecessary(), you can change the behaviour and it might be possible to disable it entirely based on the for loop in source code by setting max_phantom_processes to Integer.MAX_VALUE (2147483647). The setting seemed to survive on reboot but after a while got set back to default 32 and termux bash got killed, but maybe it normally resets after reboot, so I set it again. I haven't tested much if it actually works, but seems to be working, but needs more testing, someone should do it on a real device. If it keeps resetting, then that may be a problem. Not sure what (harm) adb shell "/system/bin/device_config set_sync_disabled_for_tests persistent" would do, it disables syncing, as per modes and used by tests and prevents setting all configs, added in ad3d45a. State can be checked with adb shell "/system/bin/device_config is_sync_disabled_for_tests".

# set value
adb shell "/system/bin/device_config put activity_manager max_phantom_processes 2147483647"

# get value
adb shell "/system/bin/dumpsys activity settings | grep max_phantom_processes"
# or (will be null initially)
adb shell "/system/bin/device_config get activity_manager max_phantom_processes"

Edit: As per below comment, this will only help prevent trimming, processes using excessive CPU will still get killed.

Btw, I'm running now overnight test for this issue, leaving Termux just opened with no utilities running except shell.

Everything went ok, Termux is not killed (expected).

Screenshot_20211030-095942

Device info:

Application version:
0.117-gda6174e
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://termux.astra.in.ua/apt/termux-main stable main
Updatable packages:
pcre2/stable 10.39 aarch64 [upgradable from: 10.38]
Android version:
12
Kernel build information:
Linux localhost 4.19.191-gc2161d44afae-ab7624114 #1 SMP PREEMPT Mon Aug 9 09:02:05 UTC 2021 aarch64 Android
Device manufacturer:
Google
Device model:
Pixel 5

Don't see any additional changes in android12-release branch and I'm using latest avd image sdk_gphone64_x86_64-userdebug 12 SE1A.211012.001 7818354 dev-keys, which has Nov 5, 2021 patch. Official releases build tags are here.

For more proof its happening, posting detailed info below.

Note that bash was started with pid 5683 and logcat logs the killing.

I ActivityManager: Killing PhantomProcessRecord {9ccd0ab 5683:5641:bash/u0a147}: Trimming phantom processes
I libprocessgroup: Successfully killed process cgroup uid 10147 pid 5683 in 0ms
I ActivityManager: Process PhantomProcessRecord {9ccd0ab 5683:5641:bash/u0a147} died
Transcript to start 1 bash process + 40 sha256sum processes
~ $ ps -ef
UID        PID  PPID  C STIME TTY          TIME CMD
u0_a147   5641   340  5  1970 ?        00:00:02 com.termux
u0_a147   5683  5641  0  1970 pts/0    00:00:00 /data/data/com.termux/files/usr/bin/bash
u0_a147   5728  5683  1  1970 pts/0    00:00:00 ps -ef
~ $ for i in $(seq 40); do sha256sum /dev/zero & done
[1] 5731
[2] 5732
[3] 5733
[4] 5734
[5] 5735
[6] 5736
[7] 5737
[8] 5738
[9] 5739
[10] 5740
[11] 5741
[12] 5742
[13] 5743
[14] 5744
[15] 5745
[16] 5746
[17] 5747
[18] 5748
[19] 5749
[20] 5750
[21] 5751
[22] 5752
[23] 5753
[24] 5754
[25] 5755
[26] 5756
[27] 5757
[28] 5758
[29] 5759
[30] 5760
[31] 5761
[32] 5762
[33] 5763
[34] 5764
[35] 5765
[36] 5766
[37] 5767
[38] 5768
[39] 5769
[40] 5770
~ $
[Process completed (signal 9) - press Enter]
Logcat showing 9 phantom processes trimmed
I ActivityManager: Killing PhantomProcessRecord {9ccd0ab 5683:5641:bash/u0a147}: Trimming phantom processes
I ActivityManager: Killing PhantomProcessRecord {30b2308 5731:5641:sha256sum/u0a147}: Trimming phantom processes
I ActivityManager: Killing PhantomProcessRecord {9a8aa1 5732:5641:sha256sum/u0a147}: Trimming phantom processes
I libprocessgroup: Successfully killed process cgroup uid 10147 pid 5683 in 0ms
I ActivityManager: Killing PhantomProcessRecord {19044c6 5733:5641:sha256sum/u0a147}: Trimming phantom processes
I ActivityManager: Killing PhantomProcessRecord {685cc87 5734:5641:sha256sum/u0a147}: Trimming phantom processes
I libprocessgroup: Successfully killed process cgroup uid 10147 pid 5731 in 0ms
I ActivityManager: Killing PhantomProcessRecord {2b367b4 5735:5641:sha256sum/u0a147}: Trimming phantom processes
I libprocessgroup: Successfully killed process cgroup uid 10147 pid 5732 in 0ms
I ActivityManager: Killing PhantomProcessRecord {9342fdd 5736:5641:sha256sum/u0a147}: Trimming phantom processes
I libprocessgroup: Successfully killed process cgroup uid 10147 pid 5733 in 0ms
I ActivityManager: Killing PhantomProcessRecord {3bbe752 5737:5641:sha256sum/u0a147}: Trimming phantom processes
I libprocessgroup: Successfully killed process cgroup uid 10147 pid 5734 in 0ms
I ActivityManager: Killing PhantomProcessRecord {2e8aa23 5738:5641:sha256sum/u0a147}: Trimming phantom processes
I libprocessgroup: Successfully killed process cgroup uid 10147 pid 5735 in 0ms
I libprocessgroup: Successfully killed process cgroup uid 10147 pid 5736 in 0ms
I libprocessgroup: Successfully killed process cgroup uid 10147 pid 5737 in 0ms
I libprocessgroup: Successfully killed process cgroup uid 10147 pid 5738 in 0ms
I ActivityManager: Process PhantomProcessRecord {9ccd0ab 5683:5641:bash/u0a147} died
I ActivityManager: Process PhantomProcessRecord {2e8aa23 5738:5641:sha256sum/u0a147} died
I init    : Untracked pid 5738 received signal 9
I ActivityManager: Process PhantomProcessRecord {9342fdd 5736:5641:sha256sum/u0a147} died
I ActivityManager: Process PhantomProcessRecord {685cc87 5734:5641:sha256sum/u0a147} died
I ActivityManager: Process PhantomProcessRecord {19044c6 5733:5641:sha256sum/u0a147} died
I init    : Untracked pid 5734 received signal 9
I init    : Untracked pid 5736 received signal 9
I init    : Untracked pid 5733 received signal 9
I ActivityManager: Process PhantomProcessRecord {30b2308 5731:5641:sha256sum/u0a147} died
I init    : Untracked pid 5731 received signal 9
I ActivityManager: Process PhantomProcessRecord {9a8aa1 5732:5641:sha256sum/u0a147} died
I ActivityManager: Process PhantomProcessRecord {2b367b4 5735:5641:sha256sum/u0a147} died
I ActivityManager: Process PhantomProcessRecord {3bbe752 5737:5641:sha256sum/u0a147} died
I init    : Untracked pid 5732 received signal 9
I init    : Untracked pid 5735 received signal 9
I init    : Untracked pid 5737 received signal 9
Remaining 32 tracked phantom processes
  All Active App Child Processes:
    proc #0: PhantomProcessRecord {c1b29f4 5739:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5739 ppid=5641 knownSince=-56s278ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #1: PhantomProcessRecord {511651d 5740:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5740 ppid=5641 knownSince=-56s278ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #2: PhantomProcessRecord {6a51392 5741:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5741 ppid=5641 knownSince=-56s278ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #3: PhantomProcessRecord {52c0163 5742:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5742 ppid=5641 knownSince=-56s277ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #4: PhantomProcessRecord {1baf160 5743:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5743 ppid=5641 knownSince=-56s277ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #5: PhantomProcessRecord {2643619 5744:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5744 ppid=5641 knownSince=-56s277ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #6: PhantomProcessRecord {d7cd6de 5745:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5745 ppid=5641 knownSince=-56s277ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #7: PhantomProcessRecord {55350bf 5746:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5746 ppid=5641 knownSince=-56s277ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #8: PhantomProcessRecord {9cdc38c 5747:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5747 ppid=5641 knownSince=-56s277ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #9: PhantomProcessRecord {8791ad5 5748:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5748 ppid=5641 knownSince=-56s277ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #10: PhantomProcessRecord {77b82ea 5749:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5749 ppid=5641 knownSince=-56s277ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #11: PhantomProcessRecord {c7639db 5750:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5750 ppid=5641 knownSince=-56s277ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #12: PhantomProcessRecord {e598c78 5751:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5751 ppid=5641 knownSince=-56s277ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #13: PhantomProcessRecord {1bd8f51 5752:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5752 ppid=5641 knownSince=-56s277ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #14: PhantomProcessRecord {906e3b6 5753:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5753 ppid=5641 knownSince=-56s277ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #15: PhantomProcessRecord {61498b7 5754:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5754 ppid=5641 knownSince=-56s276ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #16: PhantomProcessRecord {1d6f824 5755:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5755 ppid=5641 knownSince=-56s276ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #17: PhantomProcessRecord {7facf8d 5756:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5756 ppid=5641 knownSince=-56s276ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #18: PhantomProcessRecord {5158542 5757:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5757 ppid=5641 knownSince=-56s276ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #19: PhantomProcessRecord {bd00953 5758:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5758 ppid=5641 knownSince=-56s276ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #20: PhantomProcessRecord {39d7290 5759:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5759 ppid=5641 knownSince=-56s276ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #21: PhantomProcessRecord {e51d789 5760:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5760 ppid=5641 knownSince=-56s276ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #22: PhantomProcessRecord {57ab38e 5761:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5761 ppid=5641 knownSince=-56s276ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #23: PhantomProcessRecord {5c7e7af 5762:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5762 ppid=5641 knownSince=-56s276ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #24: PhantomProcessRecord {f0f27bc 5763:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5763 ppid=5641 knownSince=-56s276ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #25: PhantomProcessRecord {ef76345 5764:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5764 ppid=5641 knownSince=-56s276ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #26: PhantomProcessRecord {bf27a9a 5765:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5765 ppid=5641 knownSince=-56s276ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #27: PhantomProcessRecord {4b54fcb 5766:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5766 ppid=5641 knownSince=-56s275ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #28: PhantomProcessRecord {18503a8 5767:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5767 ppid=5641 knownSince=-56s275ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #29: PhantomProcessRecord {8afeec1 5768:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5768 ppid=5641 knownSince=-56s275ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #30: PhantomProcessRecord {7eda666 5769:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5769 ppid=5641 knownSince=-56s275ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
    proc #31: PhantomProcessRecord {1c71da7 5770:5641:sha256sum/u0a147}
      user #0 uid=10147 pid=5770 ppid=5641 knownSince=-56s275ms killed=false
      lastCpuTime=0 oom adj=0 seq=13
App and Device Info

Termux App Info

APP_NAME: Termux
PACKAGE_NAME: com.termux
VERSION_NAME: 0.117
VERSION_CODE: 117
UID: 10147
TARGET_SDK: 28
IS_DEBUGGABLE_BUILD: true
APK_RELEASE: Github
SIGNING_CERTIFICATE_SHA256_DIGEST: B6DA01480EEFD5FBF2CD3771B8D1021EC791304BDD6C4BF41D3FAABAD48EE5E1

Device Info

Software

OS_VERSION: 5.10.43-android12-9-00031-g02d62d5cece1-ab7792588
SDK_INT: 31
RELEASE: 12
ID: SE1A.211012.001
DISPLAY: sdk_gphone64_x86_64-userdebug 12 SE1A.211012.001 7818354 dev-keys
INCREMENTAL: 7818354
SECURITY_PATCH: 2021-11-05
IS_DEBUGGABLE: 1
IS_EMULATOR: 1
IS_TREBLE_ENABLED: true
TYPE: userdebug
TAGS: dev-keys

Hardware

MANUFACTURER: Google
BRAND: google
MODEL: sdk_gphone64_x86_64
PRODUCT: sdk_gphone64_x86_64
BOARD: goldfish_x86_64
HARDWARE: ranchu
DEVICE: emulator64_x86_64_arm64
SUPPORTED_ABIS: x86_64, arm64-v8a

Everything went ok, Termux is not killed (expected).

What's the output for adb shell "/system/bin/dumpsys activity settings | grep max_phantom_processes" and your build tag. Maybe changes were made for pixel device releases. Moreover, revision branches don't exist in aosp repo.

What's the output for adb shell dumpsys activity settings | grep max_phantom_processes and your build tag.

redfin:/ $ dumpsys activity settings | grep max_phantom_processes
  max_phantom_processes=32

Build info:

[ro.build.ab_update]: [true]
[ro.build.characteristics]: [nosdcard]
[ro.build.date]: [Fri Aug 27 06:19:46 UTC 2021]
[ro.build.date.utc]: [1630045186]
[ro.build.description]: [redfin-user 12 SP1A.210812.015 7679548 release-keys]
[ro.build.display.id]: [SP1A.210812.015]
[ro.build.expect.baseband]: [g7250-00147-210811-B-7631450]
[ro.build.expect.bootloader]: [r3-0.4-7617468]
[ro.build.fingerprint]: [google/redfin/redfin:12/SP1A.210812.015/7679548:user/release-keys]
[ro.build.flavor]: [redfin-user]
[ro.build.host]: [abfarm-release-rbe-64-00054]
[ro.build.id]: [SP1A.210812.015]
[ro.build.product]: [redfin]
[ro.build.tags]: [release-keys]
[ro.build.type]: [user]
[ro.build.user]: [android-build]
[ro.build.version.all_codenames]: [REL]
[ro.build.version.base_os]: []
[ro.build.version.codename]: [REL]
[ro.build.version.incremental]: [7679548]
[ro.build.version.min_supported_target_sdk]: [23]
[ro.build.version.preview_sdk]: [0]
[ro.build.version.preview_sdk_fingerprint]: [REL]
[ro.build.version.release]: [12]
[ro.build.version.release_or_codename]: [12]
[ro.build.version.sdk]: [31]
[ro.build.version.security_patch]: [2021-10-05]

Have tried your command with sha256sum /dev/zero loop and here is what I got:

10-30 13:27:55.958  1702  1970 I ActivityManager: Killing 14231:com.google.android.cellbroadcastreceiver/u0a227 (adj 975): empty #33
10-30 13:28:01.908  1702  2006 I ActivityManager: Killing 14249:com.niksoftware.snapseed/u0a234 (adj 975): empty #33
10-30 13:28:16.766  1702  2010 I ActivityManager: Start proc 18322:com.google.android.apps.carrier.carrierwifi/u0a114 for service {com.google.android.apps.carrier.carrierwifi/com.google.android.wsu.service.WsuServiceImpl}
10-30 13:28:20.478  1702  1970 I ActivityManager: Killing 14312:com.google.android.apps.docs/u0a171 (adj 975): empty #33
10-30 13:28:20.479  1702  1970 I ActivityManager: Killing 14286:com.google.android.documentsui/u0a66 (adj 975): empty #34
10-30 13:28:22.285  1702  4227 I ActivityManager: Killing 14386:com.google.android.deskclock/u0a186 (adj 975): empty #33
10-30 13:28:43.431  1702  1970 I ActivityManager: Killing 14513:com.google.android.apps.wallpaper/u0a197 (adj 995): empty for 1800s
10-30 13:28:46.773  1702  2006 I ActivityManager: Killing 14752:com.google.pixel.livewallpaper/u0a100 (adj 985): empty for 1800s
10-30 13:28:46.774  1702  2006 I ActivityManager: Killing 14581:com.google.android.gm/u0a191 (adj 905): empty for 1801s
10-30 13:28:50.183  1702  3629 I ActivityManager: Killing 14808:com.google.android.calendar/u0a164 (adj 975): empty for 1800s
10-30 13:28:50.184  1702  3629 I ActivityManager: Killing 14832:com.android.providers.calendar/u0a70 (adj 985): empty for 1800s
10-30 13:29:01.799  1702  2009 D ActivityManager: pid 31599 com.google.android.apps.translate  received async transactions while frozen
10-30 13:29:01.804  1702  2009 D ActivityManager: sync unfroze 31599 com.google.android.apps.translate
10-30 13:29:01.807  1702  2010 I ActivityManager: Start proc 18517:com.google.android.apps.maps/u0a175 for service {com.google.android.apps.maps/androidx.work.impl.background.systemjob.SystemJobService}
10-30 13:29:05.057  1702  1970 I ActivityManager: Killing 6866:com.cloudflare.onedotonedotonedotone/u0a239 (adj 900): remove task
10-30 13:29:05.133  1702  1970 W ActivityManager: setHasOverlayUi called on unknown pid: 6866
10-30 13:30:37.196  1702  2010 I ActivityManager: Start proc 19085:com.android.externalstorage/u0a73 for content provider {com.android.externalstorage/com.android.externalstorage.ExternalStorageProvider}
10-30 13:30:37.696  1702  2010 I ActivityManager: Start proc 19113:com.google.android.gms.ui/u0a125 for service {com.google.android.gms/com.google.android.gms.chimera.UiIntentOperationService}
10-30 13:30:39.273  1702  2009 I ActivityManager: Deferring FGS notification in legacy app com.kunzisoft.keepass.free/u0a240 : Notification(channel=com.kunzisoft.keepass.notification.channel.database shortcut=null contentView=null vibrate=null sound=null defaults=0x0 flags=0x40 color=0xff43a047 vis=SECRET)
10-30 13:30:51.438  1702  2010 I ActivityManager: Start proc 19386:ua.privatbank.ap24/u0a236 for pre-top-activity {ua.privatbank.ap24/ua.privatbank.ap24v6.MainActivity}
10-30 13:31:12.496  1702  2499 I ActivityManager: PendingStartActivityUids startActivity to updateOomAdj delay:1187ms, uid:10202
10-30 13:31:39.980  1702  2010 I ActivityManager: Start proc 19719:com.android.calllogbackup/u0a62 for broadcast {com.android.calllogbackup/com.android.calllogbackup.CallLogChangeReceiver}
10-30 13:32:12.253  1702  2010 I ActivityManager: Start proc 19857:org.telegram.messenger.web/u0a231 for pre-top-activity {org.telegram.messenger.web/org.telegram.ui.LaunchActivity}
10-30 13:33:16.797  1702  4024 I ActivityManager: PendingStartActivityUids startActivity to updateOomAdj delay:1516ms, uid:10202
10-30 13:33:16.865  1702  2010 I ActivityManager: Start proc 20061:com.android.chrome:sandboxed_process0:org.chromium.content.app.SandboxedProcessService0:108/u0ai33 for  {com.android.chrome/org.chromium.content.app.SandboxedProcessService0:108}

Device became laggy and Termux was eventually terminated as well as number of other apps. But no "phantom" processes killed:

130|redfin:/ $ logcat | grep PhantomProcessRecord
^C
130|redfin:/ $

Device became laggy and Termux was eventually terminated as well as number of other apps.

More details about Termux being killed after for i in $(seq 40); do sha256sum /dev/zero & done: that's only app is terminated and not sha256sum processes.

Well, you are on android-12.0.0_r1, latest for Pixel 5 is revision r3. The r1 has same commit history as r7. Don't know why its not occurring for you, maybe wait earnestly for an update. ;)

Pixel specific changes could have been made privately. I guess we can ask google for more info.

that's only app is terminated and not sha256sum processes.

If app got killed, wouldn't sha256sum have been killed as well.

Don't see any entry in above log for com.termux but if app got killed, ideally sha256sum processes should have too eventually, since they were the real reason for cpu usage, check below comment...

The Killing PhantomProcessRecord... entry is generated by PhantomProcessRecord.killLocked(), with the reason Trimming phantom processes passed by PhantomProcessList.trimPhantomProcessesIfNecessary().

The PhantomProcessList.trimPhantomProcessesIfNecessary() is only trimming processes if more than default 32 exist. It is different from the app or phantom processes being killed if they use excessive CPU, which was done previously too, but only for app process. The ActivityManagerService.updateAppProcessCpuTimeLPr() and ActivityManagerService.updatePhantomProcessCpuTimeLPr() handle that and Killing... log entries will have excessive cpu reason. Both functions are called by ActivityManagerService.checkExcessivePowerUsage(). The checking of if a process is using excessive CPU is done by ActivityManagerService.checkExcessivePowerUsageLPr(). This is done every POWER_CHECK_INTERVAL, which defaults to 5*60*1000. But not sure how app CPU usage works when running in emulator, charging was off in emulator settings. I tried running for >5mins and my host CPU usage was at 100% (96.0°C) but processes kept running and didn't see any log entries and neither did battery stats service show "App using battery" notification.

Post output of following to see if there are other phantom processes running. What are your other apps doing?

For this particular instance, I had Google Drive, Google Photos, and Gmail opened in the background; all three not doing anything. Termux was opened on the welcome text. I went to the phone's home screen, turned off screen, came back around two minutes later, opened Termux, and was met with same "Process completed" message.

max_phantom_processes from adb shell dumpsys activity settings:
max_phantom_processes=32

adb shell /system/bin/dumpsys activity processes -a

ACTIVITY MANAGER RUNNING PROCESSES (dumpsys activity processes)
  OOM levels:
    -900: SYSTEM_ADJ (   73,728K)
    -800: PERSISTENT_PROC_ADJ (   73,728K)
    -700: PERSISTENT_SERVICE_ADJ (   73,728K)
      0: FOREGROUND_APP_ADJ (   73,728K)
     100: VISIBLE_APP_ADJ (   92,160K)
     200: PERCEPTIBLE_APP_ADJ (  110,592K)
     225: PERCEPTIBLE_MEDIUM_APP_ADJ (  129,024K)
     250: PERCEPTIBLE_LOW_APP_ADJ (  129,024K)
     300: BACKUP_APP_ADJ (  221,184K)
     400: HEAVY_WEIGHT_APP_ADJ (  221,184K)
     500: SERVICE_ADJ (  221,184K)
     600: HOME_APP_ADJ (  221,184K)
     700: PREVIOUS_APP_ADJ (  221,184K)
     800: SERVICE_B_ADJ (  221,184K)
     900: CACHED_APP_MIN_ADJ (  221,184K)
     999: CACHED_APP_MAX_ADJ (  322,560K)

  Process OOM control (74 total, non-act at 11, non-svc at 11):

  mHomeProcess: ProcessRecord{22364da 21734:com.google.android.apps.nexuslauncher/u0a61}
  mPreviousProcess: ProcessRecord{1dac4a6 15558:com.termux/u0a383}


  Process LRU list (sorted by oom_adj, 74 total, non-act at 11, non-svc at 11):

  All Active App Child Processes:
    proc #0: PhantomProcessRecord {8f0d7dc 2611:3461:logcat/u0a164}
      user #0 uid=10164 pid=2611 ppid=3461 knownSince=-1h35m23s39ms killed=false
      lastCpuTime=10 timeUsed=+20ms oom adj=100 seq=665
    proc #1: PhantomProcessRecord {7920e5 3162:3461:logcat/u0a164}
      user #0 uid=10164 pid=3162 ppid=3461 knownSince=-1h27m21s601ms killed=false
      lastCpuTime=10 timeUsed=+10ms oom adj=100 seq=665
    proc #2: PhantomProcessRecord {1b6f7ba 3253:3461:logcat/u0a164}
      user #0 uid=10164 pid=3253 ppid=3461 knownSince=-1h27m21s601ms killed=false
      lastCpuTime=10 timeUsed=+30ms oom adj=100 seq=665
    proc #3: PhantomProcessRecord {e3e566b 4120:3461:logcat/u0a164}
      user #0 uid=10164 pid=4120 ppid=3461 knownSince=-1h26m23s909ms killed=false
      lastCpuTime=10 timeUsed=+30ms oom adj=100 seq=665
    proc #4: PhantomProcessRecord {a195c8 5790:3461:logcat/u0a164}
      user #0 uid=10164 pid=5790 ppid=3461 knownSince=-1h15m15s965ms killed=false
      lastCpuTime=10 timeUsed=0 oom adj=100 seq=665
    proc #5: PhantomProcessRecord {11fe661 5893:3461:logcat/u0a164}
      user #0 uid=10164 pid=5893 ppid=3461 knownSince=-1h14m56s494ms killed=false
      lastCpuTime=10 timeUsed=+10ms oom adj=100 seq=665
    proc #6: PhantomProcessRecord {2ccd586 8968:3461:logcat/u0a164}
      user #0 uid=10164 pid=8968 ppid=3461 knownSince=-41m37s575ms killed=false
      lastCpuTime=10 timeUsed=+10ms oom adj=100 seq=665
    proc #7: PhantomProcessRecord {5e9ee47 9531:3461:logcat/u0a164}
      user #0 uid=10164 pid=9531 ppid=3461 knownSince=-38m38s396ms killed=false
      lastCpuTime=10 timeUsed=+10ms oom adj=100 seq=665
    proc #8: PhantomProcessRecord {d1e4674 10169:3461:logcat/u0a164}
      user #0 uid=10164 pid=10169 ppid=3461 knownSince=-28m49s512ms killed=false
      lastCpuTime=10 timeUsed=0 oom adj=100 seq=665
    proc #9: PhantomProcessRecord {113879d 10534:3461:logcat/u0a164}
      user #0 uid=10164 pid=10534 ppid=3461 knownSince=-28m49s513ms killed=false
      lastCpuTime=10 timeUsed=0 oom adj=100 seq=665
    proc #10: PhantomProcessRecord {910c412 10626:3461:logcat/u0a164}
      user #0 uid=10164 pid=10626 ppid=3461 knownSince=-28m49s513ms killed=false
      lastCpuTime=0 oom adj=100 seq=665
    proc #11: PhantomProcessRecord {fcd27e3 11349:3461:logcat/u0a164}
      user #0 uid=10164 pid=11349 ppid=3461 knownSince=-21m29s836ms killed=false
      lastCpuTime=0 oom adj=100 seq=665
    proc #12: PhantomProcessRecord {91355e0 11406:3461:logcat/u0a164}
      user #0 uid=10164 pid=11406 ppid=3461 knownSince=-21m29s836ms killed=false
      lastCpuTime=10 timeUsed=0 oom adj=100 seq=665
    proc #13: PhantomProcessRecord {ca60099 12372:3461:logcat/u0a164}
      user #0 uid=10164 pid=12372 ppid=3461 knownSince=-21m29s836ms killed=false
      lastCpuTime=0 oom adj=100 seq=665
    proc #14: PhantomProcessRecord {6330f5e 12666:3461:logcat/u0a164}
      user #0 uid=10164 pid=12666 ppid=3461 knownSince=-14m56s274ms killed=false
      lastCpuTime=0 oom adj=100 seq=665
    proc #15: PhantomProcessRecord {3205f3f 12782:3461:logcat/u0a164}
      user #0 uid=10164 pid=12782 ppid=3461 knownSince=-14m56s273ms killed=false
      lastCpuTime=0 oom adj=100 seq=665
    proc #16: PhantomProcessRecord {b87f00c 13866:3461:logcat/u0a164}
      user #0 uid=10164 pid=13866 ppid=3461 knownSince=-10m49s764ms killed=false
      lastCpuTime=0 oom adj=100 seq=665
    proc #17: PhantomProcessRecord {94d0d55 14132:3461:logcat/u0a164}
      user #0 uid=10164 pid=14132 ppid=3461 knownSince=-3h58m28s795ms killed=false
      lastCpuTime=10 timeUsed=+30ms oom adj=100 seq=665
    proc #18: PhantomProcessRecord {49cc36a 14317:3461:logcat/u0a164}
      user #0 uid=10164 pid=14317 ppid=3461 knownSince=-10m49s764ms killed=false
      lastCpuTime=0 oom adj=100 seq=665
    proc #19: PhantomProcessRecord {845b05b 14461:3461:logcat/u0a164}
      user #0 uid=10164 pid=14461 ppid=3461 knownSince=-9m45s82ms killed=false
      lastCpuTime=0 oom adj=100 seq=665
    proc #20: PhantomProcessRecord {2ca00f8 14838:3461:logcat/u0a164}
      user #0 uid=10164 pid=14838 ppid=3461 knownSince=-5m49s707ms killed=false
      lastCpuTime=0 oom adj=100 seq=665
    proc #21: PhantomProcessRecord {41e29d1 14910:3461:logcat/u0a164}
      user #0 uid=10164 pid=14910 ppid=3461 knownSince=-3h57m28s448ms killed=false
      lastCpuTime=10 timeUsed=+30ms oom adj=100 seq=665
    proc #22: PhantomProcessRecord {a3bac36 14938:3461:logcat/u0a164}
      user #0 uid=10164 pid=14938 ppid=3461 knownSince=-3h57m28s448ms killed=false
      lastCpuTime=10 timeUsed=+30ms oom adj=100 seq=665
    proc #23: PhantomProcessRecord {1a4f737 15447:3461:logcat/u0a164}
      user #0 uid=10164 pid=15447 ppid=3461 knownSince=-2m53s747ms killed=false
      lastCpuTime=0 oom adj=100 seq=665
    proc #24: PhantomProcessRecord {21a34a4 15725:3461:logcat/u0a164}
      user #0 uid=10164 pid=15725 ppid=3461 knownSince=-1m25s518ms killed=false
      lastCpuTime=0 oom adj=100 seq=665
    proc #25: PhantomProcessRecord {c0a920d 15874:3461:logcat/u0a164}
      user #0 uid=10164 pid=15874 ppid=3461 knownSince=-49s617ms killed=false
      lastCpuTime=0 oom adj=100 seq=665
    proc #26: PhantomProcessRecord {c0e55c2 17826:3461:logcat/u0a164}
      user #0 uid=10164 pid=17826 ppid=3461 knownSince=-3h29m58s826ms killed=false
      lastCpuTime=10 timeUsed=+30ms oom adj=100 seq=665
    proc #27: PhantomProcessRecord {647cfd3 27443:3461:logcat/u0a164}
      user #0 uid=10164 pid=27443 ppid=3461 knownSince=-2h11m45s994ms killed=false
      lastCpuTime=10 timeUsed=+30ms oom adj=100 seq=665
    proc #28: PhantomProcessRecord {e17f710 29010:3461:logcat/u0a164}
      user #0 uid=10164 pid=29010 ppid=3461 knownSince=-2h4m57s282ms killed=false
      lastCpuTime=10 timeUsed=+40ms oom adj=100 seq=665
    proc #29: PhantomProcessRecord {3db4209 30904:3461:logcat/u0a164}
      user #0 uid=10164 pid=30904 ppid=3461 knownSince=-1h53m27s378ms killed=false
      lastCpuTime=10 timeUsed=+20ms oom adj=100 seq=665
    proc #30: PhantomProcessRecord {e700c0e 31295:3461:logcat/u0a164}
      user #0 uid=10164 pid=31295 ppid=3461 knownSince=-1h51m7s727ms killed=false
      lastCpuTime=10 timeUsed=+30ms oom adj=100 seq=665
    proc #31: PhantomProcessRecord {a35962f 32065:3461:logcat/u0a164}
      user #0 uid=10164 pid=32065 ppid=3461 knownSince=-1h50m23s158ms killed=false
      lastCpuTime=20 timeUsed=+20ms oom adj=100 seq=665

  mUidChangeDispatchCount=39302
  Slow UID dispatches:
    com.android.server.job.controllers.QuotaController$QcUidObserver: 0 / Max 4ms
    android.app.IUidObserver$Stub$Proxy: 0 / Max 8ms
    android.app.IUidObserver$Stub$Proxy: 0 / Max 6ms
    android.app.ActivityManager$UidObserver: 0 / Max 5ms
    android.app.ActivityManager$UidObserver: 0 / Max 11ms
    android.app.IUidObserver$Stub$Proxy: 1 / Max 161ms
    android.app.IUidObserver$Stub$Proxy: 0 / Max 10ms
    com.android.server.AppStateTrackerImpl$UidObserver: 0 / Max 3ms
    android.app.IUidObserver$Stub$Proxy: 3 / Max 37ms
    com.android.server.pm.ShortcutService$4: 0 / Max 5ms
    com.android.server.power.hint.HintManagerService$UidObserver: 0 / Max 14ms
    com.android.server.usage.UsageStatsService$3: 0 / Max 9ms
    android.app.ActivityManager$UidObserver: 4 / Max 210ms
    com.android.server.net.NetworkPolicyManagerService$4: 0 / Max 10ms
    com.android.server.job.JobSchedulerService$4: 0 / Max 17ms
    com.android.server.job.controllers.QuotaController$QcUidObserver: 1 / Max 25ms
    com.android.server.PinnerService$3: 0 / Max 4ms
    com.android.server.vibrator.VibrationSettings$UidObserver: 0 / Max 5ms
  mDeviceIdleAllowlist=[1000, 1001, 2000, 10008, 10016, 10022, 10026, 10033, 10041, 10043, 10074, 10164, 10175, 10187, 10199, 10206, 10214, 10281, 10283, 10328, 10383]
  mDeviceIdleExceptIdleAllowlist=[1000, 1001, 2000, 10008, 10009, 10016, 10018, 10022, 10026, 10033, 10034, 10039, 10041, 10043, 10045, 10052, 10053, 10067, 10074, 10088, 10136, 10152, 10164, 10175, 10187, 10199, 10206, 10214, 10281, 10283, 10328, 10352, 10383]
  mDeviceIdleTempAllowlist=[10016, 10057]
  mFgsStartTempAllowList:
    u0a57:  duration=10000 callingUid=u0a57 reasonCode=ALARM_MANAGER_WHILE_IDLE reason=broadcast:u0a57:settings.intelligence.battery.action.PERIODIC_JOB_UPDATE,reason: expiration=2021-10-30 19:00:10.026 (+9s602ms)
  mForceBackgroundCheck=false

logcat.txt sent through email to @agnostic-apollo

10-30 13:57:06.682 1664 1834 I ActivityManager: Killing PhantomProcessRecord {f3f0696 15595:15558:bash/u0a383}: Trimming phantom processes

proc #0: PhantomProcessRecord {8f0d7dc 2611:3461:logcat/u0a164}
     user #0 uid=10164 pid=2611 ppid=3461 knownSince=-1h35m23s39ms killed=false
     lastCpuTime=10 timeUsed=+20ms oom adj=100 seq=665

From emailed logcat

W ProcessStats: Tracking association SourceState{f547bc system/1000 BTopFgs #225577} whose proc state 2 is better than process ProcessState{bb30345 com.wsandroid.suite/10164 pkg=com.wsandroid.suite} proc state 3 (33 skipped)

On your device com.termux package has been assigned the u0a383 user id and com.wsandroid.suite package has been assigned the u0a164 user id, and the later package is for the McAfee Mobile Security: Antivirus app. All the 32 tracked logcat PhantomProcessRecord belong to com.wsandroid.suite and termux's bash was one of the processes that got killed. So as mentioned above, the 32 process limit is for all apps combined. If I remember correctly, facebook app also used to run logcat processes. This will also affect any processes started by Tasker as well.

Try running the adb shell "/system/bin/device_config put activity_manager max_phantom_processes 2147483647" command as mentioned above and see if that helps prevent trimming, processes using excessive CPU will still get killed.

To check which app a user id belongs to, you can run something like adb shell "/system/bin/dumpsys package | grep -A1 'userId=10164'" or check here.

It's interesting that some logcat processes have knownSince=-3h57m28s448ms (and some for only knownSince=-49s617ms). I am pretty sure the app normally wouldn't need to run that many processes and is likely "leaking processes", possibly due to failing to stop unneeded ones. I remember one app that had the same problem ;)

Moved phantom process details and how to disable trimming to https://gist.github.com/agnostic-apollo/dc7e47991c512755ff26bd2d31e72ca8 due to lack of heading support in comments.

mcafee-logcat.txt

@V-no-A You can try my new xposed module. Please visit https://github.com/dttzyjw0012/PhantomProcessesSavior.

A new patch was just submitted to AOSP titled "add settings to toggle the phantom process monitoring in dev options" just FYI

@MishaalRahmanGH Thanks a lot for notifying. This is indeed great news! I have posted a comment at https://issuetracker.google.com/u/1/issues/205156966#comment27 about it and asked for expected timeline of merger.

Commit has been merged. Jing Ji says "it should be able to make into Android 12L".

https://issuetracker.google.com/u/1/issues/205156966#comment28

Termux version: 0.117
Android version: 12
Device model: Samsung S21 Ultra

same issue all the time making termux completely useless on the device

is there any chance that the issue may be fixed w/o getting root access to the device?

As already detailed in the How to disable the phantom processes killing? section of the gist referenced in the comment above, run following command with adb once to prevent phantom processing trimming on Android 12 (at your own risk).

adb shell "/system/bin/device_config set_sync_disabled_for_tests persistent; /system/bin/device_config put activity_manager max_phantom_processes 2147483647"

Disabling device config sync is necessary since gms may reset settings randomly even after boot when update comes. I need to update post.

Even with the workaround to prevent trimming, processes using excessive cpu will be killed. So users will have to limit max cpu usage for commands, like compilation commands. Those issues should be solvable for people on android 12L or 13 by disabling the settings_enable_monitor_phantom_procs feature flag in developer options, assuming above mentioned commit is merged in aosp release and vendor forks and flag is available. Users with root on android 12 should also be able to disable it with xposed/riru modules.

https://unix.stackexchange.com/questions/151883/limiting-processes-to-not-exceed-more-than-10-of-cpu-usage

Users should contact their individual mobile vendors, likely on their support forums and ask them to prioritize merging the 1920354 commit that adds the feature flag in developer options so that its available as soon as possible.

Closing issue since a solution is already available to disable trimming of phantom process for Android 12 and termux can't do anything more about it. Users who upgrade to Android 12 will just have to run the commands over adb/root. I'll look into adding a popup in the app that notifies users about this on update/fresh install and add a "trimmed" termux docs page about this.

The settings_enable_monitor_phantom_procs flag is available in Pixel Android 12L beta 3 releases (which have been pulled). Unfortunately, feature flags menu won't be available in user build production devices, so users will have to run adb shell settings put global settings_enable_monitor_phantom_procs false over adb or run setprop persist.sys.fflag.override.settings_enable_monitor_phantom_procs false with root to disable phantom process trimming and killing of processes using excessive cpu. This is not really user friendly, but it is what it is.

https://twitter.com/MishaalRahman/status/1491487491026833413

https://twitter.com/MishaalRahman/status/1491489385170227205

It's a shame that this project keeps getting limited by changes in android. This app enables so many productivity use cases on android....

Is there a way to get in touch with the AOSP maintainers, or even Google, to have some way to whitelist the app?

😫 android 12 💔 termux, i regret upgrading to android 12

getting signal 9 when installing arch. feelsbadman

It's a shame that this project keeps getting limited by changes in android. This app enables so many productivity use cases on android....

Is there a way to get in touch with the AOSP maintainers, or even Google, to have some way to whitelist the app?

I fully agree with your position - I have used Termux as a prime example of how Android (with Termux) is a much better mobile platform than iOS for programmers/sysadmins/etc.

Termux + nvim/emacs (not going into that debate) makes for an amazing local code editor. Throw in a bluetooth keyboard and you can work from anywhere. If you're SSHing into systems for admin, being able to use the real OpenSSH client is amazing (other SSH apps just don't cut it).

That said, I do understand Google/Android's goals of making the platform more secure. I don't think the Android/Google developers will likely entertain this particular use case (which is unfortunate, since they themselves could probably benefit from it -- but then again, if your device is rooted, you don't necessarily need Termux)

I do think there might be some solutions/workarounds that Termux can implement -- but I'm really not sure. If Android's basic app policy becomes/is "Apps: Do not have any expectations that your App will continue to run in the background, it might be killed at any time"... the solutions for that are pretty limited. The only thing that comes to mind might be some kind of virtualization (which is far from ideal from a performance perspective) that somehow checkpoints/monitors memory (like a "save state") and can restore that when the app relaunches.

Even with phantom process limit bypassed, Termux is still pretty much useless for things like desktop environments as running anything heavier will just kill the entire environment due to "excessive cpu usage". Is there any way to disable the CPU check without resorting to root ?
My S22 Ultra stock ROM does not seem to have the setting from 12L to disable monitoring entirely.
I hate when the OS tries to play police to "protect" users from buggy apps.

Agree. I'm planning to use Termux with desktop and heavy apps like Blender. Look like it's no more possible since Android 12...

@shim80 Android 12L and likely Android 13 will have an option to disable phantom process killing entirely.
I originally planned to use my S22 Ultra with a 14" lapdock for software development, but it looks like I'll have to wait for Android 13.

Android 13 will also bring virtualization with full KVM support, won't it?

It can subject to change anytime, and even Android 13 fully supports it near future. some OEMs may not consider this

What is the best option for running linux with desktop and gpu support for non rooted devices right now?

proot is the best and only choice

the phantom process limit kill termux when I try to launch desktop through termux-x11

@shim80 Linux has had KVM for ages, it's not that hard (from a technical point of view) to enable on any rooted device with a modern-ish kernel version. Google's KVM demo was a hack-job on a rooted device. Not sure if they will add it to production devices and even if they add it, there's no guarantee it will be user-accessible. But it would sure be nice to be able to boot full OS'es on your phone without root.

@ddscentral I'm more interested running virtual machine through Android than booting full OS'es

@shim80 I meant through KVM obviously. KVM is hardware virtualization which does boot full OS'es.

I'd like to see how Termux will be in Android 13 with a device that has been tested by default on Kernel 5.15 lts and 8gigs of RAM, as Goggle Mandates 8gigs for chrome 64bit. This indeed is pretty noticable in Android Sys. Webview & its behaviour in the ui.

Note :-
Default Android 13 means, from R&D the device was ONLY booted from Droid 13 with EroFS. And not Updated from Abdroid 12.

Hi fellas, has the issue been solved?
Android 12 - OneUi 4.1

Following the guide above, and giving trough adb shell some commands(adb shell settings put global settings_enable_monitor_phantom_procs false), works, but still, sadly, after 1h or 30 minutes, it still gives signal 9...
Regards.
(YES IT'S A MATTER OF JUST ADB SHELL FROM TERMUX, YES YOU CAN MAKE A SHELL SCRIPT TO DO IT, but... Hey am so lazy, call people to clean ass when poop)
Regards.

Screenshot_2022-07-11-20-29-29-120_com termux


hi, is there any solution for this problem? I want to try to install another linux, but because of this problem I find it difficult and bother me.

hi, is there any solution for this problem? I want to try to install another linux, but because of this problem I find it difficult and bother me.

#2366 (comment)

I don't understand the steps

The steps are clear as much as possible. All you need is to run this ADB command:

adb shell "/system/bin/device_config put activity_manager max_phantom_processes 2147483647"

ADB can be used either on PC or in a wireless mode directly on device (package android-tools).


@2096779623 Pls, don't quote screenshots. They are too long when viewing thread on laptop.

The steps are clear as much as possible. All you need is to run this ADB command:

adb shell "/system/bin/device_config put activity_manager max_phantom_processes 2147483647"

ADB can be used either on PC or in a wireless mode directly on device (package android-tools).

@2096779623 Pls, don't quote screenshots. They are too long when viewing thread on laptop.

Sorry, are you using a laptop? :)

We're going off-topic, but yeah I use laptop. Just an example how screenshots can look like:
Screenshot_20220711_184727

When posted excessively, it becomes impossible to read the comments.

Setting phantom processes is useless, as the killer still triggers on any proccess with higher CPU use. Therefore, running something like desktop environments on Termux is out of the question. We'll need to wait for Android 13 to get a true fix.

commented

Setting phantom processes is useless, as the killer still triggers on any proccess with higher CPU use. Therefore, running something like desktop environments on Termux is out of the question. We'll need to wait for Android 13 to get a true fix.

Will A13 actually include a real fix or are we just hoping it enables OEMs to add a toggle in developer options IF they feel like doing it?

but it works fine for me,

Setting phantom processes is useless, as the killer still triggers on any proccess with higher CPU use. Therefore, running something like desktop environments on Termux is out of the question. We'll need to wait for Android 13 to get a true fix.

Will A13 actually include a real fix or are we just hoping it enables OEMs to add a toggle in developer options IF they feel like doing it?

Technically it will include a virtualisation platform ( if you ever heard of VirtualBox).
Basically it will be very easy to install windows on arm etc.

but it works fine for me,

Technically it works for you. For example Samsung devices have different battery optimisation options and many users report using that command doesn't work, or better it works intermittently.

I have a Samsung device, and as suggested, the option just resets, not always after reboot, sometimes by it's own, after some use, like 30min, 1h, 10min.

Technically it will include a virtualisation platform ( if you ever heard of VirtualBox).
Basically it will be very easy to install windows on arm etc.

That will only be used to separate specific OS components from the rest of the OS. It will not be exposed to users (unless you root) and it seemingly will not work on Qualcomm devices because those have their own hypervisor.

So no, it will not be very easy to install Windows.

Here is what I did on my flagship phone (Android 12L, no flags to disable the killer :( ):

  1. Connected to adb on PC with terminal console shell
  2. Issued this command: adb shell
  3. In adb shell prompt ran this: nohup sh -c "while true; do /system/bin/device_config put activity_manager max_phantom_processes 2147483647; sleep 3000; done" >/dev/null 2>&1 &
  4. In android settings disabled everything in "device care"

Not sure if the 3000 seconds is correct choice. I believe there is something that resets the value but I don't know if this resetting immediately kills the process or has a delay. Because if there is delay then setting the update period to less-than-delay value would prevent the thing from killing.

So far it does sporadically kill but I can very much use the linux xfce4 gui with vivaldi browser, vscode and do some heavy coding and admin work

It should be under Developer Options -> Device Flags.
Internally it's called "settings_enable_monitor_phantom_procs".
Make/model of your device ?

Updated instructions for disabling killing of phantom process and excessive cpu usage processes has been uploaded to https://github.com/agnostic-apollo/Android-Docs/blob/master/en/docs/apps/processes/phantom-cached-and-empty-processes.md#how-to-disable-the-phantom-processes-killing for Android 12 and 12L/13+. I suggest users read it before asking further questions and filling up the issue with repeat comments. The Commands to disable phantom process killing and TLDR section lists the commands for different android versions needed to disable phantom and excessive cpu usage processes killing.

The gist at https://gist.github.com/agnostic-apollo/dc7e47991c512755ff26bd2d31e72ca8 now just provides redirection links.

The fix is already available in Android 12L and 13 in AOSP with the settings_enable_monitor_phantom_procs settings flag added in 09dcdad. OEMs and device manufacturers should also have included the fix in their own release. If they have not, then its not google's fault, ask your device manufacturer. If you are currently using Termux app github builds, you can open termux app and open left drawer -> Settings icon -> About and it should show the current value of MONITOR_PHANTOM_PROCS under Software info section on Android 12+ devices and will be marked <unsupported> if its not supported in current android build. It should also show in next F-Droid release v0.119.0.

https://issuetracker.google.com/u/1/issues/205156966#comment108

Not sure if the 3000 seconds is correct choice. I believe there is something that resets the value but I don't know if this resetting immediately kills the process or has a delay.

gms config update would do that, its also mentioned in the gist, now mentioned in git repo. And killing is immediate once value is reset. Moreover, android 12L has a separate settings_enable_monitor_phantom_procs setting, which won't reset, so use that.

It should be under Developer Options -> Device Flags.

Feature flags page is empty on production devices and only visible on debug builds.

Hi, I was setting up Linux for my friend but she had issues with it.

We figured that she had the doble-trouble Samsung with Android 12, so we couldn't use the VNCviewer & vncserver on Termux/Ubuntu for development because the background process would get killed instantly.

`termux-info`

Output:

Termux Variables:
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=11165
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://cdn.lumito.net/termux/termux-main stable main
# x11-repo (sources.list.d/x11.list)
deb https://cdn.lumito.net/termux/termux-x11 x11 main
Updatable packages:
coreutils/stable 9.1-1 aarch64 [upgradable from: 9.1]
libc++/stable 25b aarch64 [upgradable from: 25-2]
termux-tools version:
1.29.2
Android version:
12
Kernel build information:
Linux localhost 4.14.186-24355525 #1 SMP PREEMPT Mon Jun 6 07:42:25 +07 2022 aarch64 Android
Device manufacturer:
samsung
Device model:
SM-A326B

When we tried disabling Phantom Process Monitoring with,

adb shell settings put global settings_enable_monitor_phantom_procs false

we had the following error:

daemon not running; starting now at tcp:5037
* daemon started successfully
* daemon still not running
adb: cannot connect to daemon at tcp:5037: Not a data message

I tried running adb devices to see what's going on but it spewed the following:

daemon not running; starting now at tcp:5037
ADB server didn't ACK
Full server startup log: /data/data/com.termux/files/usr/tmp/adb.10051.log
Server had pid: 25280
--- adb starting (pid 25280) ---
adb I 09-14 18:47:35 25280 25280 main.cpp:63] Android Debug Bridge version 1.0.41
adb I 09-14 18:47:35 25280 25280 main.cpp:63] Version 31.0.3p1-android-tools
adb I 09-14 18:47:35 25280 25280 main.cpp:63] Installed as /data/data/com.termux/files/usr/bin/adb
adb I 09-14 18:47:35 25280 25280 main.cpp:63]
adb F 09-14 18:47:36 25280 25280 main.cpp:155] could not install smartsocket listener: Address already in use

* failed to start daemon
adb: failed to check server version: cannot connect to daemon

After googling the error with added context that it happened on Termux/Ubuntu, I stumbled upon the similar issue termux/termux-packages#7946 where this reply offered such approach

export ADB_SERVER_SOCKET=localfilesystem:$(pwd)/adb_socket
adb start-server

to use a file as a socket and thus circumvent false-positive EADDRINUSE (Address already in use) bug on Samsung phones, if I understand it correctly.

After that, I ran

adb shell settings put global settings_enable_monitor_phantom_procs false

but it said adb: no devices/emulators found.

What exactly did I do wrong? Warning, I'm a newbie with adb.

You need to start ADB in wireless mode and pair ADB client with device using command adb pair localhost:<PORT1> <6 digit pin>. Once done, you can connect via adb connect localhost:<PORT2> and use shell or other commands. Pairing port and connection port are different.

Wireless ADB menu is available since Android 11 in developer settings. You may need to use split screen mode because pairing dialog may be closed on switching to another app.

Screenshot_20220914-213116

You need to start ADB in wireless mode and pair ADB client with device using command adb pair localhost:<PORT1> <6 digit pin>. Once done, you can connect via adb connect localhost:<PORT2> and use shell or other commands. Pairing port and connection port are different.

Wireless ADB menu is available since Android 11 in developer settings. You may need to use split screen mode because pairing dialog may be closed on switching to another app.

Screenshot_20220914-213116

Thanks a lot! I will try it tomorrow on her phone!

I tried doing using Wireless Debugging on my phone first but there's only USB debugging on my phone. This problem is present on some other Android 11 phones too.

termux-info

Output:

Termux Variables:
TERMUX_API_VERSION=0.50.1
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=19993
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://packages-cf.termux.org/apt/termux-main/ stable main
Updatable packages:
All packages up to date
termux-tools version:
1.29.2
Android version:
11
Kernel build information:
Linux localhost 4.19.127 #1 SMP PREEMPT Fri Jun 17 11:10:44 IST 2022 aarch64 Android
Device manufacturer:
LGE
Device model:
LM-Q630

Since her phone runs under Android 12, I hope it has support for Wireless Debugging. We haven't tapped the Build Number 7 times yet, so tomorrow she'll (officially!) become a developer 😄

We tried it and failed. So first we enabled the developer mode and Wireless Debugging. We tried executing

export ADB_SERVER_SOCKET=localfilesystem:$(pwd)/adb_socket
adb start-server
adb pair 192.168.1.110:35699
<pairing_code>

where 192.168.1.110:35699 was the <IP>:<port> that we obtained from wireless debugging and <pairing_code> was the pairing code from there that we entered in the prompt. However, we received this error

Failed: Unable to start pairing client.

despite successful pings.

Then we googled the error and Android 11 wifi adb error "Unable to start pairing client" popped up.

We tried

  • Restarting
  • Ensuring that her phone is not using VPN [she never did]
  • Ensuring that her phone can ping itself over Wi-Fi

When we tried using

nc -vz 192.168.1.110:35699

we faced

nc: missing port number

Don't either of you have access to a pc? Run over adb usb if you can't figure out wireless way. And the pairing prompt must not be dismissed while pairing, use split screen.

adb shell settings put global settings_enable_monitor_phantom_procs false

That command is not for android 12, read #2366 (comment)

Don't either of you have access to a pc? Run over adb usb if you can't figure out wireless way. And the pairing prompt must not be dismissed while pairing, use split screen.

adb shell settings put global settings_enable_monitor_phantom_procs false

That command is not for android 12, read #2366 (comment)

What if you want to code while pooping? You can't stand up, and go to the PC, and also can't prepare for poop. Phone needs restarting, this makes termux not fun.

I suggest to make it kool again, KTermux;

Some apps, spawn very many processes and don't... Termux is great, it's free, also android it's great it's free...

To my Knowledge you can set the App as a "game" so it has less limitations... Or include the maximum number of processes termux can make into the source

Uploading Screenshot_٢٠٢٢-٠٩-١٧-١٤-١١-٣٥-٤٥٠_com.termux.jpg…
🫠🥲😐

nc -vz 192.168.1.110:35699

Correct NetCat usage syntax is:

nc -vz 192.168.1.110 35699

Make sure the pairing dialog was not dismissed (closed or disappeared) at the time when you are pairing or running this nc command.

How to pair and connect to Wireless ADB on same device without PC:

screen-20220918-094304.2.mp4

To my Knowledge you can set the App as a "game" so it has less limitations... Or include the maximum number of processes termux can make into the source

This is not true in case of phantom processes. Their limit is system-wide and works against all apps in summary. You can't override it with an application config but can change it through the ADB or root shell.

Don't either of you have access to a pc? Run over adb usb if you can't figure out wireless way. And the pairing prompt must not be dismissed while pairing, use split screen.

adb shell settings put global settings_enable_monitor_phantom_procs false

That command is not for android 12, read #2366 (comment)

adb shell "/system/bin/device_config set_sync_disabled_for_tests persistent; /system/bin/device_config put activity_manager max_phantom_processes 2147483647"

you can't use nethunter KeX on android 12 ! you must use terminal until Fix this bug

Can any one help me in this

Hi the below link seems not to be working on termux, i tried using it to install kali but the command was not working. Please i need help

@Macwilson007 off-topic. Ask whoever made the tutorial you followed.