1

I would like to change my locale in a VM running Arch.

I'm following the documentation for Arch at: https://wiki.archlinux.org/index.php/locale and did this:

  1. Uncommented the language I want to try yi_US.UTF-8 on /etc/locale.gen and commented all other languages.
  2. Ran the following script:
#!/bin/bash

locale-gen
localectl set-locale LANG=yi_US.UTF-8
unset LANG
source /etc/profile.d/locale.sh

When I run locale after the script I'm getting:

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Camnot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8”
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES=
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIF ICATION="en_US.UTF-8"
LC_ALL=

As I understand that the 3 errors above are because the en_US.UTF-8 locale is not available anymore since I commented it out in /etc/locale.gen.

My output of localectl:

System Locale: LANG=yi_US.UTF-8

And in /etc/locale.conf I have:

LANG=yi_US.UTF-8

It seems that when I run unset LANG and source /etc/profile.d/locale.sh in the script the changes only affect the running script, so the changes aren't permanent.

How can I make the LC_* use the new locale yi_US.UTF-8 in parent shell and all system permanently through the script?

I have read that I should run: export LC_ALL=yi_US.UTF-8, but this doesn't seem correct, this would only work for current terminal session.

Do I have to add LC_ALL=yi_US.UTF-8 or the list of LC_* to /etc/locale.conf to solve the problem?

0

You must log in to answer this question.

Browse other questions tagged .