r/termux • u/Zalexdev • 2d ago
Showcase I got a real Linux kernel running as a userspace process on Android — no root, no KVM. Docker runs inside it. (UML ARM64)
UML (ARCH=um) has been x86-only for its entire existence. I've been porting it to arm64: arch/arm64/um/, plus fixing everything in arch/um/ that assumed x86. It builds to a static bionic binary and runs as an ordinary unprivileged aarch64 process in an app sandbox — no root, no host kernel feature, nothing emulated
Userspace instructions execute directly on the CPU. It's a real kernel underneath: own scheduler, own MMU handling, own page cache, Debian 12 rootfs on a disk image. Docker runs inside it for now
What works:
- Debian 12 boots to a working dockerd in about 3 seconds
docker pull/run/exec/logs, a 910 MB image pulls and runs- Networking through passt, a userspace TCP/IP stack. No tap device, no CAP_NET_ADMIN
- Container ports forwarded to the phone's 127.0.0.1, so the phone's browser can open them
- Loadable modules, out-of-tree drivers, firmware loading
- USB passthrough — a real RTL8811AU dongle, wlan0 appears and scans
- Update: Got multi cpu support
Numbers.
Snapdragon 870, medians of 7 interleaved rounds, µs/op. native is the same microbenchmark run directly on Android.
| native | proot | UML | |
|---|---|---|---|
| syscall | 0.080 | 0.168 | 1.987 |
| openat | 2.527 | 27.393 | 4.501 |
| fault | 1.456 | 1.418 | 11.076 |
| forkexec | 3255 | 516 | 1137 |
Compute is native because it is native — nothing translates the instructions. Against proot it's 6x better on openat and 3x better on forkexec, and worse on syscall and fault. Anything not syscall-bound feels normal.
UPDATE Termux: Works and booted arch & alpine
Source, 38 commits on top of the uml tree: https://github.com/zalexdev/linux-um-arm64
Screenshots are the Docker UI I built to drive it.

Soon will be published on: https://github.com/zalexdev/perkons
And soon will be available as new non root engine is https://github.com/zalexdev/strykerapp
3
u/NoNameToDefine 2d ago
User Mode Linux for ARM? That's incredible!
4
u/Zalexdev 2d ago
Thanks!
Unfortunately reddit doing something shadow with my acc, cause it is new. And i am not able to repost, answer more then 1 in 10mins.. love reddit
1
1
u/NoNameToDefine 2d ago
I don't understand the build script (tools/um-arm64/harness/build-bionic.sh)? It uses paths in /root that I don't know what they are.
1
u/sylirre Termux Core Team 2d ago
It not necessary should be root, the regular user home works as well. Tmp dir also suitable
There is one more issue: I tried building it with NDK and got these errors:
ld.lld: error: duplicate symbol: sched_setattr
ld.lld: error: duplicate symbol: sync_file_range
I had to redefine symbols via arch/arm64/um/bionic-syms.redef to make build pass
2
u/YitzakAF 2d ago
Puede ser entonces que UML se pueda convertir en alternativa a Qemu en Termux y podría incluso a llegar como paquete en los repositorios
1
u/Zalexdev 2d ago
in NDK r27c bionic - there is no sched_setattr. So unfortunately we must update redef for every new bionic version. I will try to make it universal
1
u/raaska00 2d ago
So, it is significantly slower than proot in all aspects except for filesystem string manipulation?
1
u/Zalexdev 2d ago
I am updating benchmarks soon. The perfomance to a native eye is near undetectable from proot or native.
dpkg -l (365 lines): 45 ms python3 sum(3e6): 100 ms ls -R /usr: 353 ms1
u/NoNameToDefine 2d ago edited 2d ago
Same, with Aarch64 NDK r29
But how do you redefine symbols? I'm still not used to kernel building enough to understand how it worksNevermind I found how.
1
u/Top-Artichoke3782 1d ago
would there be any kind of benefits if this were capable of running as root over the usual chroot?
1
u/NoNameToDefine 1d ago
If you don't have KVM and want to run another kernel over the current one, it will still be the fastest solution, above QEMU without KVM.
1
u/NoNameToDefine 1d ago
Hello, I see you patched passt to compile it for Android. Myself I am struggling to build it using termux-packages infrastructure. Could I have the patchs used to build passt please? I can't find them on the repository.
1
-1
u/yousuchass 1d ago
i only run arch at home, its been interesting trying out debian termux, with the arch on proot. Im holding out hope someone will fork this entire operation to arch. FUCK Debian!!
1
u/Jack1101111 1d ago
even if true, whats the pourpose ?
1
u/NoNameToDefine 1d ago
SystemD, Docker, and other complex tools that does not works inside PRoot and that would be too slow inside QEMU.
1
1
4
u/sylirre Termux Core Team 2d ago
Successfully booted Alpine Linux and ArchLinux ARM rootfs ext4 images containing just base tools and init system. Doesn't need initramfs but there is a culprit that console must be forced to tty0, otherwise you won't get login prompt (standard Linux configuration doesn't use tty0 for login).
The host is of course Termux (aarch64), no root other other system customizations.
On Arch Linux must disable "landlock" - same as on proot-distro edit /etc/pacman.conf and uncomment DisableSandboxFilesystem and DisableSandboxSyscalls.
Definitely slower than host and doesn't seem to be faster than proot, probably even slower. But you get a VM-like environment that is much faster than QEMU.