Skip to content

Commit 85accdb

Browse files
docs: explain OCI image installation
1 parent 4d738ec commit 85accdb

3 files changed

Lines changed: 169 additions & 11 deletions

File tree

‎README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ the app's **About** page.
2323

2424
| Area | What is supported |
2525
| --- | --- |
26-
| Linux installation | Search Ubuntu, Debian, Arch Linux, Alpine Linux, and Void Linux images; review an image before downloading; resume transfers; verify checksums; and retain validated archives across installation retries. |
26+
| Linux installation | Search uDroid and PRoot-Distro archives alongside official Docker Hub operating-system images. Choose a compatible OCI tag, review its architecture and compressed size, resume transfers, verify SHA-256 digests, and retain validated data across retries. |
2727
| Multiple systems | Keep multiple distributions installed. Selecting an installed system opens its own status and controls page instead of immediately starting a terminal. |
2828
| Terminal | Use the bundled Termux terminal emulator and persistent, service-owned PTY without installing Termux separately. Each terminal action targets the selected rootfs. |
2929
| Linux applications | Discover freedesktop `.desktop` entries, launch graphical or terminal applications, publish dynamic shortcuts, and pin selected applications to the Android home screen. |
@@ -52,6 +52,7 @@ the app's **About** page.
5252
production-level desktop compatibility remain incomplete.
5353

5454
See the [distribution catalogue](docs/DISTRIBUTION_CATALOGUE.md),
55+
[OCI image architecture](docs/OCI_IMAGES.md),
5556
[Linux application launcher](docs/LINUX_APPLICATION_LAUNCHER.md),
5657
[X11 runtime architecture](docs/X11_RUNTIME_ARCHITECTURE.md),
5758
[performance notes](docs/PERFORMANCE.md), and

‎docs/DISTRIBUTION_CATALOGUE.md‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,20 @@ was marked broken on Android 15 and newer. An image is not shown merely because
4141
an archive exists; its architecture, checksum, extraction layout, and PRoot
4242
startup must be understood first.
4343

44-
## Upstream v5 and registry search
44+
## Official container images
4545

46-
Current `termux/proot-distro` v5 installs OCI images instead of maintaining a
47-
small fixed distro list. That makes registry-backed discovery possible, but a
48-
raw registry search is not yet suitable for one-tap installation in uDroid.
49-
Search results still need trust metadata, immutable digest pinning,
50-
architecture filtering, size information, rootfs compatibility checks, and a
51-
clear distinction between tested and community images.
46+
The same searchable list also includes active operating-system repositories
47+
from Docker Hub's official `library` namespace. Selecting one opens a version
48+
page containing only tags that publish an image for the phone's OCI platform.
49+
The review page records the selected platform, compressed size, tag, and
50+
immutable manifest digest before installation begins.
5251

53-
The present catalogue therefore combines live uDroid metadata with a small
54-
pinned PRoot-Distro archive set. OCI discovery can be added as a separate
55-
provider without weakening the verified-install contract.
52+
Container images follow a separate verified OCI pipeline; they are not passed
53+
to Docker, containerd, or a daemon. uDroid resolves the manifest, downloads and
54+
verifies each referenced blob, applies ordered filesystem layers and OCI
55+
whiteouts in app-private staging storage, adds Android/PRoot compatibility
56+
files, executes the standard rootfs health probe, and only then activates the
57+
installation. See [OCI image architecture](OCI_IMAGES.md).
5658

5759
## Visual identity
5860

