install: run install in a neutral C.UTF-8 locale

Fresh installs (and SSH sessions that forward LC_* variables from the client)
can reference an ungenerated locale, causing apt/perl/python to emit
"Cannot set LC_CTYPE to default locale" warnings throughout the install log.

Export LC_ALL=C.UTF-8 for the install run. C.UTF-8 is built into glibc, always
present, and locale-neutral, so it silences the warnings without generating a
locale, without adding a dependency, and without changing the user's configured
locale (e.g. an en_GB.UTF-8 system stays en_GB.UTF-8).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Roland 2026-07-22 18:41:59 -06:00
parent ec2b584429
commit f3a9a9f67c
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
2 changed files with 14 additions and 0 deletions

View file

@ -4,6 +4,13 @@ echo "Debian 12 install start: $(date '+%Y-%m-%d %H:%M:%S')"
set -x
set -e
# Run the install in a predictable UTF-8 locale. Fresh images (or SSH sessions
# forwarding LC_* variables from the client) may reference an ungenerated
# locale, which makes apt/perl/python emit "Cannot set LC_CTYPE" warnings
# throughout the install. C.UTF-8 is built into glibc, always present, and
# locale-neutral, so this does not change the user's configured locale.
export LC_ALL=C.UTF-8
# Update if we haven't updated in the last day.
[ -z "$(find -H /var/lib/apt/lists -maxdepth 0 -mtime -1)" ] && apt update
# Install dependencies.

View file

@ -4,6 +4,13 @@ echo "Raspberry Pi OS install start: $(date '+%Y-%m-%d %H:%M:%S')"
set -x
set -e
# Run the install in a predictable UTF-8 locale. Fresh images (or SSH sessions
# forwarding LC_* variables from the client) may reference an ungenerated
# locale, which makes apt/perl/python emit "Cannot set LC_CTYPE" warnings
# throughout the install. C.UTF-8 is built into glibc, always present, and
# locale-neutral, so this does not change the user's configured locale.
export LC_ALL=C.UTF-8
# Update if we haven't updated in the last day.
[ -z "$(find -H /var/lib/apt/lists -maxdepth 0 -mtime -1)" ] && apt update
# Install dependencies.