OPINIONATED OMARCHY
TROUBLESHOOTING CORPUS
790
RECORDS
790
AUDITED
0
UNCHECKED
2388
SOURCES
LIVE
apps-services low common DISPUTE

Fix "cannot change locale" warnings from bash, perl and ssh

archomarchyendeavouroscachyosmanjarolocalesshcontainers
CORRECTED An auditor found the fix wrong or incomplete and rewrote it.
AUDIT NOTE

Checked every claim against the cited Arch wiki Locale page, fetched as raw wikitext, and against this Omarchy 4.0.2-1 workstation. Confirmed on this machine: /etc/locale.gen line 172 already reads en_US.UTF-8 UTF-8 uncommented, locale -a lists en_US.utf8, /etc/locale.conf holds LANG=en_US.UTF-8 and is owned by no package, and /etc/profile.d/locale.sh from filesystem 2025.10.12-1 does check $XDG_CONFIG_HOME/locale.conf then ~/.config/locale.conf before /etc/locale.conf. From the source: the wiki supports the locale-gen step, localectl set-locale, the per-user override, the unset LANG plus source /etc/profile.d/locale.sh quirk including the exact note that LANG must be unset first, the LC_CTYPE pin for unofficial locales, and the danger almost verbatim, since LC_ALL is the only LC_* variable that cannot be set in locale.conf and is meant only for testing. The danger is right and is the mistake people actually make, so it stays unchanged. Severity low also stays. Two claims did not survive. The frequency is wrong: upstream omacom/omarchy-iso hardcodes "sys_lang": "en_US.UTF-8" in configs/airootfs/root/configurator, and its own fresh-install manifest records /etc/locale.conf as LANG=en_US.UTF-8, so a stock Omarchy 4 install cannot raise this warning for the default locale and very-common overstates it. common is the honest rating, because changing to a non-US locale by hand and working in containers both remain frequent. The SSH mechanism in the cause is also not a default: grep -niE 'sendenv|acceptenv' across /etc/ssh/ssh_config, /etc/ssh/sshd_config, /etc/ssh/ssh_config.d/ and /etc/ssh/sshd_config.d/ returns nothing on openssh 10.5p1-1, sshd_config(5) documents the AcceptEnv default as accepting no environment variables, ssh_config(5) documents the SendEnv default as sending none, and ssh -G localhost prints no sendenv line, so a forwarded LC_* lands only on a server explicitly configured for it. The cited wiki page never mentions ssh at all, so that sentence was never sourced. The fix's sed -i is a no-op on Omarchy 4 because the line is already uncommented, so the rewrite makes the reader look first and labels the Omarchy 4 and plain Arch branches. It also adds one verified Omarchy 4 detail: /usr/share/omarchy/default/bash/envs, from omarchy-settings 4.0.2-1 and reached through default/bash/rc, mirrors locale.sh for interactive non-login shells but sources /etc/locale.conf only, so a per-user ~/.config/locale.conf is ignored over a plain ssh host. Not exercised: I have no sudo, so I ran no locale-gen, no localectl set-locale and edited neither file, and I tested neither a real SSH session with AcceptEnv set nor a container.

The cause above was rewritten on 2026-09-11 to match this note; the fix was corrected by the audit itself.
RISK

Never set LC_ALL in /etc/locale.conf. It is the one LC_* variable that cannot be set there and it overrides every other category, silently breaking per-category settings. It is meant only for temporary testing.

Symptom

Almost every command prints warnings like:


bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8): No such file or directory
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LANG = "en_US.UTF-8"
    are supported and installed on your system.

This shows up wherever the locale named in the environment was never generated: inside a container or chroot, after /etc/locale.conf is pointed at a locale missing from /etc/locale.gen, or over SSH on a server configured with an AcceptEnv LANG LC_* line when the client sends a locale the server does not have.

Cause

The locale named in LANG/LC_* has not been generated. Locales must be uncommented in /etc/locale.gen and built with locale-gen before they exist. Omarchy 4's installer already does this for en_US.UTF-8, so a stock Omarchy machine raises this only after the locale is changed by hand, inside a container or chroot that never ran locale-gen, or when a locale arrives from outside the machine. SSH is one such route but it is not a default anywhere on Arch or Omarchy: sshd copies no client environment variables into the session unless AcceptEnv names them, and openssh ships no AcceptEnv line, so a client's forwarded LC_* reaches the shell only on a server that was deliberately configured to accept it.

Fix

First check whether the locale already exists, because on Omarchy 4 it usually does:


locale
locale -a
grep -n '^[^#]' /etc/locale.gen
cat /etc/locale.conf

**Omarchy 4:** the ISO configurator hardcodes "sys_lang": "en_US.UTF-8" into the archinstall config, so a fresh install already carries en_US.UTF-8 UTF-8 uncommented in /etc/locale.gen, en_US.utf8 in locale -a, and LANG=en_US.UTF-8 in /etc/locale.conf. The sed below is therefore a no-op on a stock machine. Nothing in the omarchy or omarchy-settings packages rewrites either file and /etc/locale.conf is owned by no package, so a hand edit survives omarchy update. If the warning names en_US.UTF-8 on such a machine, the locale is missing from a container or chroot, not from the host.

**Plain Arch, or any locale Omarchy did not generate:** uncomment the line in /etc/locale.gen and build it. Confirm the exact line first, because it may already be uncommented:


grep -n 'en_US.UTF-8' /etc/locale.gen
sudo sed -i 's/^#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
sudo locale-gen

locale-gen also reruns on every glibc update, so a locale left uncommented in /etc/locale.gen stays generated.

Set it system-wide in /etc/locale.conf:


LANG=en_US.UTF-8

or equivalently:


sudo localectl set-locale LANG=en_US.UTF-8

Apply it in the current shell without logging out (LANG must be unset first or locale.sh will not update):


unset LANG
source /etc/profile.d/locale.sh
locale

To override just for your user, create ~/.config/locale.conf with the same syntax. /etc/profile.d/locale.sh reads it ahead of /etc/locale.conf, but only for login shells. On Omarchy 4 an interactive non-login shell, which is what a plain ssh host gets, is handled instead by /usr/share/omarchy/default/bash/envs, and that file sources /etc/locale.conf only. A per-user ~/.config/locale.conf is ignored there, so set the system file when you need the locale over SSH. A non-interactive ssh host command runs neither, so LANG is unset and the command lands in the C locale.

If you are using a custom or unofficial locale (for example en_XX.UTF-8) and dead keys or compose stop working, pin LC_CTYPE to a supported locale in /etc/locale.conf:


LANG=en_XX.UTF-8
LC_CTYPE=en_US.UTF-8

If the warnings only appear over SSH, the server was configured with an AcceptEnv line, because openssh accepts nothing by default. Either generate the locale the client sends, or narrow SendEnv in the client's ~/.ssh/config. Check both ends:


grep -rniE 'sendenv|acceptenv' /etc/ssh/ssh_config /etc/ssh/sshd_config /etc/ssh/ssh_config.d/ /etc/ssh/sshd_config.d/

Verify

locale prints your locale with no warnings, locale -a | grep -i en_US lists en_US.utf8, and opening a new terminal produces no setlocale messages.

Sources

locale-cannot-change-locale-warnings