Jul 17

quick fix for CentOS locale issue on new virtual environment

Wed, 07/17/2013 - 10:36 — peter

We've just setup a new virtual environment, and upon login found this nice error:

# ✔ peter@endor(ttys002) ~
ssh new-server
Last login: Wed Jul 17 08:27:23 2013 from 192.168.73.37
-bash: warning: setlocale: LC_CTYPE: cannot change locale (en_US.UTF-8): No such file or directory
-bash: warning: setlocale: LC_COLLATE: cannot change locale (en_US.UTF-8): No such file or directory
-bash: warning: setlocale: LC_MESSAGES: cannot change locale (en_US.UTF-8): No such file or directory
-bash: warning: setlocale: LC_NUMERIC: cannot change locale (en_US.UTF-8): No such file or directory
-bash: warning: setlocale: LC_TIME: cannot change locale (en_US.UTF-8): No such file or directory

And...

# root@new-server(pts/0) ~  
locale -a
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory
C
POSIX
aa_DJ
aa_DJ.iso88591

Lovely. Fortunately the fix proved to be easy:

rm /usr/lib/locale/locale-archive; ln -s /usr/lib/locale/locale-archive-rpm /usr/lib/locale/locale-archive

Which produced:

# root@new-server(pts/0) ~  
locale -a
aa_DJ
aa_DJ.iso88591
aa_DJ.utf8
aa_ER
aa_ER@saaho
aa_ER.utf8
aa_ER.utf8@saaho
aa_ET
...

Easy Peasy!

-PCP