From 4b7ab7c0bee33291620fcd4ba4aab38961225732 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 21 Apr 2026 00:16:55 +0000 Subject: [PATCH] fix: prevent sudo cache expiry during install and add timezone fallback Two issues caused the timezone step to fail on first run: 1. Sudo credential cache (default 15 min) can expire during the long apt install step before configure_timezone runs. Added `sudo -v` immediately after the install confirmation prompt to prime the cache as late as possible, just before the first long-running step. 2. `sudo timedatectl set-timezone` can fail with "Access denied" if polkit/D-Bus is not yet fully ready in the install environment. Added a direct fallback (ln -sf localtime + tee /etc/timezone) that bypasses D-Bus entirely. https://claude.ai/code/session_01M3tiofbGfmTddeMcXr8nXr --- ubuntu-based-kiosk-v0.9.9.1.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/ubuntu-based-kiosk-v0.9.9.1.sh b/ubuntu-based-kiosk-v0.9.9.1.sh index 2fe67de..91a7631 100644 --- a/ubuntu-based-kiosk-v0.9.9.1.sh +++ b/ubuntu-based-kiosk-v0.9.9.1.sh @@ -796,7 +796,14 @@ configure_timezone() { if [[ -n "$new_tz" ]]; then if timedatectl list-timezones | grep -q "^${new_tz}$"; then - sudo timedatectl set-timezone "$new_tz" && log_success "Timezone updated to $new_tz" + if sudo timedatectl set-timezone "$new_tz"; then + log_success "Timezone updated to $new_tz" + else + # Fallback: set timezone directly without D-Bus + sudo ln -sf "/usr/share/zoneinfo/$new_tz" /etc/localtime + echo "$new_tz" | sudo tee /etc/timezone > /dev/null + log_success "Timezone updated to $new_tz (direct)" + fi else log_error "Invalid timezone: $new_tz" fi @@ -3908,7 +3915,10 @@ first_time_install() { echo read -r -p "Proceed with installation? (y/n): " proceed [[ ! "$proceed" =~ ^[Yy]$ ]] && exit 0 - + + # Cache sudo credentials upfront so they don't expire mid-install + sudo -v + echo echo "[1/27] Installing packages..." sudo apt update