Skip to content

Latest commit

 

History

History
55 lines (35 loc) · 2.39 KB

File metadata and controls

55 lines (35 loc) · 2.39 KB

Fixes for Android Process Killing

Android 12 and newer versions include a "Phantom Process Killer" that may abruptly close Termux or Linux desktop sessions (even SSH sessions) when they use too many resources or run in the background.

Use one of the following methods to disable this behavior and ensure a stable experience.


Method 1: Using ADB (No Root Required)

If you don't have root access on your device, you can use a computer with ADB installed to run these commands.

  1. Connect your phone to your computer and enable USB Debugging.
  2. Run the following commands from your computer's terminal:
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

Method 2: From Termux (Root Required)

If your device is rooted (Magisk/KernelSU), you can apply these fixes directly from Termux.

Option A: Automatic Script (Easiest)

Run this command to download and apply the fixes instantly:

wget https://raw.githubusercontent.com/nglmercer/android-linux-desktop/main/scripts/apply_fixes.sh && chmod +x apply_fixes.sh && ./apply_fixes.sh

Option B: Manual Commands

Run the following commands (you will be prompted for root access):

su -c "/system/bin/device_config set_sync_disabled_for_tests persistent"
su -c "/system/bin/device_config put activity_manager max_phantom_processes 2147483647"
su -c "settings put global settings_enable_monitor_phantom_procs false"

Why is this necessary? (Important for SSH, Chroot & Proot)

By default, Android limits the number of child processes a background application can have (usually to 32).

  • Does it affect SSH? Yes. If you are running compilations, web servers, or multiple terminal windows via SSH, Android may kill the Termux process.
  • Does it affect Chroot? Yes. Even with Root access, the processes running inside your Chroot are still tracked by Android as part of the Termux session.
  • What if Termux is closed? If Android kills Termux, your entire session—including the desktop environment, SSH server, and all running apps—will stop immediately.
  • Stability: Since a Linux desktop environment spawns dozens of processes, Android will likely kill your session within minutes if these fixes are not applied.