Stop the kiosk coming up blank after every reboot

A reboot kills Chromium rather than closing it, so it writes "exit_type":"Crashed" into
its profile. On the next boot it came up with a restore prompt and a tab stuck for ever
on a blank "Loading..." page - navigation never committed, navigator.serviceWorker was
still undefined, nothing on screen. On a device with a monitor and no keyboard that is
permanent, and the backend was healthy throughout: / answered in 5 ms and /api/library
returned 812 kB the whole time.

--disable-session-crashed-bubble hides the prompt but not the state behind it, and here
the prompt showed anyway. .xinitrc now rewrites exit_type and exited_cleanly before
launching, which is the usual remedy for a kiosk that gets powered off rather than shut
down, and adds --hide-crash-restore-bubble (the current name for the flag).

Verified by rebooting and leaving it alone: the page comes up on its own with its title
and its content.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-20 17:31:52 +02:00
parent 831a1b50a4
commit 8c225bbe06
3 changed files with 45 additions and 11 deletions

View File

@@ -29,6 +29,18 @@ BROWSER_ARGS="--use-gl=egl --enable-gpu-rasterization --ignore-gpu-blocklist --e
BROWSER_ARGS="$BROWSER_ARGS --noerrdialogs --disable-infobars --no-first-run"
BROWSER_ARGS="$BROWSER_ARGS --no-default-browser-check --disable-session-crashed-bubble"
BROWSER_ARGS="$BROWSER_ARGS --password-store=basic --check-for-update-interval=31536000"
BROWSER_ARGS="$BROWSER_ARGS --hide-crash-restore-bubble"
# Chromium records in its profile how it last exited. A reboot kills it rather than
# closing it, so that record says "Crashed", and the next start comes up with a restore
# prompt and a tab stuck on a blank "Loading..." page - which, on a device with no
# keyboard in front of it, it never leaves. The flags above hide the prompt but do not
# clear the state behind it; rewriting the two keys before launch does, and is the
# standard remedy for a kiosk that is powered off rather than shut down.
PREFS="$HOME/.config/chromium/Default/Preferences"
if [ -f "$PREFS" ]; then
sed -i 's/"exit_type":"[^"]*"/"exit_type":"Normal"/; s/"exited_cleanly":false/"exited_cleanly":true/' "$PREFS"
fi
{% if pi_kiosk_mode == 'debug' %}
# Debug mode only. Binds to 127.0.0.1, so it is reachable over an ssh tunnel and from
# nowhere else. Lets the page be driven and measured from a shell - `curl