Failed to set locale, defaulting to C.UTF-8 と言われているときの対処

locale set に ja_JP.utf8 がないので、標準設定の C.utf8 が使われるようです。

minimum install で日本語環境を突っ込み忘れたので、どうも日本語環境にならないので、無理やり追加します

```
# dnf clean all
Failed to set locale, defaulting to C.UTF-8
20 files removed

# localectl list-locales
C.utf8
en_AG
en_AU
en_AU.utf8
en_BW
en_BW.utf8
en_CA
en_CA.utf8
en_DK
en_DK.utf8
en_GB
en_GB.iso885915
en_GB.utf8
en_HK
en_HK.utf8
en_IE
en_IE.utf8
en_IE@euro
en_IL
en_IN
en_NG
en_NZ
en_NZ.utf8
en_PH
en_PH.utf8
en_SC.utf8
en_SG
en_SG.utf8
en_US
en_US.iso885915
en_US.utf8
en_ZA
en_ZA.utf8
en_ZM
en_ZW
en_ZW.utf8
```

# Install

langpack-ja を入れたら良いみたいだけど無いので、探した結果 glibc-langpack-ja がそれっぽい。

```
#  dnf -y install langpack-ja
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 0:05:57 ago on Mon Aug  3 00:36:01 2020.
No match for argument: langpack-ja
Error: Unable to find a match: langpack-ja

# dnf search langpack-ja
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 0:06:05 ago on Mon Aug  3 00:36:01 2020.
=========================================================================================================== Name Matched: langpack-ja ============================================================================================================
glibc-langpack-ja.x86_64 : Locale data for ja
libreoffice-langpack-ja.x86_64 : Japanese language pack for LibreOffice
[root@ik1-420-42281 ~]# dnf info glibc-langpack-ja
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 0:06:41 ago on Mon Aug  3 00:36:01 2020.
Available Packages
Name         : glibc-langpack-ja
Version      : 2.28
Release      : 101.el8
Architecture : x86_64
Size         : 326 k
Source       : glibc-2.28-101.el8.src.rpm
Repository   : BaseOS
Summary      : Locale data for ja
URL          : http://www.gnu.org/software/glibc/
License      : LGPLv2+ and LGPLv2+ with exceptions and GPLv2+ and GPLv2+ with exceptions and BSD and Inner-Net and ISC and Public Domain and GFDL
Description  : The glibc-langpack-ja package includes the basic information required
             : to support the ja language in your applications.



# dnf install -y glibc-langpack-ja
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 0:06:48 ago on Mon Aug  3 00:36:01 2020.
Dependencies resolved.
==================================================================================================================================================================================================================================================
 Package                                                          Architecture                                          Version                                                       Repository                                             Size
==================================================================================================================================================================================================================================================
Installing:
 glibc-langpack-ja                                                x86_64                                                2.28-101.el8                                                  BaseOS                                                326 k

Transaction Summary
==================================================================================================================================================================================================================================================
Install  1 Package

Total download size: 326 k
Installed size: 2.1 M
Downloading Packages:
glibc-langpack-ja-2.28-101.el8.x86_64.rpm                                                                                                                                                                         1.7 MB/s | 326 kB     00:00    
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                             471 kB/s | 326 kB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                                                          1/1 
  Installing       : glibc-langpack-ja-2.28-101.el8.x86_64                                                                                                                                                                                    1/1 
  Running scriptlet: glibc-langpack-ja-2.28-101.el8.x86_64                                                                                                                                                                                    1/1 
  Verifying        : glibc-langpack-ja-2.28-101.el8.x86_64                                                                                                                                                                                    1/1 

Installed:
  glibc-langpack-ja-2.28-101.el8.x86_64                                                                                                                                                                                                           

Complete!

```

# LocaleCtl

インストールが終わったら設定をします。

`localectl set-locale ja_JP.utf8`


# 参考

- 参考: [【 localectl 】コマンド――ロケール設定の確認と変更 atmarkit
](https://www.atmarkit.co.jp/ait/articles/1811/30/news060.html)
- 参考: [centos8でlocaleに ja_JP.UTF-8 がないときの対応](https://qiita.com/hibinohirokatsu/items/23097e7e75cfb6f62f42)