From 3a3833596c389d78b30f7413b93a41b3d8bb9af9 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 10 Aug 2026 14:52:48 +0000 Subject: [PATCH 1/2] Fix filebrowser crash-looping on permission denied opening its database MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Confirmed from gtstef/filebrowser's own Dockerfile (_docker/Dockerfile): the image runs as a fixed non-root user (adduser -u 1000 filebrowser; USER filebrowser), not root and not remappable via PUID/PGID. The installer's broad `chown -R $ACTUAL_USER:$ACTUAL_USER "$FB_DIR"` left the bind-mounted ./data owned by $ACTUAL_USER (root, on a box where the installer itself runs as root) — UID 1000 inside the container then had no write access to it, so every start failed with "could not open database: open /home/filebrowser/data/database.db: permission denied" and the container crash-looped indefinitely (restart: unless-stopped kept retrying every ~60s, matching the log timestamps this was diagnosed from). Re-chown ./data to 1000:1000 specifically, after the broad chown so it isn't clobbered back to $ACTUAL_USER. --- services/filebrowser.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/services/filebrowser.sh b/services/filebrowser.sh index 2362c74..28a8e34 100644 --- a/services/filebrowser.sh +++ b/services/filebrowser.sh @@ -352,6 +352,15 @@ FB_CONFIG chown -R "$ACTUAL_USER:$ACTUAL_USER" "$FB_DIR" + # The image runs as a fixed non-root user (adduser -u 1000 filebrowser in + # its Dockerfile, not root and not configurable via PUID/PGID), so the + # bind-mounted ./data — where it opens database.sqlite on every start — + # must actually be writable by UID 1000, not by $ACTUAL_USER from the + # broad chown above. Confirmed live: without this, the container fails + # every single start with "could not open database: ... permission + # denied" and restarts in a crash loop indefinitely. + chown -R 1000:1000 "$FB_DIR/data" + # Deploy fbq-add-source.sh helper local _TOOLS_DIR _TOOLS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../tools" 2>/dev/null && pwd)" || true From 3e75c51d1861b7807b8904389499faa2fb9bc47d Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 10 Aug 2026 14:53:44 +0000 Subject: [PATCH 2/2] Fix "local: can only be used in a function" crash in the category menu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The dynamic checklist-sizing code added in the previous commit used `local` for its variables, but the category menu loop it lives in is top-level script code, not inside a function — `local` only works inside one. Confirmed live: this broke the whiptail menu outright on first `sudo ./setup.sh` run after pulling ("only be used in a function", then an unbound-variable error under set -u since the assignment before it never ran). Drop `local`; these are the same kind of plain loop-scoped variables every other var in this loop (CHOSEN_CAT, SVCS, CHOICE, SELECTED) already is. --- setup.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.sh b/setup.sh index 020616c..879a3ef 100755 --- a/setup.sh +++ b/setup.sh @@ -390,11 +390,10 @@ while true; do # terminal can show (tput lines, falling back to a conservative 24 # for a non-terminal/unknown size) so this can't request a dialog # taller than the screen. - local _term_lines _list_h _box_h _term_lines="$(tput lines 2>/dev/null