38320
CentOS7のminimalにX Window Systemをインストールし、GUI環境を構築しましたが、キーボードレイアウトが正しく認識されません。  
理想の動作としては、起動時に日本語配列でcaps lockがctrlに上書きされる動作ですが、英字配列でcaps lockがctrlに上書きされません。

作業内容としては、以下のコマンド実行して/etc/X11/xorg.conf.d/00-keyboard.confの編集を行いました。

```

    $ localectl set-x11-keymap jp106 ctrl:nocaps
    
```

関連情報として、setxkbmap printの実行結果とXのログの抜粋を記載します。

```

    $ setxkbmap -print -verbose 10
    locale is C
    Trying to load rules file ./rules/evdev...
    Trying to load rules file /usr/share/X11/xkb/rules/evdev...
    Success.
    Applied rules from evdev:
    rules:      evdev
    model:      pc105
    layout:     us,us
    variant:    ,
    options:    terminate:ctrl_alt_bksp
    Trying to build keymap using the following components:
    keycodes:   evdev+aliases(qwerty)
    types:      complete
    compat:     complete
    symbols:    pc+us+us:2+inet(evdev)+terminate(ctrl_alt_bksp)
    geometry:   pc(pc105)
    xkb_keymap {
        xkb_keycodes  { include "evdev+aliases(qwerty)" };
        xkb_types     { include "complete"  };
        xkb_compat    { include "complete"  };
        xkb_symbols   { include "pc+us+us:2+inet(evdev)+terminate(ctrl_alt_bksp)"   };
        xkb_geometry  { include "pc(pc105)" };
    };
    
```

ここからXのログの抜粋

```

    [    40.441] (II) config/udev: Adding input device Power Button (/dev/input/event1)
    [    40.441] (**) Power Button: Applying InputClass "evdev keyboard catchall"
    [    40.441] (**) Power Button: Applying InputClass "system-keyboard"
    [    40.441] (II) LoadModule: "evdev"
    [    40.441] (II) Loading /usr/lib64/xorg/modules/input/evdev_drv.so
    [    40.442] (II) Module evdev: vendor="X.Org Foundation"
    [    40.442]    compiled for 1.19.3, module version = 2.10.5
    [    40.442]    Module class: X.Org XInput Driver
    [    40.442]    ABI class: X.Org XInput driver, version 24.1
    [    40.442] (II) Using input driver 'evdev' for 'Power Button'
    [    40.442] (**) Power Button: always reports core events
    [    40.442] (**) evdev: Power Button: Device: "/dev/input/event1"
    [    40.442] (--) evdev: Power Button: Vendor 0 Product 0x1
    [    40.442] (--) evdev: Power Button: Found keys
    [    40.442] (II) evdev: Power Button: Configuring as keyboard
    [    40.442] (**) Option "config_info" "udev:/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input1/event1"
    [    40.442] (II) XINPUT: Adding extended input device "Power Button" (type: KEYBOARD, id 6)
    [    40.442] (**) Option "xkb_rules" "evdev"
    [    40.442] (**) Option "xkb_model" "ctrl:nocaps"
    [    40.442] (**) Option "xkb_layout" "jp106"
    [    40.452] (EE) Error loading keymap /var/lib/xkb/server-0.xkm
    [    40.452] (EE) XKB: Failed to load keymap. Loading default keymap instead.
    [    40.467] (II) config/udev: Adding input device Power Button (/dev/input/event0)
    [    40.468] (**) Power Button: Applying InputClass "evdev keyboard catchall"
    [    40.468] (**) Power Button: Applying InputClass "system-keyboard"
    [    40.468] (II) Using input driver 'evdev' for 'Power Button'
    [    40.468] (**) Power Button: always reports core events
    [    40.468] (**) evdev: Power Button: Device: "/dev/input/event0"
    [    40.468] (--) evdev: Power Button: Vendor 0 Product 0x1
    [    40.468] (--) evdev: Power Button: Found keys
    [    40.468] (II) evdev: Power Button: Configuring as keyboard
    [    40.468] (**) Option "config_info" "udev:/sys/devices/LNXSYSTM:00/device:00/PNP0C0C:00/input/input0/event0"
    [    40.468] (II) XINPUT: Adding extended input device "Power Button" (type: KEYBOARD, id 7)
    [    40.468] (**) Option "xkb_rules" "evdev"
    [    40.468] (**) Option "xkb_model" "ctrl:nocaps"
    [    40.468] (**) Option "xkb_layout" "jp106"
    [    40.468] (II) config/udev: Adding input device Topre Corporation Realforce 108U (/dev/input/event3)
    [    40.468] (**) Topre Corporation Realforce 108U: Applying InputClass "evdev keyboard catchall"
    [    40.468] (**) Topre Corporation Realforce 108U: Applying InputClass "system-keyboard"
    [    40.468] (II) Using input driver 'evdev' for 'Topre Corporation Realforce 108U'
    [    40.468] (**) Topre Corporation Realforce 108U: always reports core events
    [    40.468] (**) evdev: Topre Corporation Realforce 108U: Device: "/dev/input/event3"
    [    40.468] (--) evdev: Topre Corporation Realforce 108U: Vendor 0x853 Product 0x11d
    [    40.468] (--) evdev: Topre Corporation Realforce 108U: Found keys
    [    40.468] (II) evdev: Topre Corporation Realforce 108U: Configuring as keyboard
    [    40.468] (**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.6/1-1.6:1.0/input/input3/event3"
    [    40.468] (II) XINPUT: Adding extended input device "Topre Corporation Realforce 108U" (type: KEYBOARD, id 8)
    [    40.468] (**) Option "xkb_rules" "evdev"
    [    40.468] (**) Option "xkb_model" "ctrl:nocaps"
    [    40.468] (**) Option "xkb_layout" "jp106"
    [    40.469] (II) config/udev: Adding input device HDA Intel PCH Line Out CLFE (/dev/input/event10)
    [    40.469] (II) No input driver specified, ignoring this device.
    [    40.469] (II) This device may have been added with another device file.
    [    40.469] (II) config/udev: Adding input device HDA Intel PCH Line Out Side (/dev/input/event11)
    [    40.469] (II) No input driver specified, ignoring this device.
    [    40.469] (II) This device may have been added with another device file.
    [    40.469] (II) config/udev: Adding input device HDA Intel PCH Front Headphone (/dev/input/event12)
    
```
CC BY-SA 3.0
2017-09-30T04:32:25.843
38317
2017-09-30T07:57:49.000
19500
question
centos key-mapping
CentOS7のX11で起動時に正しいキーボードレイアウトが指定されない
`man localectl` によると、set-x11-keymap の引数は `LAYOUT [MODEL [VARIANT [OPTIONS]]]`
なので、

```

    # localectl set-x11-keymap jp jp106 "" ctrl:nocaps
    
```

のように、4つの引数を指定するのではないでしょうか。

```

    (/etc/X11/xorg.conf.d/00-keyboard.conf)
    Section "InputClass"
            Identifier "system-keyboard"
            MatchIsKeyboard "on"
            Option "XkbLayout" "jp"
            Option "XkbModel" "jp106"
            Option "XkbOptions" "ctrl:nocaps"
    EndSection
    
```

また、Gnome などのデスクトップ環境の設定で、上書きされる可能性もあります。  
その場合は新規作成ユーザーで試してみてください。
CC BY-SA 3.0
2017-09-30T07:57:49.000
38320
2017-09-30T07:57:49.000
4603
38317
answer