Couldn't find any console keymaps.となったときの対応方法


- 環境 : Dockerで作ったコンテナのCentOS Linux release 7.8.2003 (Core)

# 事象 : キーマップを日本語にしたくて探したらなんかいわれた
```bash
# キーマップは英語じゃなくて、
$ localectl status
   System Locale: LANG=ja_JP.UTF-8
       VC Keymap: us
      X11 Layout: us

# 日本語にしたいと思って検索したらなんか言われた
$ localectl list-keymaps | grep jp
Couldn't find any console keymaps.
```

# 原因 : キーマップがインストールされていないから
メッセージ通り。

- 参考
    - [Dockerで立てたCentOS7コンテナの日本語環境とかtimezone設定とか](https://7me.oji.0j0.jp/2016/centos7-locale-timezone.html)
    - [2.2. キーボードレイアウトの変更 Red Hat Enterprise Linux 7 | Red Hat Customer Portal](https://access.redhat.com/documentation/ja-jp/red_hat_enterprise_linux/7/html/system_administrators_guide/s1-changing_the_keyboard_layout)
    - [【 localectl 】コマンド――ロケール設定の確認と変更：Linux基本コマンドTips（262） - ＠IT](view-source:https://www.atmarkit.co.jp/ait/articles/1811/30/news060.html)

## 対応 : kbdパッケージをインストールする

```bash
# 1. yumを更新する
$ sudo yum update
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
...省略...
Complete!

# 2. kbdパッケージをインストールする
$ sudo yum install -y kbd
[sudo] password for ponsuke: 
Sorry, try again.
[sudo] password for ponsuke: 
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
 * base: d36uatko69830t.cloudfront.net
 * epel: iad.mirror.rackspace.com
 * extras: d36uatko69830t.cloudfront.net
 * updates: d36uatko69830t.cloudfront.net
Resolving Dependencies
--> Running transaction check
---> Package kbd.x86_64 0:1.15.5-15.el7 will be installed
--> Processing Dependency: kbd-misc = 1.15.5-15.el7 for package: kbd-1.15.5-15.el7.x86_64
--> Processing Dependency: kbd-legacy = 1.15.5-15.el7 for package: kbd-1.15.5-15.el7.x86_64
--> Running transaction check
---> Package kbd-legacy.noarch 0:1.15.5-15.el7 will be installed
---> Package kbd-misc.noarch 0:1.15.5-15.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================
 Package                          Arch                         Version                              Repository                  Size
=====================================================================================================================================
Installing:
 kbd                              x86_64                       1.15.5-15.el7                        base                       348 k
Installing for dependencies:
 kbd-legacy                       noarch                       1.15.5-15.el7                        base                       466 k
 kbd-misc                         noarch                       1.15.5-15.el7                        base                       1.4 M

Transaction Summary
=====================================================================================================================================
Install  1 Package (+2 Dependent packages)

Total download size: 2.2 M
Installed size: 4.1 M
Downloading packages:
(1/3): kbd-1.15.5-15.el7.x86_64.rpm                                                                           | 348 kB  00:00:00     
(2/3): kbd-misc-1.15.5-15.el7.noarch.rpm                                                                      | 1.4 MB  00:00:00     
(3/3): kbd-legacy-1.15.5-15.el7.noarch.rpm                                                                    | 466 kB  00:00:00     
-------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                2.8 MB/s | 2.2 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : kbd-misc-1.15.5-15.el7.noarch                                                                                     1/3 
  Installing : kbd-legacy-1.15.5-15.el7.noarch                                                                                   2/3 
  Installing : kbd-1.15.5-15.el7.x86_64                                                                                          3/3 
  Verifying  : kbd-legacy-1.15.5-15.el7.noarch                                                                                   1/3 
  Verifying  : kbd-1.15.5-15.el7.x86_64                                                                                          2/3 
  Verifying  : kbd-misc-1.15.5-15.el7.noarch                                                                                     3/3 

Installed:
  kbd.x86_64 0:1.15.5-15.el7                                                                                                         

Dependency Installed:
  kbd-legacy.noarch 0:1.15.5-15.el7                                  kbd-misc.noarch 0:1.15.5-15.el7                                 

Complete!

# キーマップがはいった！
$ localectl list-keymaps | grep jp
jp
jp-OADG109A
jp-dvorak
jp-kana86
jp106
```


# 他の原因
今回は違うけどいつかのために・・・

- [MITSUYA'S BLOG: 簡易インストール直後のコマンドによるローカライゼーション&#65288;Xubuntu on VMware Workstation Pro&#65289;](https://mitsuyamaeda.blogspot.com/2018/04/xubuntu-on-vmware-workstation-pro.html)
- [linux - localectl list-keymaps: &quot;Couldn&#39;t find any console keymaps&quot;? - Stack Overflow](https://stackoverflow.com/questions/34791369/localectl-list-keymaps-couldnt-find-any-console-keymaps/34882663)