You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@calebROlson I have confirmed that your problem has a root cause specific to ADB and ADB-like setups, not directly related to the original issue you posted in which was someone using an unidentified Termux APK, not ADB, so I am opening a different post here to continue the discussion in a more appropriate location.
After working on it for a while, I have:
Managed to install and test Magisk and MagiskSSH in my AVD; the problem for me was, like you suggested, that I had to specify the newest version of Magisk instead of the script's default.
Reproduced the bug you experienced in MagiskSSH
Reproduced the bug consistently in several other entrypoints that are very similar to Magisk and MagiskSSH, including but not limited to KernelSU
Found what seems in my opinion to be the exact root cause of the bug
Created upstream PRs to attempt to contribute a solution to the bug
Created this guide for using the alternative ADB and ADB-like entrypoints to Termux in the way I would suggest they be used, including steps for how to download and install my PRs into the Termux that is being prepared; you don't have to change to this setup, but this is just what I would use personally instead of the exact way you set it up.
You must have either root, or a Termux Debug-mode APK (the Termux APK from GitHub, not from F-Droid) because the only su implementation that works as non-root is run-as, which works from normal ADB shell, and run-as does not work on Release-mode Termux APKs, only Debug-mode APKs like the ones from Termux GitHub. If you have root, then the root entrypoints will work on the Release-mode F-Droid Termux APK.
Open Termux from the shortcut normally and prepare it for alternative entrypoints
Note
If you are frustrated/disappointed by the requirement to run some commands that install a huge amount of packages here and a long setup script, rather than your preference to only install neovim and be done, the reason is basically because the root cause of the issue is in a precompiled C code part of Termux, so in order to fully fix the symptoms while the fix PRs are not merged, it's necessary to at the very least install a C compiler and recompile the specific code that is causing the problem, and at that point it's more convenient and reliable overall to just use build-package.sh and .deb files to manage that binary, which significantly bloats the setup time on clean installed Termux.
yes | pkg upgrade -y # very important - copy and paste exactly as writtenecho"export PREFIX=$PREFIX">>$PREFIX/etc/profile.pre
echo"export HOME=$HOME">>$PREFIX/etc/profile.pre
echo"export PATH=$PREFIX/bin">>$PREFIX/etc/profile.pre
echo"export TMPDIR=$TMPDIR">>$PREFIX/etc/profile.pre
echo"export TERM=xterm">>$PREFIX/etc/profile.pre
pkg install git
git clone https://github.com/termux/termux-packages.git
cd termux-packages
curl https://github.com/termux/termux-core-package/commit/63bf9286ad86603f9a58de73e4c740926c88f5e3.diff > packages/termux-core/0001-alternative-entrypoint.patch
curl https://patch-diff.githubusercontent.com/raw/termux/termux-core-package/pull/2.diff > packages/termux-core/0002-alternative-entrypoint.patch
curl https://patch-diff.githubusercontent.com/raw/termux/termux-exec-package/pull/39.diff > packages/termux-exec/alternative-entrypoint.patch
scripts/setup-termux.sh
./build-package.sh -I -f termux-core termux-exec
cd output
apt reinstall ./*.deb
Connect to ADB shell from somewhere
adb shell
Alternative entrypoints
Tip
For entrypoints requiring Termux's real userid explicitly, don't forget to use whoami, id -u and id -g in Termux App beforehand and then replace the number in the examples with the matching number from your installation of Termux
AOSP su entrypoint (rooted device required):
su u0_a117 /data/data/com.termux/files/usr/bin/sh -l -c login
@calebROlson I have confirmed that your problem has a root cause specific to ADB and ADB-like setups, not directly related to the original issue you posted in which was someone using an unidentified Termux APK, not ADB, so I am opening a different post here to continue the discussion in a more appropriate location.
After working on it for a while, I have:
Managed to install and test Magisk and MagiskSSH in my AVD; the problem for me was, like you suggested, that I had to specify the newest version of Magisk instead of the script's default.
Reproduced the bug you experienced in MagiskSSH
Reproduced the bug consistently in several other entrypoints that are very similar to Magisk and MagiskSSH, including but not limited to KernelSU
Found what seems in my opinion to be the exact root cause of the bug
Created upstream PRs to attempt to contribute a solution to the bug
Created this guide for using the alternative ADB and ADB-like entrypoints to Termux in the way I would suggest they be used, including steps for how to download and install my PRs into the Termux that is being prepared; you don't have to change to this setup, but this is just what I would use personally instead of the exact way you set it up.
Tip
You must have either root, or a Termux Debug-mode APK (the Termux APK from GitHub, not from F-Droid) because the only su implementation that works as non-root is
run-as, which works from normal ADB shell, andrun-asdoes not work on Release-mode Termux APKs, only Debug-mode APKs like the ones from Termux GitHub. If you have root, then the root entrypoints will work on the Release-mode F-Droid Termux APK.Note
If you are frustrated/disappointed by the requirement to run some commands that install a huge amount of packages here and a long setup script, rather than your preference to only install
neovimand be done, the reason is basically because the root cause of the issue is in a precompiled C code part of Termux, so in order to fully fix the symptoms while the fix PRs are not merged, it's necessary to at the very least install a C compiler and recompile the specific code that is causing the problem, and at that point it's more convenient and reliable overall to just usebuild-package.shand.debfiles to manage that binary, which significantly bloats the setup time on clean installed Termux.Tip
For entrypoints requiring Termux's real userid explicitly, don't forget to use
whoami,id -uandid -gin Termux App beforehand and then replace the number in the examples with the matching number from your installation of Termuxsuentrypoint (rooted device required):su u0_a117 -g 10117 -G 9997 -c "/data/data/com.termux/files/usr/bin/sh -l -c login"su u0_a117 -i -g 10117 -G 9997 -c "/data/data/com.termux/files/usr/bin/sh -l -c login"run-asentrypoint (rooted device not required):Tested using two separate Android Studio Android Virtual Devices that had these two installers run on them respectively:
(KernelSU for AVD) https://github.com/robertkirkman/kernelsu-goldfish-builder
(Magisk for AVD) https://gitlab.com/newbit/rootAVD
PRs:
PROCESS_CONTEXT_PREFIX__RUNAS_APPandPROCESS_CONTEXT__KERNEL_SUtermux-core-package#2