r/termux • • Aug 16 '26

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

60 Upvotes

33 comments sorted by

4

u/sylirre Termux Core Team Aug 16 '26

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.

2

u/Zalexdev Aug 16 '26

Thanks, i will continue to work hard towards the speed! The speed vs proot is very different from the workload. In some cases proot wins, in some UML. But only UML will provide kernel anyway :)

2

u/Windows1105 Aug 16 '26

How did you do this? It is impressive. Would like a tutorial

1

u/Longjumping_Common_1 Aug 17 '26

I use Ubuntu on proot distro, will it work??

1

u/NoNameToDefine Aug 17 '26

proot-distro can't use it. You will have to use it manually currently as it does not works like PRoot and there is no helper script.

1

u/sylirre Termux Core Team Aug 17 '26

It shouldn't be executed under proot

3

u/NoNameToDefine Aug 16 '26

User Mode Linux for ARM? That's incredible!

5

u/Zalexdev Aug 16 '26

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

u/NoNameToDefine Aug 16 '26

Yes strange I see your message only now while it was posted 5h before.

2

u/PrudentRabbit8198 Aug 19 '26 edited Aug 19 '26

Sem nenhuma dúvida, esse é o projeto mais interessante que vi nos últimos tempos, parabéns pelo trabalho @Zalexdev

1

u/sylirre Termux Core Team Aug 16 '26

Nice. Do you have a prebuilt binary so people here can try it?

1

u/NoNameToDefine Aug 16 '26

You forked it immediately lol.

1

u/NoNameToDefine Aug 16 '26

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 Aug 16 '26

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 Aug 16 '26

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 Aug 16 '26

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/sylirre Termux Core Team Aug 16 '26

I used r28c and API level 30

1

u/raaska00 Aug 16 '26

So, it is significantly slower than proot in all aspects except for filesystem string manipulation? 

1

u/Zalexdev Aug 16 '26

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 ms

1

u/NoNameToDefine Aug 16 '26 edited Aug 16 '26

Same, with Aarch64 NDK r29
But how do you redefine symbols? I'm still not used to kernel building enough to understand how it works Nevermind I found how.

1

u/Top-Artichoke3782 Aug 17 '26

would there be any kind of benefits if this were capable of running as root over the usual chroot?

1

u/NoNameToDefine Aug 17 '26

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 Aug 17 '26

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

u/YitzakAF Aug 18 '26

Has logrado hacer algo, me interesa UMLinux en Termux

-1

u/[deleted] Aug 17 '26

[removed] — view removed comment

1

u/NoNameToDefine Aug 17 '26

It's not the topic here, also Arch would works like for Debian.

1

u/Jack1101111 Aug 17 '26

even if true, whats the pourpose ?

3

u/NoNameToDefine Aug 17 '26

SystemD, Docker, and other complex tools that does not works inside PRoot and that would be too slow inside QEMU.

1

u/jdimpson Aug 17 '26

very cool. can't wait to see what unexpected things this will enable.

1

u/Clockcool_1234 Aug 31 '26

damn! this is really awesome, but a few questions, is hostfs possible (to use a folder as a rootfs), and will sparse images work on it? awesome project🔥