From 732a0c6ac831ebcdfbaa41834d771e40e83894db Mon Sep 17 00:00:00 2001 From: Chuck Date: Sat, 29 Aug 2026 18:20:21 -0400 Subject: [PATCH] fix(install): don't abort when journald settings are absent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Step 13 reads the effective journald config to decide whether persistent storage and a size cap are already set. Both settings are optional and stock Raspberry Pi OS images ship them commented out, so the grep in the journald_cap pipeline exits 1 — under set -Eeuo pipefail that failed the assignment and killed the entire install at line 1748 on every fresh image. Guard the four optional-lookup pipelines with || true so an absent setting reads as empty instead of aborting. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01YF7Q48EYCCkU1Vs932uDY1 --- first_time_install.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/first_time_install.sh b/first_time_install.sh index c7ec7cf1..198a8f2e 100755 --- a/first_time_install.sh +++ b/first_time_install.sh @@ -1740,12 +1740,15 @@ journald_effective() { systemd-analyze cat-config systemd/journald.conf >/dev/null 2>&1; then systemd-analyze cat-config systemd/journald.conf 2>/dev/null else - cat /etc/systemd/journald.conf /etc/systemd/journald.conf.d/*.conf 2>/dev/null + cat /etc/systemd/journald.conf /etc/systemd/journald.conf.d/*.conf 2>/dev/null || true fi } journald_conf="$(journald_effective)" -journald_storage="$(printf '%s\n' "$journald_conf" | grep -E '^[[:space:]]*Storage=' | tail -n1 | cut -d= -f2 | tr -d '[:space:]')" -journald_cap="$(printf '%s\n' "$journald_conf" | grep -E '^[[:space:]]*SystemMaxUse=' | tail -n1 | cut -d= -f2 | tr -d '[:space:]')" +# Both settings are optional, and stock images ship them commented out. grep +# exits 1 on no match, which pipefail turns fatal under set -e — an absent +# setting must read as empty, not abort the install. +journald_storage="$(printf '%s\n' "$journald_conf" | grep -E '^[[:space:]]*Storage=' | tail -n1 | cut -d= -f2 | tr -d '[:space:]' || true)" +journald_cap="$(printf '%s\n' "$journald_conf" | grep -E '^[[:space:]]*SystemMaxUse=' | tail -n1 | cut -d= -f2 | tr -d '[:space:]' || true)" if [ "$journald_storage" = "persistent" ] && [ -n "$journald_cap" ]; then echo "Persistent journald storage already configured (SystemMaxUse=$journald_cap)" @@ -1771,7 +1774,7 @@ else # after ledmatrix-persistent.conf (zz-local.conf and friends) still wins. # Writing the file is not evidence it took effect -- re-read and say so # plainly rather than reporting success we cannot confirm. - journald_now="$(journald_effective | grep -E '^[[:space:]]*Storage=' | tail -n1 | cut -d= -f2 | tr -d '[:space:]')" + journald_now="$(journald_effective | grep -E '^[[:space:]]*Storage=' | tail -n1 | cut -d= -f2 | tr -d '[:space:]' || true)" if [ "$journald_now" = "persistent" ]; then echo " Persistent journald storage active" else