User-Mode Linux on Android

UML runs a Linux kernel as a process on Android. Ubuntu has its own kernel and PID 1, but the VM starts in regular Termux. It doesn’t replace Android’s kernel, use /dev/kvm, or ask the APatch daemon to mount anything.[1][2]

New to this? What the flip is UML? explains the two kernels, the two version numbers, and that scary Bash panic.

  Chroot User-Mode Linux
Kernel Uses Android’s kernel. Runs a separate ARM64 Linux kernel.
Ubuntu files /data/apatch-chroot/containers/ubuntu/rootfs ~/uml/ubuntu.ext4 by default.
Init Optional chroot service supervisor (login --init). The guest’s own /sbin/init, usually systemd on Ubuntu.

Installing a package in one Ubuntu won’t touch the other. The APatch module also won’t copy, migrate, or replace a UML disk. You don’t need the module to run UML with the standalone RC3 kit.

Boot the guest you already have

In regular Termux, not inside a chroot and not under su, use the RC3 CLI:

apatch-linux uml status
apatch-linux uml boot --trial

Use ~/uml-smp/apatch-linux instead if you unpacked the standalone kit and didn’t install the module. status reports the selected runtime and disk without booting them. The CLI finds a kit in ~/uml-smp first and otherwise looks in ~/uml. An incomplete SMP kit produces an error. --kit DIR chooses the kernel and helpers; --disk FILE chooses an existing raw ext4 disk. Only --disk changes where Ubuntu’s data comes from.

  • Trial (--trial): starts /sbin/init and sends writes to a temporary copy-on-write overlay. The backing disk stays read-only. Use this for your first boot with the new kernel. See the SMP setup and rollback.
  • Normal (boot): starts /sbin/init and saves changes to the disk. Don’t run two guests against the same disk if either can write to it. Shut down with sudo poweroff inside Ubuntu, or poweroff if logged in as root.
  • Recovery (--read-only): attaches the disk read-only, skips ext4 journal replay, and starts Bash as PID 1 by default. Exiting that shell deliberately triggers Linux’s Attempted to kill init! panic; that’s not a normal exit or proof of an idle-thread bug. Try --trial to boot and log out normally. --init /PATH can override init for non-trial boots.

What’s in the old ~/uml kit?

Keep it where it is. The chroot module is not a backup of this kit or its disk.

File What it does
linux, stub_exe Legacy ARM64 UML kernel and its matching helper.[2][3]
ubuntu.ext4 Your persistent Ubuntu disk. The guest sees it as /dev/ubda.
umnet, passt Optional userspace networking helpers for --network.[3]
initramfs-alpine.cpio.gz Optional RAM filesystem for uml boot alpine. It doesn’t use the Ubuntu disk.
ubuntu-base-24.04.4-base-arm64.tar.gz Optional Ubuntu base archive; the launcher doesn’t unpack it or boot from it.
RUN.md, SHA256SUMS, mconsole.py Notes, hashes and an optional management helper. The launcher doesn’t execute them.

For a new SMP kit, keep the linux-bionic and stub_exe_bionic binaries from the same build with its resolved config. Don’t rename or mix legacy files with the new pair. Get the matched set from the RC3 kit or use the upstream legacy prebuilt with --kit DIR and verified hashes.[2] You still need an existing ARM64 Ubuntu image. The CLI doesn’t create or download one.

RAM, networking, and containers

  • Ubuntu defaults to 512 MiB; Alpine defaults to 256 MiB. --memory 768M or --memory 1G changes guest RAM. The startup check leaves at least 256 MiB available for Android, but Android can still stop a process under pressure.
  • --network uses umnet and passt from the selected kit. It doesn’t set up Android bridges or change host routes. The guest may need network setup.
  • Docker, Podman, and LXC in Ubuntu use the UML kernel’s cgroups, namespaces, and filesystem features. The launcher doesn’t install them, and the RC3 boot test didn’t exercise those container engines or optional networking.

Sources


APatch Chroot — MIT licensed. Runs a root daemon; read safety first.

This site uses Just the Docs, a documentation theme for Jekyll.