Solve the Problem of Ubuntu Locale configuration Cannot set LC_CTYPE
Error: locale: Cannot set LC_CTYPE to default locale: No such file or directory locale:
Regenerate all locale configurations
Step 1: configure the desired locale. The recommended method is to copy all locale supported by Ubuntu to your configuration file and edit it.
Cp/usr/share/i18n/SUPPORTED/var/lib/locales/supported. d/local
Vi/var/lib/locales/supported. d/local, use the dd command to delete and delete, leaving only the en _ series and zh _ series, or other locale
For example:
Root @ bkjia :~ # More/var/lib/locales/supported. d/local
En_US.UTF-8 UTF-8
Zh_CN.UTF-8 UTF-8
Rm/var/lib/locales/supported. d/en
Rm/var/lib/locales/supported. d/zh files have the same functions as local files. You can also write en series files and en series files in zh files for easy classification. Since I have written them in local, these two are useless.
Step 2: regenerate the locale support file
Locale-gen -- purge
The files supporting locale in/usr/lib/locale/are deleted and regenerated. If the configured locale is not generated, or the spelling is incorrect, No support file with the same name is found in the directory, and No such file is displayed.
Step 3: configure the locale environment.
Press locale to copy the environment variables output to/etc/default/locale and manually modify them.
For example:
Root @ bkjia :~ # More/etc/default/locale
LC_CTYPE = en_US.UTF-8
LC_NUMERIC = en_US.UTF-8
LC_TIME = en_US.UTF-8
LC_COLLATE = zh_CN.UTF-8
LC_MONETARY = en_US.UTF-8
LC_MESSAGES = en_US.UTF-8
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_IDENTIFICATION = en_US.UTF-8
LC_ALL =
LANGUAGE = en_US: en
Ststst_id3_tag_encoding = GBK
LANG = en_US.UTF-8
The value that can be set is the value included in/var/lib/locales/supported. d/local, or the name of the folder generated in/usr/lib/locale.
Step 4: log out and log on again, and then tap locale to check whether the error is correct.