Linux

Where Is the Linux Locale Configured?

Locale config files and generation on Linux, and why sessions ignore half of them over SSH.

Last updated

System locale lives in /etc/locale.conf on systemd distros (edit via localectl set-locale) and /etc/default/locale on Debian family (managed by update-locale); when both exist, sessions may read different files, so symlinking is the common truce. Available locales generate from /etc/locale.gen via locale-gen against /usr/share/i18n/SUPPORTED.

Runtime follows LANG with LC_* overrides and LC_ALL trumping everything (testing only, never persist it). Unbuilt locales surface as Cannot set LC errors; SSH also needs SendEnv/AcceptEnv pair for LANG to survive the hop, and console logins need profile sourcing of the config.

Where Linux stores this, by platform

Linux
/etc/locale.conf

systemd system wide locale (LANG, LC_* except LC_ALL). Debian/Ubuntu use /etc/default/locale instead (update-locale managed). Generate entries via locale.gen plus locale-gen; verify with locale -a.

Frequently asked questions

Why does locale say Cannot set LC_ALL to default locale?

The locale was never generated. Uncomment it in /etc/locale.gen, run locale-gen, and confirm with locale -a. Setting LC_ALL in config papers over the gap instead of fixing it.

Why is my locale wrong over SSH?

The client never sent it. Enable SendEnv LANG LC_* locally and AcceptEnv on the server, or set the locale directly on the remote machine.

Notice an outdated path? Let us know.