Difference between revisions of "Termux"
(One intermediate revision by the same user not shown) | |||
Line 9: | Line 9: | ||
** We rely heavily on a host Linux kernel to handle syscalls in the expected manner | ** We rely heavily on a host Linux kernel to handle syscalls in the expected manner | ||
** Android throws a wrench in this | ** Android throws a wrench in this | ||
− | * FEX-Emu uses the raw AArch64 '''''SVC #0''''' so Android seccomp breaks FEX in most cases | + | * FEX-Emu uses the raw AArch64 '''''SVC #0''''' syscall interface so Android seccomp breaks FEX in most cases |
+ | |||
+ | * While FEX maintains the termux package. It's not a supported platform. | ||
+ | ** We only maintain it because someone asked for it in Termux's bug tracker [https://github.com/termux/termux-packages/issues/7424 here] | ||
== Problems == | == Problems == |
Latest revision as of 08:59, 27 June 2022
Termux is an application on Android phones that lets you run applications in a "linux-like" environment. FEX-Emu runs under this environment and manages the termux package as well. There are some major caveats towards running anything under this environment although.
Preface
Expect problems if you're wanting to run an application of any complexity under Termux with FEX.
- FEX-Emu is Not a Syscall emulator
- We rely heavily on a host Linux kernel to handle syscalls in the expected manner
- Android throws a wrench in this
- FEX-Emu uses the raw AArch64 SVC #0 syscall interface so Android seccomp breaks FEX in most cases
- While FEX maintains the termux package. It's not a supported platform.
- We only maintain it because someone asked for it in Termux's bug tracker here
Problems
Seccomp
The latest versions of Android use a feature called seccomp to restrict the syscalls that applications can use. This restricts a /significant/ number of syscalls from FEX.
- Termux gets around this problem by significantly modifying system libraries and applications to avoid restricted syscalls
- FEX-Emu uses the kernel syscall interface directly so it is highly likely to hit a SIGSYS fault.
Completely unsupported syscalls
Android outright disables a bunch of syscalls which applications expect to have working.
- SystemV IPC syscalls
- shmctl, msgctl, semctl
- Namespaces
- Many more
Termux gets around this by providing some emulation libraries that applications use.
- libandroid-shmem provides the shm emulation
- msgctl and semctl don't have equivalents?
Termux also modifies system libraries to avoid syscalls that Android doesn't have.
- X11 things are heavily modified to make it a wayland service with termux-x11
- If you're not using the modified libraries then things break catastrophically
- FEX-Emu's x86 rootfs doesn't have the modifications that termux has, so these library replacements don't work
Not Linux standard paths
Termux doesn't use standard linux paths because Android doesn't let it. Termux uses a bunch of clever little hacks to make things work in a linux-like environment.
- LD_LIBRARY_PATH overrides
- PATH overrides
- Library/Application modifications to resolve any hardcoded paths
- More things that I'm not aware of
Applications that don't work
Wine
Wine doesn't work in Termux+FEX. It immediately hits problems with seccomp.
- Disabling seccomp will likely get you slightly further
- Wine's multiprocess communication immediately breaks down though
Chroot
Chrooting in to FEX's rootfs on Termux has issues
- First you need root support on your Android device, which isn't common.
- Second Android doesn't seem to support devtmpfs? So mounting /dev/ and /dev/pts inside the chroot doesn't seem to work.
- Proot might work around the chrooting problems.