Keyboard layout different in tty than in gnome

In all applications, i can properly type the charachters identified on my (French) keyboard like é, à, ù, etc.

In a TTY though, typing the é key will print {, typing à will print @, etc.

Here’s some possibly relevant information, but things look ok to me there:

❯ locale
LANG=en_SG.UTF-8
LC_CTYPE="en_SG.UTF-8"
LC_NUMERIC=en_SG.UTF-8
LC_TIME=en_SG.UTF-8
LC_COLLATE="en_SG.UTF-8"
LC_MONETARY=en_SG.UTF-8
LC_MESSAGES="en_SG.UTF-8"
LC_PAPER=en_SG.UTF-8
LC_NAME=en_SG.UTF-8
LC_ADDRESS=en_SG.UTF-8
LC_TELEPHONE=en_SG.UTF-8
LC_MEASUREMENT=en_SG.UTF-8
LC_IDENTIFICATION=en_SG.UTF-8
LC_ALL=
❯ localectl
   System Locale: LANG=en_SG.UTF-8
       VC Keymap: fr
      X11 Layout: fr
       X11 Model: pc105
     X11 Variant: oss_nodeadkeys
❯ cat /etc/X11/xorg.conf.d/00-keyboard.conf
# Written by systemd-localed(8), read by systemd-localed and Xorg. It's
# probably wise not to edit this file manually. Use localectl(1) to
# instruct systemd-localed to update it.
Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "fr"
        Option "XkbModel" "pc105"
        Option "XkbVariant" "oss_nodeadkeys"
EndSection
❯ cat /etc/vconsole.conf
KEYMAP=fr
FONT=
FONT_MAP=

(same output in a TTY or gnome terminal)

Make a file /etc/vconsole.conf as root with these contents and reboot. Also see arch wiki.

KEYMAP=fr

Thanks! I already have this value in /etc/vconsole.conf however. (It’s at the bottom of the terminal output i posted.)

Sorry! Didn’t see that before.

Can try using localectl to set the tty keymap and reboot:

sudo localectl set-keymap --no-convert fr

Also what is the output of grep '^HOOKS' /etc/mkinitcpio.conf? The line should contain the keymap mkinitcpio hook for /etc/vconsole.conf to be loaded during boot.

Here’s the output:

❯ grep '^HOOKS' /etc/mkinitcpio.conf
HOOKS="base udev autodetect modconf block keyboard keymap consolefont plymouth resume filesystems"

rebooting now after the command you suggested

Same behaviour after sudo localectl set-keymap --no-convert fr and a reboot

TTY reads from /etc/vconsole.conf

excerpt from localectl list-keymaps

fr
fr-bepo
fr-bepo-latin9
fr-latin1
fr-latin9
fr-pc
fr_CH
fr_CH-latin1

X reads from /etc/X11/xorg.conf.d/00-keyboard.conf

You issue could be related to the variant used in X

Option "XkbVariant" "oss_nodeadkeys"

To get identical behaviour you will have use the same variant in both locations.

On a side note - you can test the console keymap in a root TTY - to locate which keymap has the match you are looking for e.g.

loadkeys fr-pc

localectl should be able to change the locale on the fly. I have however experienced some inconsistency until the system has been restarted.

1 Like

This did the trick thanks! I edited /etc/vconsole.conf as root to replace fr with fr-pc and voilà.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.