android-emulator: api36-v4 — pin emulator 36.1.9; bind socat to pod IP
Two final fixes from the live debugging session: (1) sdkmanager-latest emulator 36.6.11 hangs before executing a single guest instruction in this pod (KVM and TCG alike, every gpu mode, crash-reporting on or off) while 36.1.9 boots Android in ~107s — the entrypoint now pins build 13823996 on the PVC; (2) the emulator already listens on 127.0.0.1:5555, so socat's wildcard bind died with EADDRINUSE and its exit restarted the pod right after a successful boot — socat now binds the pod IP only.
This commit is contained in:
parent
85dbec6108
commit
577267cd97
3 changed files with 23 additions and 5 deletions
|
|
@ -4,8 +4,8 @@
|
||||||
# cmdline-tools and the native libraries the emulator needs at runtime.
|
# cmdline-tools and the native libraries the emulator needs at runtime.
|
||||||
#
|
#
|
||||||
# Rebuild + push (rare — only when tool/library versions bump):
|
# Rebuild + push (rare — only when tool/library versions bump):
|
||||||
# docker build -t forgejo.viktorbarzin.me/viktor/android-emulator:api36-v3 .
|
# docker build -t forgejo.viktorbarzin.me/viktor/android-emulator:api36-v4 .
|
||||||
# docker push forgejo.viktorbarzin.me/viktor/android-emulator:api36-v3
|
# docker push forgejo.viktorbarzin.me/viktor/android-emulator:api36-v4
|
||||||
FROM eclipse-temurin:17-jdk-jammy
|
FROM eclipse-temurin:17-jdk-jammy
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,11 @@ set -euo pipefail
|
||||||
|
|
||||||
API_LEVEL="${API_LEVEL:-36}"
|
API_LEVEL="${API_LEVEL:-36}"
|
||||||
SYSTEM_IMAGE="system-images;android-${API_LEVEL};google_apis;x86_64"
|
SYSTEM_IMAGE="system-images;android-${API_LEVEL};google_apis;x86_64"
|
||||||
|
# Pinned emulator build (36.1.9). The sdkmanager-latest emulator (36.6.11)
|
||||||
|
# hangs before executing a single guest instruction in this pod (KVM and TCG
|
||||||
|
# alike, all gpu modes) — debugged 2026-06-11; 36.1.9 boots fine. Bump only
|
||||||
|
# after verifying a newer build actually boots here.
|
||||||
|
EMULATOR_BUILD="${EMULATOR_BUILD:-13823996}"
|
||||||
AVD_NAME="${AVD_NAME:-lab}"
|
AVD_NAME="${AVD_NAME:-lab}"
|
||||||
EMULATOR_RAM_MB="${EMULATOR_RAM_MB:-4096}"
|
EMULATOR_RAM_MB="${EMULATOR_RAM_MB:-4096}"
|
||||||
SCREEN_GEOMETRY="${SCREEN_GEOMETRY:-1080x2280x24}"
|
SCREEN_GEOMETRY="${SCREEN_GEOMETRY:-1080x2280x24}"
|
||||||
|
|
@ -39,6 +44,16 @@ if [ ! -f "$MARKER" ]; then
|
||||||
touch "$MARKER"
|
touch "$MARKER"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# --- pin the emulator build (replaces whatever sdkmanager installed) ---------
|
||||||
|
if [ ! -f "/sdk/.emulator-pinned-${EMULATOR_BUILD}" ]; then
|
||||||
|
echo "Pinning emulator build ${EMULATOR_BUILD}..."
|
||||||
|
wget -q "https://dl.google.com/android/repository/emulator-linux_x64-${EMULATOR_BUILD}.zip" -O /sdk/emu.zip
|
||||||
|
rm -rf /sdk/emulator
|
||||||
|
unzip -qo /sdk/emu.zip -d /sdk && rm -f /sdk/emu.zip
|
||||||
|
rm -f /sdk/.emulator-pinned-*
|
||||||
|
touch "/sdk/.emulator-pinned-${EMULATOR_BUILD}"
|
||||||
|
fi
|
||||||
|
|
||||||
# --- AVD (idempotent) --------------------------------------------------------
|
# --- AVD (idempotent) --------------------------------------------------------
|
||||||
# avdmanager IGNORES ANDROID_SDK_ROOT (and has no --sdk_root): it derives the
|
# avdmanager IGNORES ANDROID_SDK_ROOT (and has no --sdk_root): it derives the
|
||||||
# SDK root from its own toolsdir. Run it from a copy of cmdline-tools seeded
|
# SDK root from its own toolsdir. Run it from a copy of cmdline-tools seeded
|
||||||
|
|
@ -83,8 +98,11 @@ done
|
||||||
echo "Boot completed."
|
echo "Boot completed."
|
||||||
|
|
||||||
# Expose the emulator's adbd (localhost:5555) to the pod network. Plain TCP,
|
# Expose the emulator's adbd (localhost:5555) to the pod network. Plain TCP,
|
||||||
# no auth — reachable only inside the LAN via the MetalLB IP.
|
# no auth — reachable only inside the LAN via the MetalLB IP. Bind to the pod
|
||||||
socat TCP-LISTEN:5555,fork,reuseaddr TCP:127.0.0.1:5555 &
|
# IP only: the emulator itself already listens on 127.0.0.1:5555, so a
|
||||||
|
# wildcard bind fails with EADDRINUSE.
|
||||||
|
POD_IP=$(hostname -i | awk '{print $1}')
|
||||||
|
socat "TCP-LISTEN:5555,bind=${POD_IP},fork,reuseaddr" TCP:127.0.0.1:5555 &
|
||||||
|
|
||||||
# Supervise: if any background process dies, exit so the pod restarts.
|
# Supervise: if any background process dies, exit so the pod restarts.
|
||||||
wait -n
|
wait -n
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,6 @@ variable "tls_secret_name" {
|
||||||
|
|
||||||
variable "image_tag" {
|
variable "image_tag" {
|
||||||
type = string
|
type = string
|
||||||
default = "api36-v3"
|
default = "api36-v4"
|
||||||
description = "android-emulator image tag at forgejo.viktorbarzin.me/viktor/android-emulator. Built + pushed manually from stacks/android-emulator/docker/ (see README.md) — bump this when the image is rebuilt."
|
description = "android-emulator image tag at forgejo.viktorbarzin.me/viktor/android-emulator. Built + pushed manually from stacks/android-emulator/docker/ (see README.md) — bump this when the image is rebuilt."
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue