From 4c3f5576b9e6628192ec84c8cf3dc28085ddec42 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 15 Jun 2026 22:52:49 +0000 Subject: [PATCH 1/2] fix: detect and retry Electron binary download when npm install silently fails npm install returns 0 even when Electron's postinstall binary download fails, leaving node_modules/electron/dist/electron missing and causing a blank screen with no useful error. After npm install, explicitly check for the binary. If absent, retry via ELECTRON_FORCE_DOWNLOAD=true node install.js. If still missing, print a clear error and exit 1 instead of silently continuing to a broken install. https://claude.ai/code/session_01EyjEQLWbTXcZgbMDarf7NU --- ubuntu-based-kiosk-v1.0.2.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/ubuntu-based-kiosk-v1.0.2.sh b/ubuntu-based-kiosk-v1.0.2.sh index c87fba1..cb4ba38 100644 --- a/ubuntu-based-kiosk-v1.0.2.sh +++ b/ubuntu-based-kiosk-v1.0.2.sh @@ -7260,13 +7260,26 @@ PKGJSON echo "[17/27] Installing Electron packages..." echo "Note: npm may show deprecation warnings (safe to ignore)" sudo -u "$KIOSK_USER" bash -lc "cd '$KIOSK_DIR' && npm install --unsafe-perm" - + + # Verify electron binary downloaded (npm install succeeds even if the binary download fails) + local electron_bin="$KIOSK_DIR/node_modules/electron/dist/electron" + if [[ ! -f "$electron_bin" ]]; then + log_warning "Electron binary not found after npm install — retrying download..." + sudo -u "$KIOSK_USER" bash -lc "cd '$KIOSK_DIR' && ELECTRON_FORCE_DOWNLOAD=true node node_modules/electron/install.js" || true + fi + if [[ ! -f "$electron_bin" ]]; then + log_error "Electron binary download failed. Check network connectivity and retry:" + log_error " cd $KIOSK_DIR && sudo -u $KIOSK_USER ELECTRON_FORCE_DOWNLOAD=true npm install electron --unsafe-perm" + exit 1 + fi + log_success "Electron binary verified" + local sandbox="$KIOSK_DIR/node_modules/electron/dist/chrome-sandbox" if [[ -f "$sandbox" ]]; then sudo chown root:root "$sandbox" sudo chmod 4755 "$sandbox" fi - + sudo -u "$KIOSK_USER" tee "$KIOSK_DIR/start.sh" > /dev/null <<'LAUNCHER' #!/bin/bash cd /home/kiosk/kiosk-app From 2556863129c2b7b16522f47b5b94bf37bcfcd77f Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 15 Jun 2026 23:20:14 +0000 Subject: [PATCH 2/2] fix: use sudo for all config.json access in configure_authelia MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /home/kiosk/ has 750 permissions so the install user can't read inside it. The -f check and both jq reads were running as the current user and failing silently, causing the false "config.json not found" error. Changed: [[ ! -f "$config_file" ]] → sudo test -f "$config_file" jq -r ... "$config_file" → sudo -u kiosk jq -r ... "$config_file" jq ... > "$tmp" → sudo -u kiosk jq ... > "$tmp" && sudo mv https://claude.ai/code/session_01EyjEQLWbTXcZgbMDarf7NU --- ubuntu-based-kiosk-v1.0.2.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ubuntu-based-kiosk-v1.0.2.sh b/ubuntu-based-kiosk-v1.0.2.sh index cb4ba38..8b9087c 100644 --- a/ubuntu-based-kiosk-v1.0.2.sh +++ b/ubuntu-based-kiosk-v1.0.2.sh @@ -9979,15 +9979,15 @@ configure_authelia() { echo local config_file="$KIOSK_DIR/config.json" - if [[ ! -f "$config_file" ]]; then + if ! sudo test -f "$config_file"; then echo "✗ config.json not found — run a full install first." read -r -p "Press Enter to return..." _; return fi # Show current status local current_url current_user - current_url=$(jq -r '.autheliaURL // ""' "$config_file" 2>/dev/null) - current_user=$(jq -r '.autheliaUsername // ""' "$config_file" 2>/dev/null) + current_url=$(sudo -u "$KIOSK_USER" jq -r '.autheliaURL // ""' "$config_file" 2>/dev/null) + current_user=$(sudo -u "$KIOSK_USER" jq -r '.autheliaUsername // ""' "$config_file" 2>/dev/null) if [[ -n "$current_url" ]]; then echo "Current config:" echo " URL: $current_url" @@ -10025,11 +10025,11 @@ process.stdout.write(Buffer.concat([iv,enc]).toString('base64')); local tmp tmp=$(mktemp) - jq --arg url "$authelia_url" \ + sudo -u "$KIOSK_USER" jq --arg url "$authelia_url" \ --arg user "$authelia_user" \ --arg enc "$encrypted" \ '. + {autheliaURL: $url, autheliaUsername: $user, autheliaEncryptedPassword: $enc}' \ - "$config_file" > "$tmp" && mv "$tmp" "$config_file" + "$config_file" > "$tmp" && sudo mv "$tmp" "$config_file" sudo chown "$KIOSK_USER:$KIOSK_USER" "$config_file" echo