This commit is contained in:
eric
2026-04-04 16:24:48 -05:00
parent a48db482a8
commit 8a1eebcb02
2 changed files with 46 additions and 5 deletions

View File

@@ -121,6 +121,21 @@ redroid/redroid:13.0.0_mindthegapps_houdini_magisk
Headless servers have **no screen** to approve the USB debugging RSA dialog. Always pass **`--adb-insecure`** so boot props disable ADB RSA checks and apply **before** the Pixel user profile (`androidboot.adb.secure=0`, `ro.adb.secure=0`, `ro.secure=0`, `ro.debuggable=1`). **Do not expose the ADB port on a public network.** Headless servers have **no screen** to approve the USB debugging RSA dialog. Always pass **`--adb-insecure`** so boot props disable ADB RSA checks and apply **before** the Pixel user profile (`androidboot.adb.secure=0`, `ro.adb.secure=0`, `ro.secure=0`, `ro.debuggable=1`). **Do not expose the ADB port on a public network.**
### Persist after reboot (default)
By default **`run_redroid.py` does not pass `--rm`**: the container stays on disk when it stops, and uses **`--restart unless-stopped`** so **Docker/Podman will start it again after the daemon or host reboots** (unless you ran `docker stop <name>`).
- **Always restart** even after explicit stop: `--restart always`
- **No auto-restart** but still keep the container (no `--rm`): `--restart no`
- **One-off / dev only** (old behavior, removed on stop): pass **`--rm`**
On Ubuntu, ensure the engine starts on boot:
```bash
sudo systemctl enable docker --now
# or: sudo systemctl enable podman.socket --now # if you use Podman rootful similarly
```
```bash ```bash
python run_redroid.py \ python run_redroid.py \
--image redroid/redroid:13.0.0_mindthegapps_houdini_magisk \ --image redroid/redroid:13.0.0_mindthegapps_houdini_magisk \
@@ -186,7 +201,7 @@ The `shell` subcommand is a minimal pseudo-shell only; for a full TTY, use norma
This means **nothing is listening on the host port** (not the same as `unauthorized`). Typical causes: This means **nothing is listening on the host port** (not the same as `unauthorized`). Typical causes:
1. **Container exited**especially with `--rm`, a crash removes the instance. Run `docker ps -a` and `docker logs` on a **non-`--rm`** run (`--keep-container`) to see init/EGL errors. 1. **Container exited**if you used **`--rm`**, a crash removes the instance. By default the container is **kept**; use `docker ps -a` and `docker logs` to inspect. Ensure **`--restart`** is not `no` if you want auto-start after reboot.
2. **`androidboot.redroid_gpu_mode=host`** — Mesa/EGL or DRI inside the guest can fail on some hosts; Android never reaches **adbd**. **Workaround:** force software rendering: 2. **`androidboot.redroid_gpu_mode=host`** — Mesa/EGL or DRI inside the guest can fail on some hosts; Android never reaches **adbd**. **Workaround:** force software rendering:
```bash ```bash
python run_redroid.py ... --adb-insecure --gpu-mode guest python run_redroid.py ... --adb-insecure --gpu-mode guest

View File

@@ -314,10 +314,26 @@ def main():
action="store_true", action="store_true",
help="Remove an existing container with the same name before running", help="Remove an existing container with the same name before running",
) )
parser.add_argument(
"--rm",
dest="ephemeral",
action="store_true",
help="Ephemeral: delete container when it stops (disables auto-restart; not for production)",
)
parser.add_argument(
"--restart",
dest="restart_policy",
default="unless-stopped",
choices=("no", "always", "unless-stopped", "on-failure"),
help=(
"Docker/Podman restart policy when not using --rm (default: unless-stopped = "
"start after daemon reboot unless you docker stop'd it)"
),
)
parser.add_argument( parser.add_argument(
"--keep-container", "--keep-container",
action="store_true", action="store_true",
help="Do not pass --rm to the runtime", help="Legacy: containers are persistent by default; this flag is a no-op",
) )
parser.add_argument( parser.add_argument(
"--dry-run", "--dry-run",
@@ -408,8 +424,10 @@ def main():
] ]
if memory: if memory:
cmd.extend(["--memory", memory]) cmd.extend(["--memory", memory])
if not args.keep_container: if args.ephemeral:
cmd.append("--rm") cmd.append("--rm")
elif args.restart_policy != "no":
cmd.extend(["--restart", args.restart_policy])
cmd.extend(dri_device_args) cmd.extend(dri_device_args)
cmd.append(image) cmd.append(image)
# Init applies read-only props in order; later ro.adb.secure=0 is ignored if adb.secure # Init applies read-only props in order; later ro.adb.secure=0 is ignored if adb.secure
@@ -472,6 +490,14 @@ def main():
subprocess.run(cmd, check=True) subprocess.run(cmd, check=True)
print_color("Container started as {}".format(name), bcolors.GREEN) print_color("Container started as {}".format(name), bcolors.GREEN)
if args.ephemeral:
print_color("Ephemeral (--rm): container is removed when it stops.", bcolors.YELLOW)
else:
print_color(
"Persistent: restart policy is {!r} (survives Docker daemon restart; "
"use `docker stop {}` to opt out of auto-start).".format(args.restart_policy, name),
bcolors.GREEN,
)
if args.diagnose: if args.diagnose:
local_post_diagnose(args.container, name, args.port, args.diagnose_settle) local_post_diagnose(args.container, name, args.port, args.diagnose_settle)
if args.wait_tcp > 0: if args.wait_tcp > 0:
@@ -490,8 +516,8 @@ def main():
print_color("Last logs from container {!r}:".format(name), bcolors.YELLOW) print_color("Last logs from container {!r}:".format(name), bcolors.YELLOW)
subprocess.run([args.container, "logs", "--tail", "100", name], check=False) subprocess.run([args.container, "logs", "--tail", "100", name], check=False)
print( print(
"\nIf the container already exited with --rm, logs are gone; re-run with " "\nIf the container already exited with --rm, logs are gone; re-run without --rm "
"--keep-container (no --rm) to capture docker logs after a crash." "for a persistent container."
) )
print("ADB: adb connect 127.0.0.1:{}".format(args.port)) print("ADB: adb connect 127.0.0.1:{}".format(args.port))
if effective_gpu_mode == "host": if effective_gpu_mode == "host":