sddm icon indicating copy to clipboard operation
sddm copied to clipboard

Keyboard layout not detected.

Open bootkiller opened this issue 11 years ago • 43 comments

SDDM isn't picking up the keyboard layout.

Output of /etc/vconsole.conf:

KEYMAP=pt-latin9
FONT=Lat2Terminus16

Output of Systemd's localectl

System Locale: LANG=en_GB.UTF-8
   VC Keymap: pt-latin9
   X11 Layout: pt
   X11 Model: dell101
   X11 Variant: latin9

bootkiller avatar Jun 24 '14 17:06 bootkiller

Off the top of my head, sddm uses xcb API to list the keymaps. We should use some systemd API when building for systems powered by systemd.

plfiorini avatar Jun 24 '14 18:06 plfiorini

When you set x11 layout with localectl, it creates the the file /etc/X11/xorg.conf.d/00-keyboard.conf:

# Read and parsed by systemd-localed. It's probably wise not to edit this file
# manually too freely.
Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "pt"
        Option "XkbModel" "dell101"
        Option "XkbVariant" "latin9"

I'm just an user not a dev, so I'm not sure where from xcb is getting the keymap from.

bootkiller avatar Jun 24 '14 18:06 bootkiller

I have the same problem, but on my machine the layout list is filled after I enter one character in the password field

dbluelle avatar Aug 16 '14 13:08 dbluelle

Having the same problem with the Arch package of sddm. The keyboard layout dropdown shows "English (US)" only, whereas I would need a German layout.

$ pacman -Q sddm
sddm-0.10.0-3

$ cat /etc/locale.conf
LANG=de_DE.UTF-8
LC_MESSAGES=C

$ cat /etc/vconsole.conf
KEYMAP=de-latin1-nodeadkeys
FONT=latarcyrheb-sun16

$ localectl
   System Locale: LANG=de_DE.UTF_8
                  LC_MESSAGES=C
       VC Keymap: de-latin1-nodeadkeys
      X11 Layout: n/a

I remember having had the same problem with KDM before, but it wasn't much of a big deal because I had autologin + auto-session-locking configured (which SDDM cannot do currently, see #306).

majewsky avatar Nov 16 '14 21:11 majewsky

@majewsky You should try setting the x11 keymap through localectl. I just did that, and even though SDDM still indicates English (US) layout, when I type my password it is actually using the correct layout (dk).

tachylatus avatar Dec 04 '14 22:12 tachylatus

I used localectl like this:

$ localectl set-x11-keymap layout us colemak

and now localectl shows me this:

$ localectl
  System Locale: LANG=fi_FI.UTF-8
      VC Keymap: n/a
     X11 Layout: layout
      X11 Model: us
    X11 Variant: colemak

At least it seems to detect it's us-layout now but not that it's colemak variant.

wlinna avatar Dec 16 '14 06:12 wlinna

I did a fresh install of Arch Linux today, encountered the same issue, fixed though (probably not the proper way, however if anyone is interested see below.)

[root@existence:kmikazuki]# pacman -Q sddm
sddm 0.11.0-1
[root@existence:kmikazuki]# cat /etc/locale.conf
LANG=en_US.UTF-8
[root@existence:kmikazuki]# cat /etc/vconsole.conf
KEYMAP=colemak
[root@existence:kmikazuki]# localectl
   System Locale: LANG=en_US.UTF-8
       VC Keymap: colemak
      X11 Layout: colemak
       X11 Model: colemak
     X11 Variant: colemak
[root@existence:kmikazuki]# cat /etc/X11/xorg.conf.d/
00-keyboard.conf  10-evdev.conf     
[root@existence:kmikazuki]# cat /etc/X11/xorg.conf.d/00-keyboard.conf 
# Read and parsed by systemd-localed. It's probably wise not to edit this file
# manually too freely.
Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "colemak"
        Option "XkbModel" "colemak"
        Option "XkbVariant" "colemak"
EndSection
[root@existence:kmikazuki]# cat /etc/X11/xorg.conf.d/10-evdev.conf 
Section "InputClass"
        Identifier "evdev keyboard catchcall"
        MatchIsKeyboard "on"
        MatchDevicePath "/dev/input/event*"
        Driver "evdev"
        # Set keyboard to colmak. 
        Option "XkbLayout" "us"
        Option "XkbVariant" "colemak"
EndSection

Again I went against the advice of the file note to not edit them, however end results achieves what I wanted, and I have yet to encounter any issues. Note after making changes, you will need to reboot your computer. There is probably a proper way to do this however I do not know how.

Peace.

ghost avatar Dec 31 '14 19:12 ghost

I have the same behavior with 2 new installation of Fedora 21, KDE spin. I did installation on 2 different PCs. Both installation were done in french.

  • On 1st PC the SDDM login window shows a US flag for the language, but as soon as I enter the password, the flag turns to French. Strange behavior but it works as mention by tachylatus.
  • The behavior is different on the second PC: at sddm login window, it is and remains US keyboard. The password is the same between PCs (same user too).

On both PCs

LANG="fr_FR.UTF-8"
KEYMAP="fr-oss"
option "XkbLayout" "fr"
option "XkbVariant" "oss"

Boring bug if we want to use a safe password, with non std char.

fgatbdx avatar Jan 09 '15 18:01 fgatbdx

Same thing on Arch Linux. Used localectl to configure the keymap for both the VC and X11. On the login screen, the language flag is set to US until I type the first character of the password and it switches to the right language by itself. Before typing the first character, while it still shows the US flag, the right language doesn't appear in the drop down menu, only US is present.

rjurga avatar Feb 25 '15 16:02 rjurga

Exact same behaviour as what @polomi described above, on Mageia 5. FYI, here is the corresponding Mageia bug report: https://bugs.mageia.org/show_bug.cgi?id=15357

akien-mga avatar Feb 26 '15 20:02 akien-mga

Edit

/usr/share/sddm/scripts/Xsetup

and append

setxkbmap XX

where XX is the preferred layout.

miguelpenc avatar Mar 10 '15 15:03 miguelpenc

@miguelpenc Thank you! That did the trick.

evilmav avatar Mar 10 '15 23:03 evilmav

This is Xcb bug (even with latest libxcb from git master branch), because in XcbKeyboardBackend::initLayouts

        cookie = xcb_xkb_get_names(m_conn,
                XCB_XKB_ID_USE_CORE_KBD,
                XCB_XKB_NAME_DETAIL_GROUP_NAMES | XCB_XKB_NAME_DETAIL_SYMBOLS);
        reply = xcb_xkb_get_names_reply(m_conn, cookie, nullptr);

it always returns "us" layout on startup, but as soon as any key is pressed then XCB_XKB_NEW_KEYBOARD_NOTIFY event will be issued and then it will return correct layout.

Probably need to report it upstream to them as only workaround could be to somehow fake a key press...

davispuh avatar Aug 22 '15 02:08 davispuh

A bonus would be, that the user somewhere can choose the layout at startup. Usecase: Consider a multiuser system, where some user prefer normal qwerty and another something like dvorak. Then the user(s), whose keyboard layout is not the default in sddm, has to learn to type his password in two layouts.

Tratoschek avatar Sep 05 '15 14:09 Tratoschek

@Tratoschek That's a separate issue and you should open a separate issue for that to ensure that it's not missed.

majewsky avatar Sep 05 '15 14:09 majewsky

done: https://github.com/sddm/sddm/issues/482

Tratoschek avatar Sep 05 '15 15:09 Tratoschek

I had the same issue and fixed it with localectl set-x11-keymap si asus_laptop. The keymap is now correct, but the dropdown still shows a US flag.

alko89 avatar Nov 18 '15 11:11 alko89

Hi there, any clue about this issue? It's mostly cosmetic but quite confusing for many users of non en_US locale to be greeted at every boot by an icon saying they are configured for en_US keyboard, while starting typing will switch to the actual configured locale.

akien-mga avatar Jan 13 '16 10:01 akien-mga

If it is just about cosmetics, then the easiest thing to do is either using a theme that doesn't show the language button, or modify one of your preference to the same purpose.

miguelpenc avatar Jan 13 '16 10:01 miguelpenc

Dropping a feature completely for the sake of cosmetics doesn't feel right... And I'm looking here for a change that will be applied at the distro packaging level, if all distros start hacking the upstream theme to remove the keyboard choosing feature, it doesn't feel right either... :)

akien-mga avatar Jan 13 '16 10:01 akien-mga

@davispuh By any chance, did you already report it upstream to libxcb?

doktor5000 avatar Jan 13 '16 19:01 doktor5000

No, I haven't had time to investigate this more.

davispuh avatar Jan 13 '16 19:01 davispuh

Taken the freedom to report it, let's see what comes out ... https://bugs.freedesktop.org/show_bug.cgi?id=93701

doktor5000 avatar Jan 13 '16 20:01 doktor5000

@plfiorini Can you provide some help on how to run a binary and redirect it's output to some logfile ( code attached to https://bugs.freedesktop.org/show_bug.cgi?id=93701#c1 ) when sddm starts but before the first keyboard keypress? Would /usr/share/sddm/scripts/Xsetup work for that?

doktor5000 avatar Feb 05 '16 12:02 doktor5000

@doktor5000 To my knowledge /usr/share/sddm/scripts/Xsetup works like that. to redirect output of a binary file use: ~% ./name_of_the_program &> /path/to/logfile/logfiele.log

miguelpenc avatar Feb 05 '16 14:02 miguelpenc

@miguelpenc Well aware how to do shell redirection, I was just asking if this needs to be done from sddm-greeter, maybe my question wasn't phrased that well :)

Anyways, as sddm waits for /usr/share/sddm/scripts/Xsetup to exit before starting, didn't achieve exactly what I wanted, but it works. When Xsetup runs so before any key has been pressed, it returns English (US) and after a keypress or in the normal session it returns German (eliminate dead keys) as expected.

doktor5000 avatar Feb 07 '16 10:02 doktor5000

Reproducible for me. Fedora 24 x86_64 with german locale.

rapgro avatar Nov 08 '16 20:11 rapgro

I have the same problem I think.

Upon boot, SDDM is in QWERTY without a way to change that. It does not change to the correct layout (Colemak) when I start typing; I actually have to type my password in QWERTY to login.

localectl
   System Locale: LANG=nl_NL.UTF-8
       VC Keymap: colemak
      X11 Layout: colemak

I also have setxkbmap colemak in /usr/share/sddm/scripts/Xsetup but that does not seem to have any effect.

Compizfox avatar Mar 30 '17 09:03 Compizfox

I can confirm that this is still an issue with SDDM 0.17

$ localectl status
   System Locale: LANG=en_US.UTF-8
       VC Keymap: de
      X11 Layout: de
       X11 Model: pc104
     X11 Options: terminate:ctrl_alt_bksp

SDDM still uses US layout and does not change to DE when I type something

va1entin avatar Apr 05 '18 16:04 va1entin

So it seems that only very specific entries trigger the "switch on first keypress" behavior. I've had a linux box configured as follows:

localectl status
   System Locale: LANG=en_US.UTF-8
       VC Keymap: de-latin1
      X11 Layout: de-latin1

and the keyboard in SDDM did NOT switch to de-latin1 when I typed in my password. Trying to debug the issue, I've set the keymap to de-latin1-nodeadkeys like this:

localectl set-keymap de-latin1-nodeadkeys

Note how I'm setting the vconsole keymap and not the X11 keymap! Now, the output is

localectl status
   System Locale: LANG=en_US.UTF-8
       VC Keymap: de-latin1-nodeadkeys
      X11 Layout: de
       X11 Model: pc105
     X11 Variant: nodeadkeys
     X11 Options: terminate:ctrl_alt_bksp

Note how the VC Keymap and X11 Layout differ, because localectl is automatically picking the closest match for X11? After a reboot SDDM now does switch to the correct keymap once I start typing my password.

So I'm thinking the problem might be a name mismatch between keymaps for X11 and VConsole at least for some of us...

Soukyuu avatar Jan 10 '19 16:01 Soukyuu