[CENTOS] What to do if the yum command fails to set locale, defaulting to C

--Environment --Container created with Docker - CentOS Linux release 7.7.1908 (Core) - CUI : Xfce - xfce4-terminal 0.8.7.4

Event: I was told something after yum check

$ sudo yum check
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror, ovl
check all

Cause: LC_ALL is not set

"Failed to set locale, defaulting to C" is displayed when yum is executed. --IT classroom where Tihiro's head can rest

#LC when checking environment variables_There is no ALL
$ printenv | grep LC 
$

Action: Set LC_ALL

#Set
$ export LC_ALL=C
#check
$ printenv | grep LC
LC_ALL=C
#Try again
$ sudo yum check
Loaded plugins: fastestmirror, ovl
check all

Cause: There is no locale set in the configurable locale

Failed to set locale, defaulting to C is displayed when executing a command on RHEL8 --Qiita

Status 1: The locale is set to "ja_JP.UTF-8"

# 「ja_JP.UTF-Even if "8" is set ...
$ localectl
   System Locale: LANG=ja_JP.UTF-8
       VC Keymap: us
      X11 Layout: us

# 「ja_JP.UTF-It is said that there is no 8 "
$ locale
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_ALL to default locale: No such file or directory
LANG=ja_JP.UTF-8
LC_CTYPE="ja_JP.UTF-8"
LC_NUMERIC="ja_JP.UTF-8"
LC_TIME="ja_JP.UTF-8"
LC_COLLATE="ja_JP.UTF-8"
LC_MONETARY="ja_JP.UTF-8"
LC_MESSAGES="ja_JP.UTF-8"
LC_PAPER="ja_JP.UTF-8"
LC_NAME="ja_JP.UTF-8"
LC_ADDRESS="ja_JP.UTF-8"
LC_TELEPHONE="ja_JP.UTF-8"
LC_MEASUREMENT="ja_JP.UTF-8"
LC_IDENTIFICATION="ja_JP.UTF-8"
LC_ALL=

State 2: There is no "ja_JP.UTF-8" in the configurable locale

#"Ja" in the configurable locale_JP.UTF-8 "is not
$ localectl list-locales
en_US.utf8

$ 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
en_US.utf8

#Not even in the installable language package ...
$ sudo yum list langpacks-*
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror, ovl
Repository google-chrome is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * base: ty1.mirror.newmediaexpress.com
 * epel: nrt.edge.kernel.org
 * extras: ty1.mirror.newmediaexpress.com
 * updates: ty1.mirror.newmediaexpress.com
Error: No matching Packages to list

Information: CentOS7 made with Docker does not have a Japanese locale, and even if it is set, it seems to disappear when yum update is done.

I added Japanese with localedef in the Docker definition file, but for some reason there is no Japanese locale. The answer was on the following page.

Docker's centos: centos7 has zero locale -a | grep -c ja_JP, which means that the Japanese locale is not defined. ... omitted ... If you yum update glibc-common, it will disappear w Add an indelible Japanese locale to the CentOS 7 container-Qiita

Correspondence: Add Japanese locale

Kill the cannot change locale --ARCHIVESDRIVE HB

# 「ja_JP.UTF-8 "is added
$ sudo localedef -f UTF-8 -i ja_JP ja_JP

#added!
$ localectl list-locales
en_US.utf8
ja_JP
ja_JP.utf8
$ locale -a
C
POSIX
en_US.utf8
ja_JP
ja_JP.utf8

#The error message has disappeared!
$ locale
LANG=ja_JP.UTF-8
LC_CTYPE="ja_JP.UTF-8"
LC_NUMERIC="ja_JP.UTF-8"
LC_TIME="ja_JP.UTF-8"
LC_COLLATE="ja_JP.UTF-8"
LC_MONETARY="ja_JP.UTF-8"
LC_MESSAGES="ja_JP.UTF-8"
LC_PAPER="ja_JP.UTF-8"
LC_NAME="ja_JP.UTF-8"
LC_ADDRESS="ja_JP.UTF-8"
LC_TELEPHONE="ja_JP.UTF-8"
LC_MEASUREMENT="ja_JP.UTF-8"
LC_IDENTIFICATION="ja_JP.UTF-8"
LC_ALL=ja_JP.UTF-8