‎docs/OCI_IMAGES.md‎

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
# OCI images
2+
3+
uDroid can install official operating-system container images as ordinary
4+
PRoot root filesystems. This path does not run Docker, containerd, a privileged
5+
daemon, namespaces, or a nested container runtime. The app implements the
6+
small OCI distribution and layer-processing surface needed to produce a
7+
verified rootfs in app-private storage.
8+
9+
The first release of this path deliberately limits discovery to active
10+
operating-system images in Docker Hub's official `library` namespace. A
11+
repository appearing in search is not enough to start a download: the user
12+
must select a tag that has a compatible image for the phone architecture and
13+
review its size and source first.
14+
15+
## Installation path
16+
17+
```mermaid
18+
flowchart TD
19+
A["Docker Hub official OS catalogue"] --> B["Compatible repository and tag"]
20+
B --> C["Tag plus immutable SHA-256 digest"]
21+
C --> D["OCI registry manifest resolution"]
22+
D --> E["Architecture-specific manifest"]
23+
E --> F["Resumable config and layer downloads"]
24+
F --> G["SHA-256 verification"]
25+
G --> H["Ordered layer and whiteout application"]
26+
H --> I["Android and PRoot compatibility files"]
27+
I --> J["First-boot health probe"]
28+
J --> K["Atomic rootfs activation"]
29+
```
30+
31+
The UI stores both the human-facing tag and its platform digest. Installation
32+
therefore resolves a reference such as:
33+
34+
```text
35+
docker.io/library/almalinux:latest@sha256:<digest>
36+
```
37+
38+
The tag remains useful to the user, while the digest prevents a mutable tag
39+
from silently selecting different content between review and installation.
40+
41+
## Discovery and caching
42+
43+
Repository discovery accepts only entries that:
44+
45+
- belong to Docker Hub's official `library` namespace;
46+
- are active image repositories in the operating-systems category;
47+
- use a validated repository name;
48+
- are not described as deprecated.
49+
50+
Tag discovery filters the returned platform descriptors against Android's
51+
supported ABI. `arm64-v8a`, for example, maps to OCI `linux/arm64/v8`.
52+
Repository metadata is cached for six hours and tag metadata for two hours.
53+
When refresh fails, an existing validated cache can be shown as stale data
54+
instead of removing the catalogue. Activity recreation also retains the
55+
selected repository and reloads its tag state.
56+
57+
The catalogue is intentionally not a general Docker Hub search. Community
58+
images, arbitrary registries, private credentials, and user-provided image
59+
references need a separate trust and UX design.
60+
61+
## Registry and download boundaries
62+
63+
The registry client supports OCI and Docker v2 image indexes and manifests. It
64+
selects the requested OS, architecture, and variant, limits metadata response
65+
sizes, and verifies manifest digests supplied by both the selected descriptor
66+
and the registry response.
67+
68+
Anonymous Bearer challenges are supported over HTTPS. The returned token is
69+
used only for requests to the original blob origin. The shared resumable
70+
artifact pipeline rejects unsafe header names and values, controls Range
71+
requests itself, and does not forward authorization headers across a
72+
cross-origin redirect.
73+
74+
Each config or filesystem blob is written to a partial file, resumed when
75+
possible, checked against its descriptor's SHA-256 digest, and atomically
76+
promoted to the verified blob cache. Interrupted verified data can be reused
77+
by a later attempt. Verified blobs are removed after a rootfs is activated.
78+
79+
## Layers, whiteouts, and activation
80+
81+
OCI filesystem layers are applied in manifest order. Before extracting a
82+
layer, uDroid scans its tar entry names and applies:
83+
84+
- `.wh.<name>` as deletion of the lower-layer path;
85+
- `.wh..wh..opq` as removal of lower-layer children in that directory.
86+
87+
Whiteout marker files are excluded from normal tar extraction. Every planned
88+
path is confined to the staging rootfs, so a malformed layer cannot use
89+
whiteouts to delete app data outside that directory.
90+
91+
Tar entry-name scanning supports ustar prefixes, POSIX PAX paths, GNU long
92+
names, checksum validation, octal sizes, and positive base-256 sizes. PAX
93+
records may also contain binary extended attributes. The scanner decodes the
94+
record key first and decodes a value as UTF-8 only when the key is `path`.
95+
This matters for AlmaLinux, whose official layer contains binary
96+
`SCHILY.xattr.security.capability` data that is valid tar metadata but is not
97+
UTF-8 text.
98+
99+
Extraction occurs in an operation-owned staging directory. On success uDroid:
100+
101+
1. writes Android DNS, identity, mount, and PRoot compatibility files;
102+
2. executes the same mounted first-boot health probe used by archive installs;
103+
3. writes the ready marker;
104+
4. atomically renames staging storage to the final installation name.
105+
106+
Failed staging data is removed only when its ownership marker matches the
107+
current OCI installation. An unrelated or unrecognized directory is left
108+
untouched.
109+
110+
## State and progress
111+
112+
Archive and OCI installations share one persisted `InstallerWorkRequest`
113+
contract and the same foreground installer service. The state snapshot records
114+
the immutable image reference, target platform, installation name, operation
115+
identifier, progress stage, byte totals, terminal transcript, and whether the
116+
operation can be cancelled.
117+
118+
Older archive-only snapshots are migrated when read. OCI progress survives
119+
Activity recreation and process interruption, and the UI reattaches to the
120+
same saved operation rather than creating another installation implicitly.
121+
122+
## Validation
123+
124+
The implementation has unit coverage for:
125+
126+
- image-reference parsing and normalization;
127+
- manifest-list platform selection and digest verification;
128+
- Bearer authentication and origin-confined request headers;
129+
- resumable aggregate progress;
130+
- Docker Hub catalogue and tag parsing, caching, and stale fallback;
131+
- whiteout planning and path confinement;
132+
- tar checksums, PAX paths, GNU long names, and binary PAX attributes;
133+
- transactional activation, failure cleanup, persisted progress, and legacy
134+
state migration.
135+
136+
Android probe tests use the separate
137+
`org.randomcoder.udroid.ociprobe` application ID so destructive rootfs tests
138+
cannot uninstall or overwrite the normal uDroid package. The real-device
139+
checkpoint installed the official arm64 AlmaLinux `latest` layer end to end,
140+
including compatibility configuration and the first-boot health probe.
141+
142+
## Current limitations
143+
144+
- Discovery is restricted to anonymous official Docker Hub operating-system
145+
images.
146+
- Only OCI/Docker image indexes, manifests, gzip tar layers, and uncompressed
147+
tar layers are accepted.
148+
- Signatures, attestations, SBOM policy, private registries, and registry
149+
credentials are not implemented.
150+
- A container image is a minimal rootfs, not a complete machine boot. Services
151+
that require a real kernel, systemd/logind, privileged mounts, or namespaces
152+
still need PRoot-specific handling.
153+
- An official image can still contain userspace assumptions that do not work
154+
under Android. Digest verification proves content identity, while the
155+
first-boot probe establishes only the baseline execution contract.

0 commit comments

Comments
 (0)