From 0a02e3bcc459c9032407b2fe25347c9cf8485269 Mon Sep 17 00:00:00 2001 From: Aer Storm Date: Thu, 5 Nov 2026 17:37:15 +0100 Subject: [PATCH] Give the runtime user a writable HOME so the browser helper's Chromium can start The entrypoint drops privileges with setpriv but keeps HOME=/root, which the runtime user (PUID) cannot write. Chromium's crash reporter then aborts at startup with "chrome_crashpad_handler: --database is required", so every browser-based capture (easyx-browser-fetch) fails with "Chromium debugging page did not start". - docker-entrypoint.sh: create /tmp/easyx-home for the runtime user and export it as HOME before dropping privileges (yt-dlp and other tools also get a writable cache directory). - easyx-browser-fetch: fall back to a per-user temporary home when HOME is not writable, so the helper also works with other launchers. --- docker-entrypoint.sh | 7 +++++++ scripts/easyx-browser-fetch.py | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index ce91b27..746f734 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -18,6 +18,13 @@ if [ "$(id -u)" = "0" ]; then chown -R "$puid:$pgid" "$data_dir" chown "$puid:$pgid" "$media_dir" + # setpriv keeps root's HOME (/root), which the runtime user cannot write: Chromium's crash + # reporter then aborts at startup ("chrome_crashpad_handler: --database is required") and + # tools lose their caches. Give the runtime user a home of its own. + runtime_home="/tmp/easyx-home" + install -d -m 0700 -o "$puid" -g "$pgid" "$runtime_home" + export HOME="$runtime_home" + umask 002 exec setpriv --reuid="$puid" --regid="$pgid" --clear-groups /usr/bin/tini -- "$@" fi diff --git a/scripts/easyx-browser-fetch.py b/scripts/easyx-browser-fetch.py index 6fb3702..6e93c82 100644 --- a/scripts/easyx-browser-fetch.py +++ b/scripts/easyx-browser-fetch.py @@ -16,6 +16,14 @@ from websockets.asyncio.client import connect +# Chromium's crash reporter needs a writable home: without one it exits at once +# ("chrome_crashpad_handler: --database is required"), for example when the container +# drops root privileges but keeps HOME=/root. +if not os.access(os.environ.get("HOME") or "/nonexistent", os.W_OK): + os.environ["HOME"] = os.path.join(tempfile.gettempdir(), f"easyx-home-{os.getuid()}") + os.makedirs(os.environ["HOME"], mode=0o700, exist_ok=True) + + MEDIA_URL_RE = re.compile( r"https?://[^\s'\"<>\\]+?(?:\.m3u8|\.mpd)(?:\?[^\s'\"<>\\]*)?", re.IGNORECASE,