#did it!
$ sudo yum check
Loaded plugins: fastestmirror, ovl
Repository google-chrome is listed more than once in the configuration
check all

Recommended Posts

What to do if the yum command fails to set locale, defaulting to C
What to do if yum breaks
Note: What to do if pip install fails
Let's Encrypt updated! What to do if the certbot renew command doesn't work
What to do if pip install fails in Xcode 5.1
What to do if SciPy installation fails on CentOS
What to do if pip install fails to install dependent libraries
What to do if the print command itself causes an error in Maya python
What to do if ʻarguments [0] .scrollIntoView ();` fails in python selenium
What to do if the package dependency cannot be repaired
What to do if package installation fails when deploying to heroku
What to do if `pip install matplotlib` fails on Mac
What to do if pip install mysqlclient fails on MacOS
[AWS] What to do when the ping command causes a "timeout"
What to do if the inode is exhausted on EC2 Linux
What to do if you can't use the trash in Lubuntu 18.04.
What to do if the Pipenv environment is corrupted by updating Homebrew
What to do if the Chainer (Windows) sample mnist terminates with WinError 183.
What to do if the server doesn't start with python manage.py runserver
What to do if pipreqs results in UnicodeDecodeError
What to do if you can't pipenv shell
What to do if mod_fcgid cannot resolve UnicodeEncodeError
What to do if rails s doesn't work
[Note] What to do if the Qt library conflicts between pyqt and opencv
What to do if pip cannot be installed
What to do if atom autocomplete-python doesn't work
What to do if Docker-sync suddenly stops working
What to do if a version error occurs in the selenium Chrome driver
What to do if "amazon-linux-extras" → "No module named amazon_linux_extras"
What to do if (base) is displayed at the beginning of the Mac terminal
What to do if ubuntu says your password is too short to change [passwd command] [ubuntu]
What to do if the Microsoft Store opens even if you run python on Windows
What to do if the progress bar is not displayed in tqdm of python
What to do if Python does not switch from the System version in pyenv
What to do if you get the error ʻERR_FEATURE_UNAVAILABLE_ON_PLATFORM` when using ts-node-dev on Linux
What to do if you can't hit the arrow keys in the Python interactive console
No module named What to do if you get'libs.resources'
ModuleNotFoundError: No module What to do if you get'tensorflow.contrib'
What to do if a UnicodeDecodeError occurs in pip
What to do if sys / cdefs.h does not exist
What to do if pyenv is not enabled (zsh)
[* CentOS 6.10] What to do if you cannot add the IUS Community Project repository on CentOS 6.5 (VirtualBox)
What to do if the image is not displayed using matplotlib etc. in the Docker container
What to do if GeoPandas installation fails (Fiona / GDAL error * Rtree installation method is also added)
What to do if you get a Cannot retrieve metalink for repository error in yum
What to do if you are addicted to Windows character code
What to do if pip gives a DistributionError in Homebrew
What to do if you get "coverage unknown" in Coveralls
What to do if you can't sort files with subscripts
What to do if a 0xC0000005 error occurs in tf.train.start_queue_runners ()
What to do if you get `locale.Error: unsupported locale setting` when getting the day of the week from a date in Python
What to do if you can't log in as root
What to do if you can't use WiFi on Linux
What to do if Linux VLC can no longer rotate
What to do if you lose your EC2 key pair
[For IT beginners] What to do when the rev command cannot be used with Git Bash
[Django] What to do if the model you want to create has a large number of fields
What to do if you get an error saying c compiler cannot create executables in configure
What to do if the user name is changed and the pyenv library path does not pass
What to do if Python doesn't work on Git for Windows
What to do if you can't install pyaudio with pip #Python