Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/scripts/android/install-termux-x11.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ if [ "$API_LEVEL" -lt 26 ]; then
fi

TERMUX_X11_VERSION="${TERMUX_X11_VERSION:-1.03.01}"
TERMUX_X11_SHA256="${TERMUX_X11_SHA256:-a0cdf8da2ecebe17c3441faecd7e06a433d23d8da49c37c8945feeb5ced3e8fe}"
APK_NAME="termux-x11-universal-debug.apk"
TERMUX_X11_SHA256="${TERMUX_X11_SHA256:-77c1791d6dccb4853a0b9e5e5fd85dc27872968fefe9122a8c6e45abd342f618}"
# Upstream dropped the universal debug APK in November 2026. The release
# build is the only universal APK left in the nightly tag.
APK_NAME="termux-x11-universal-release.apk"
URL="https://github.com/termux/termux-x11/releases/download/nightly/$APK_NAME"
CACHE="${RUNNER_TEMP:-/tmp}/termux-apks"
mkdir -p "$CACHE"
Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,26 @@ tag names, define the order. See the table at the bottom.

### Added

- Separate Android and external storage policies. Guided setup now offers
Both, Android only, External only, or None instead of one storage switch.
`lfa install` accepts `--android-storage on|off` and
`--external-storage on|off` (plus `--no-android-storage` and
`--no-external-storage`), and
`lfa storage android|external enable|disable|status` changes an existing
instance without reinstalling, and `--all` applies it to every instance
(`on`/`off` remain aliases). Disabling either
category starts the guest with proot-distro's `--isolated` mode and adds
back only the enabled binds, so the disabled tree is not reachable through
`/storage`.
- Custom Linux userlands. Guided setup gained option 9, and `lfa install`
gained `--iso PATH` and `--rootfs PATH`, so a rootfs tarball, an extracted
directory, or a live ISO can run under proot next to the eight built-in
distros. LFA checks the CPU architecture, extracts a live squashfs (or the
ext4 inside Fedora's `squashfs.img`), reads `/etc/os-release`, and maps the
image to a package-manager family so the normal desktop/software setup can
run. Unknown families install terminal-only instead of calling a package
manager that does not exist. The ISO is never booted, proot cannot emulate
another CPU, and installer-only images still need a rootfs tarball.
- LFA notices now reach Android. `ui_ok`, `ui_warn`, and `ui_err` post a
`termux-notification` through Termux:API as well as printing the terminal
line, so install, update, backup, restore, repair, import, and error
Expand Down
132 changes: 110 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ Antigravity, and the CLI tools are in

## About the project

Linux for Android Manager runs a graphical Linux environment on an Android
phone without root. It is an interactive Bash script that wraps
`proot-distro` to install and manage Linux distributions on a phone or tablet.
Linux for Android Manager runs a Linux desktop on an Android phone or tablet
without root. It is an interactive Bash script that wraps `proot-distro` to
install and manage the distributions.

Supported distributions:

Expand Down Expand Up @@ -133,7 +133,7 @@ hardware, not simulated. Full details, root causes, and evidence are in
| Alpine 3.18 (Android 5) | Yes | Yes | legacy VNC desktop, panel works; X11 and Both hidden | v1.7.1 |
| Ubuntu GNOME 46 (experimental) | Yes | Yes | shell and apps run; session services missing | v1.7.0 |

> The test suite runs `881` checks with 0 failures. The same suite runs on the
> The test suite runs `965` checks with 0 failures. The same suite runs on the
> devices (`tests/device-matrix.sh`). The table is as of v1.7.1. Ubuntu was
> re-verified on v1.7.1, and Alpine 3.18 was re-verified on Android 5 on
> 2026-11-04; the other rows were last verified on v1.7.0. A row is
Expand Down Expand Up @@ -212,7 +212,7 @@ logind. Neither exists inside proot. This option skips `gnome-session` and
launches `gnome-shell --x11` directly inside a D-Bus session.

The shell itself runs. The session services that `gnome-session` normally
starts do not, which is where the breakage comes from.
starts do not.

Two proot-specific patches make it start:

Expand Down Expand Up @@ -303,7 +303,7 @@ as experimental only.
replaced by snap stubs.
- Google Antigravity IDE installs the official ARM64 build into
`/opt/antigravity-ide` and launches it with the dbus and GPU flags it needs
inside proot. It is the real IDE, not a placeholder terminal edition.
inside proot. It is the full IDE.
- The managed `/etc/lfa-chromium-flags` file lets the acceleration menu add or
remove VirGL flags without overwriting the proot-safe Chromium wrapper.
- The uninstaller shows the instance, distro and desktop, rootfs path, and
Expand Down Expand Up @@ -461,7 +461,7 @@ is accepted.

| Command | What it does |
| --- | --- |
| `lfa install` (`i`, `in`) | install without menus; accepts `-d/--distro`, `-D/--desktop`, `-b/--backend`, `-a/--autostart`, `-u/--user`, `-H/--hostname`, `-t/--timezone`, `-s/--software`, and `-i` |
| `lfa install` (`i`, `in`) | install without menus; accepts `-d/--distro`, `--iso`, `--rootfs`, `--android-storage`, `--external-storage`, `-D/--desktop`, `-b/--backend`, `-a/--autostart`, `-u/--user`, `-H/--hostname`, `-t/--timezone`, `-s/--software`, and `-i` |
| `lfa list` (`ls`, `l`) | list installed distributions (`-j/--json` for scripts) |
| `lfa status` | show desktop, backend, autostart, and running state (`-j/--json`); also checks for a newer manager release |
| `lfa start` (`desktop`) | start the desktop; `-x/--x11` or `-v/--vnc` forces a backend, `-r/--restart` replaces a running session |
Expand All @@ -480,7 +480,7 @@ is accepted.
| `lfa usb` | list, scan, attach, tty, flash, and exec real USB devices through Termux:API |
| `lfa appimage` (`app`, `ai`) | extract an AppImage once and add a menu entry |
| `lfa run` | run an AppImage once without installing it |
| `lfa storage` | Android storage status, repair, run, and protected data helpers |
| `lfa storage` | Android storage status, repair, run, protected data helpers, and separate Android/external access toggles |
| `lfa diagnostics` (`diag`) | write a redacted support bundle |
| `lfa notice` | `on`, `off`, or `status` for the `start-linux` change notice |
| `lfa version` (`ver`) / `lfa help` | version and command list |
Expand All @@ -494,6 +494,8 @@ Examples:

```bash
lfa install --distro ubuntu --desktop xfce4 --backend both -i ubuntu
lfa install --rootfs ~/storage/downloads/debian-rootfs.tar.gz -i debian-custom
lfa install --iso ~/storage/downloads/alpine-live-arm64.iso -i alpine-live
lfa start -i ubuntu --vnc
lfa shell -i ubuntu --user
lfa switch x11 -i ubuntu --remove-old
Expand Down Expand Up @@ -538,7 +540,7 @@ Android side: it exposes real framework data through files in `$PREFIX/tmp`
disabled without losing hardware data, and the risky parts are easier to
audit.

Neither layer pretends to provide a kernel feature. Docker, Podman, Flatpak,
Neither layer provides a kernel feature. Docker, Podman, Flatpak,
TUN/TAP, iptables, CUDA, ROCm, KVM, and kernel modules remain unavailable.
The full list, with reasons, is in
[docs/INCOMPATIBLE.md](docs/INCOMPATIBLE.md).
Expand Down Expand Up @@ -583,8 +585,8 @@ are in [docs/USB.md](docs/USB.md).

An AppImage normally mounts itself through FUSE. proot does not expose
`/dev/fuse`, so a raw `./Foo.AppImage` fails with
`fuse: failed to open /dev/fuse: Permission denied`. LFA does not pretend
FUSE works; it runs the AppImage the way the runtime supports, by extracting:
`fuse: failed to open /dev/fuse: Permission denied`. LFA extracts the AppImage
instead:

```bash
./Foo.AppImage # works: the session exports APPIMAGE_EXTRACT_AND_RUN=1
Expand Down Expand Up @@ -635,6 +637,46 @@ guest group, write access, and the chmod result. The same helper is installed
in the guest as `lfa-run-file`, and Thunar gets a **Run in Linux** entry in the
right-click menu for files under shared storage.

### Storage access policies

Android shared storage and external devices are separate policies. Both are
on by default. Guided setup asks once with four choices (Both, Android only,
External only, None), and the CLI accepts:

```bash
lfa install --distro ubuntu --android-storage off -i ubuntu
lfa install --distro debian --external-storage off -i debian
lfa install --distro debian --no-android-storage --no-external-storage -i minimal
```

Change an existing install without reinstalling:

```bash
lfa storage android disable -i ubuntu
lfa storage external disable -i ubuntu
lfa storage android enable -i ubuntu
lfa storage external status -i ubuntu
```

To change every installed instance at once, add `--all`:

```bash
lfa storage android disable --all
lfa storage external enable --all
lfa storage android status --all
```

Without `--all` or `-i`, the command uses the only installed instance, or
stops and lists them when several exist. `on` and `off` are accepted as
aliases for `enable` and `disable`.

Changes apply to new desktop and terminal sessions. When either category is
off, LFA starts the guest with proot-distro's `--isolated` mode and adds back
only the binds you kept: Android shared storage at `/sdcard` and
`/storage/emulated/0`, or external volumes at `/media/<VOLUME-ID>`. The
disabled category is not reachable through `/storage`. Disabling both also
hides the other Android and Termux host paths that `--isolated` skips.

### Android/data and Android/obb

Android 11 and later block `/storage/emulated/0/Android/data` and
Expand Down Expand Up @@ -710,9 +752,56 @@ different instance name in guided setup. Each instance has its own rootfs. The
chosen image is recorded as `IMAGE="..."` in
`/etc/termux-linux-manager.conf` inside the guest.

Arbitrary rootfs tarballs are not supported by the installer. `proot-distro`
can install a custom rootfs through a plugin, but the manager will not offer it
in the menu, and its launchers assume one of the eight supported distros.
### Custom ISO and rootfs images

The installer can also unpack a userland you provide. This is the same proot
container model as the supported distros: the image must match the phone's
CPU, and the ISO itself is never booted.

| Source | What happens |
| --- | --- |
| Rootfs tarball (`.tar`, `.tar.gz`, `.tar.xz`, `.tar.bz2`, `.tar.zst`) | Extracted directly; a single top-level directory is flattened. |
| Extracted rootfs directory | Copied into the instance. |
| Live ISO or raw image (`.iso`, `.img`, `.zip`) | `7z` unpacks the image, LFA finds the live squashfs (or the ext4 inside Fedora's `squashfs.img`) and extracts that root filesystem. `7zip` is installed automatically when missing. |

Choose **Custom Linux ISO / rootfs** in guided setup (option 9), or use the
CLI:

```bash
lfa install --rootfs ~/storage/downloads/debian-rootfs.tar.gz -i debian-custom
lfa install --iso ~/storage/downloads/alpine-live-arm64.iso -i alpine-live
lfa install --iso ~/storage/downloads/debian-live-arm64.iso -i debian-live \
--desktop xfce4 --backend vnc
```

`--iso` and `--rootfs` imply `--distro custom`; do not combine them with
another `--distro`. On the CLI, a custom install defaults to `--desktop none`,
because LFA only knows how to drive a desktop for the families it recognises.

LFA reads `/etc/os-release` after extraction and maps the image to Debian,
Ubuntu, Kali, Fedora, openSUSE, Void, Arch, or Alpine. A recognised family
gets the normal desktop/software setup and the same launchers as a distro
installed from proot-distro. If the package manager is unknown, the instance
is installed terminal-only and LFA prints the command to open a root shell;
install a desktop inside the guest with its own package manager if you want
one.

Things that will not work:

- **A different CPU.** proot does not emulate, so an `x86_64` ISO cannot run
on an arm64 phone. Use an arm64 image (most desktop ISOs are amd64-only).
- **Installer-only ISOs.** Images without a live squashfs/root filesystem
(for example Ubuntu Server) have nothing for LFA to extract. Use the
distro's rootfs tarball or cloud image instead.
- **Booting, kernels, and block devices.** There is no kernel, initramfs,
systemd, loop mount, or block layer under proot. Live-ISO extraction gives
you the filesystem only.
- **OCI/Docker archives.** These need `proot-distro` v5's own installer.
Export a plain rootfs instead: `docker export NAME -o rootfs.tar`.

The chosen source and detected identity are recorded as `CUSTOM_SOURCE`,
`CUSTOM_NAME`, and `CUSTOM_ID` in
`/etc/termux-linux-manager.conf` inside the guest.

### Testing an older version

Expand Down Expand Up @@ -976,9 +1065,8 @@ shortcut, which is created automatically.
inside proot and is unnecessary because you already own every file.
- Why no real sudo? Android app processes carry the `NO_NEW_PRIVS` flag, and
proot cannot grant real root, so `sudo` and `su` can never work inside proot
on any device. You already own every file, so elevation is unnecessary. On
Alpine the manager is `apk`, not `apt`. Bare `apt` resolves to Termux's host
copy and fails to link.
on any device. On Alpine the manager is `apk`, not `apt`. Bare `apt` resolves
to Termux's host copy and fails to link.

### Stopping your Linux desktop

Expand Down Expand Up @@ -1241,7 +1329,7 @@ short list is:
nodes (`lfa usb` provides userspace access instead)
- Wayland compositors, simultaneous X11 + VNC, foreign-architecture binaries

Full reasons, the “works with caveats” list, Android 5/6/7 differences, and
Full reasons, the "works with caveats" list, Android 5/6/7 differences, and
what Termux:API can actually expose are in
[docs/INCOMPATIBLE.md](docs/INCOMPATIBLE.md).

Expand Down Expand Up @@ -1462,8 +1550,8 @@ If you need `ubuntu-desktop`, note that it is only a metapackage. Removing

### 14. `reboot` / `shutdown` say "System has not been booted with systemd" or "Failed to talk to init daemon"

Cause: a proot guest is a container, not a VM. There is no PID 1, so there is
nothing to reboot. Android owns the kernel.
Cause: a proot guest is a container with no PID 1, so there is nothing to
reboot. Android owns the kernel.

Fix: leave the guest with `exit`, then from Termux use `stop-linux` to stop
everything or `start-linux` to restart the desktop. From v1.5.8, `reboot`,
Expand Down Expand Up @@ -1539,7 +1627,7 @@ update-desktop-database /usr/share/applications 2>/dev/null || true
```

Chromium needs `--no-sandbox --disable-dev-shm-usage`. The menu 12 wrapper adds
both. This is a proot limitation, not a bug that can be fixed in the apps.
both. The apps cannot fix this proot limitation.

## Contributing

Expand All @@ -1564,7 +1652,7 @@ plus `script` from util-linux for the pty test, which is skipped if absent:

```bash
chmod +x tests/test-all.sh
./tests/test-all.sh # expect: PASS=881 FAIL=0
./tests/test-all.sh # expect: PASS=965 FAIL=0
```

The suite is deliberately stubbed. It cannot prove a desktop actually appears.
Expand Down
17 changes: 17 additions & 0 deletions docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ saved config ─┘ │
└─ 7. verify core components, then "Installation complete"
```

A custom source replaces step 2. Guided setup unpacks the chosen ISO, tarball,
or directory into a private staging tree before the desktop/software menus so
it can read `/etc/os-release` and pick the package-manager family. The stage
is moved into the proot-distro container layout once the instance name is
known; `install_linux()` reuses it instead of unpacking twice. If the family is
unknown, the desktop/software menus and the guest setup script are skipped and
the instance is terminal-only. The EXIT trap removes a stage that never
reaches an installed instance.

Step 3 is the unusual one. Instead of a long chain of `proot-distro login
... -- cmd` calls (each paying proot startup and losing environment), the
installer writes one guest bash script and runs it once. It is fast and can
Expand Down Expand Up @@ -225,6 +234,14 @@ desktop user gid 1023 as its primary group, which makes the mode check pass.
Without it Thunar draws `emblem-unreadable` on every folder even though the
files are readable.

Android storage and external storage are separate policies in the instance
config. With both on, LFA leaves proot-distro's default binds alone. If either
is off, `lfa_storage_args` adds `--isolated` and re-adds only the enabled
category: `/sdcard` plus `/storage/emulated/0` for Android, or
`/media/<VOLUME-ID>` for SD cards and USB drives. The same helper is used by
`start-linux`, `terminal-linux`, and `lfa storage status`, so the policy
applies to every normal guest session rather than only the desktop.

`chmod` does not work there. The FUSE mount fixes the mode, so `chmod +x` is
ignored even as root. `lfa storage exec` and the guest-side `lfa-run-file`
copy a file to `/tmp`, set the mode on the copy, and run it.
Expand Down
6 changes: 6 additions & 0 deletions docs/USB.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,12 @@ The card destinations deliberately avoid `/sdcard` and `/mnt/sdcard`:
proot-distro v5 binds internal storage there already and warns when a
destination is used twice.

The card binds follow the instance's external-storage policy. If it is off
(`lfa storage external disable -i NAME`), sessions start with `--isolated` and
neither `/media/<VOLUME-ID>` nor `/mnt/card` is bound. `lfa storage android`
controls internal storage separately, so a guest can keep `/sdcard` while
hiding cards and drives.

`lfa usb storage --json` prints the same data for scripts. If
`/storage/<VOLUME-ID>` is readable but not writable, the mode column says
`ro`; proot cannot enforce read-only binds, so LFA warns instead of
Expand Down
Loading
Loading