On LineageOS (and most modern Android versions), the run-as command enforces SELinux and app sandboxing restrictions, even for the root user. The error run-as: package not debuggable: com.termux means that Termux is not marked as a debuggable app in its manifest, so run-as refuses to switch to its user context—even with root privileges.
com.termux Userapktool or smali patching).bashapktool d /data/app/com.termux-*/base.apk -o termux_mod
AndroidManifest.xml to add android:debuggable="true" to the <application> tag.bashapktool b termux_mod -o termux_debug.apk adb install -r termux_debug.apk
run-as com.termux should work.su to Switch to Termux’s UIDu0_a123), you can use su to switch to it:
bashsu -c "su u0_a123 -c 'export PATH=/data/data/com.termux/files/usr/bin:\$PATH; bash -i'"
orbashgrep termux /data/system/packages.list
bashls -n /data/data | grep com.termux
root:
bashcd /data/data/com.termux/files/usr/bin ./bash -lic 'export PATH=/data/data/com.termux/files/usr/bin:$PATH; bash -i'
$PREFIX) may not be set.nsenter to Join Termux’s Namespacebashpid=$(pgrep -u u0_a123 bash) # Replace u0_a123 with Termux's UID nsenter -t $pid -m -u -i -n -p bash -c 'export PATH=/data/data/com.termux/files/usr/bin:$PATH; bash -i'
nsenter support in your kernel and may not work on all devices.run-as or SELinux Policy (Advanced)run-as: Some custom ROMs allow overriding the debuggable check by modifying the run-as binary.Then retrybashsetenforce 0
run-as com.termux. Warning: This weakens security.termux-exec or a Termux session).su + Termux’s UID (method 2).Vibe can make mistakes. Check answers. Learn more