Unable to change GDM keyboard layout

I recently (re-)installed Manjaro, and ever since then GDM (the login screen) always uses the US keyboard layout instead of my preferred Colemak layout. I already selected the Colemak layout during the installation process, so it should have carried over to GDM, but didn’t.

I’ve discovered some things (and apparently broken some things, as well) while trying to fix this. I’ll try to list all the fixes/workarounds I tried, but I honestly can’t remember all of them.

Current Configuration

On a multi-user system, there is a “Login Screen” button in the “Region and Language” settings), so I created a 2nd user account to check the “Login Screen” settings, and the keyboard layout that shows up there is “English (Colemak)”.

And this is the current configuration for my user account:

  • localectl output:

    $> localectl
       System Locale: LANG=en_US.utf8
                      LC_COLLATE=C
           VC Keymap: colemak
          X11 Layout: us
         X11 Variant: colemak
    
  • In “Region and Language” settings → “Input Sources”, my keyboard layout is set to “English (Colemak)”.

Attempted Fixes

  • I tried adding a 2nd keyboard layout to my account, in the hope that GDM would display some sort of dropdown to let me switch between the two layouts, but this had no effect.

  • As per this post, I created the following .desktop file in /usr/local/share/gdm/greeter/autostart:

    [Desktop Entry]
    Type=Application
    Name=Set Login Keyboard
    Exec=/usr/bin/setxkbmap -display :0 us -variant colemak
    NoDisplay=true
    

    This also had no effect.

Discoveries / Stuff that’s broken

  • Once I log into my account, and then go back to the login screen (either by logging out or by hitting Ctrl+Alt+F1), the login screen “adopts” my current keyboard layout. changes its keyboard layout to Colemak. (Will do more testing with other accounts and keyboard layouts when I have time.)
  • GNOME doesn’t remember any changes made in “Region and Language” → “Login Screen” → “Input Sources”. If I make some changes, then toggle “Login Screen” off and back on, all changes I’ve made are reset. If I close the dialog after making changes, it will remember the changes until I reboot, then reset them again.
  • Recently, localectl started behaving oddly. Running localectl set-x11-keymap displays an error message, but also applies the changes… for a while:
    $> localectl
       System Locale: LANG=en_US.utf8
    	              LC_COLLATE=C
    	   VC Keymap: colemak
    	  X11 Layout: us
    	 X11 Variant: colemak
    $> localectl set-x11-keymap de 
    Failed to set keymap: Access denied
    $> localectl 
       System Locale: LANG=en_US.utf8
    	              LC_COLLATE=C
    	   VC Keymap: colemak
    	  X11 Layout: de
    
    And a while later, the changes are magically reset:
    $> localectl
       System Locale: LANG=en_US.utf8
    	              LC_COLLATE=C
    	   VC Keymap: colemak
    	  X11 Layout: us
    	 X11 Variant: colemak
    

So at this point I’m really out of ideas. In all the time I’ve spent on this, all I’ve achieved is to make some errors pop up. Would appreciate any input.

Use setxkbmap instead

https://wiki.archlinux.org/index.php/Xorg/Keyboard_configuration#Setting_keyboard_layout

$ setxkbmap de

Or X configuration files

/etc/X11/xorg.conf.d/00-keyboard.conf

Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "de"
EndSection

I looked at the contents of /etc/X11/xorg.conf.d/00-keyboard.conf and it already had the correct settings:

# 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" "us"
        Option "XkbVariant" "colemak"
EndSection

I also tried running setxkbmap us -variant colemak, but that had no effect. Am I supposed to run that as the gdm user? If so, I don’t know how to do that. I get this error message:

$> sudo -u gdm setxkbmap us -variant colemak
[sudo] password for aran-fey: 
Authorization required, but no authorization protocol specified
Cannot open display ":0"

If your system is multi user, have a look here

https://wiki.archlinux.org/index.php/GDM#Keyboard_layout

It’s not supposed to be a multi-user system. I only added a 2nd account so that GNOME would display that “Login Screen” button. And like I already said in my original post, the login screen settings

  1. are already correctly set to “English (Colemak)”.
  2. won’t remember any changes I make.

Ok so stay like that, your issue will be solved with magic, for sure :sparkler:

Huh? What’s your problem? I tried everything you told me to and more. What else do you expect from me? If anything, I should be mad at you for suggesting fixes I’ve already tried.

Hi and welcome to the forum :wave:

This might be something you have checked already? The correct setting for X11 and wayland seems to differ but the post does not clarify where to set them for wayland.

Thanks, I hadn’t seen that thread before. But to be honest, I’m having a hard time extracting any useful information from it. (The OP there seems to have a problem with their account’s keyboard layout, not the login manager’s.) If there’s something specific you want me to try, or some information you need from me, you may have to dumb it down for me :sweat_smile:

Here’s some info you may be interested in:

  • Output of setxkbmap -print -verbose 10:
     Setting verbose level to 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
     Trying to build keymap using the following components:
     keycodes:   evdev+aliases(qwerty)
     types:      complete
     compat:     complete
     symbols:    pc+us+inet(evdev)
     geometry:   pc(pc105)
     xkb_keymap {
         xkb_keycodes  { include "evdev+aliases(qwerty)"	};
         xkb_types     { include "complete"	};
         xkb_compat    { include "complete"	};
         xkb_symbols   { include "pc+us+inet(evdev)"	};
         xkb_geometry  { include "pc(pc105)"	};
     };
    
  • Doing echo $XDG_SESSION_TYPE reveals that I’m using Wayland, but as far as I know, X/Wayland is only started after you login, right? So it should have no bearing on what is happening on the login screen.
  • As for X configuration files:
    • As already mentioned, /etc/X11/xorg.conf.d/00-keyboard.conf contains the correct keyboard layout.
    • /etc/X11/xorg.conf.d/ does not contain any other files.
    • /etc/X11/xorg.conf does not exist.
    • /etc/xorg.conf also does not exist.

I tried to see if gnome-control-center produces any output indicating why it won’t save the keyboard layout settings, but there doesn’t seem to be anything useful in there:

$> gnome-control-center -v
18:42:23.0079      diagnostics-cc-panel:    DEBUG: ABRT vanished
18:42:23.0095           accountsservice:    DEBUG: Finding a graphical session for user 1000
18:42:23.0095           accountsservice:    DEBUG: Considering session '3'
18:42:23.0095           accountsservice:    DEBUG: ActUserManager: Seat still actively loading, so not setting loaded property
18:42:23.0124           accountsservice:    DEBUG: ActUserManager: Seat still actively loading, so not setting loaded property
18:42:23.0124           accountsservice:    DEBUG: ActUserManager: Seat loaded, so now setting loaded property
18:42:23.0124           accountsservice:    DEBUG: ActUserManager: user manager now loaded, proceeding with fetch user request for user with id 1000
18:42:23.0124           accountsservice:    DEBUG: ActUserManager: finding user with id 1000 state 2
18:42:23.0124           accountsservice:    DEBUG: ActUserManager: Looking for user with id 1000 in accounts service
18:42:23.0126           accountsservice:    DEBUG: ActUserManager: Found object path of user with id 1000: /org/freedesktop/Accounts/User1000
18:42:23.0126           accountsservice:    DEBUG: ActUserManager: finding user with id 1000 state 3
18:42:23.0126           accountsservice:    DEBUG: ActUserManager: user with id 1000 fetched
18:42:23.0129           accountsservice:    DEBUG: ActUserManager: user aran-fey is now loaded
18:42:23.0129           accountsservice:    DEBUG: ActUserManager: user aran-fey was not yet known, adding it
18:42:23.0129           accountsservice:    DEBUG: ActUserManager: tracking user 'aran-fey'
18:42:23.0129           accountsservice:    DEBUG: ActUserManager: not yet loaded, so not emitting user-added signal
18:42:23.0129           accountsservice:    DEBUG: ActUserManager: no pending users, trying to set loaded property
18:42:23.0129           accountsservice:    DEBUG: ActUserManager: already loaded, so not setting loaded property
18:42:23.0129           accountsservice:    DEBUG: ActUserManager: finished handling request for user with id 1000
18:42:23.0129           accountsservice:    DEBUG: ActUserManager: unrefing manager owned by fetch user request
(gnome-control-center:5365): dconf-DEBUG: 18:42:37.215: unwatch_fast: "/system/locale/" (active: 1, establishing: 0)
(gnome-control-center:5365): dconf-DEBUG: 18:42:37.216: unwatch_fast: "/org/gnome/desktop/input-sources/" (active: 1, establishing: 0)
(gnome-control-center:5365): dconf-DEBUG: 18:42:37.220: unwatch_fast: "/org/gnome/control-center/" (active: 1, establishing: 0)
(gnome-control-center:5365): dconf-DEBUG: 18:42:37.221: sync
18:42:37.0221         cc-object-storage:    DEBUG: Destroying cached objects

I’ve made a new discovery though: Sometimes gnome-control-center doesn’t list the “English (Colemak)” layout for the login screen. I can’t seem to reproduce it anymore, but two times when I clicked that “Login Screen” button the list of input sources was completely empty.

I’m just reading your post, checking man pages, arch wiki, forums etc. and try to point to possible options that you have not ventured in directly. This thread and your recent reinstall made me think there might be a locale issue, there was an issue with a change in locale on gnome a few releases back. Maybe this tip will help you find the source of the issue.

Locales seem to be configured correctly, as far as I can tell.

$> locale -a
C
POSIX
de_DE.utf8
en_US.utf8
$> cat /etc/locale.conf
LANG=en_US.utf8

As an experiment, I changed the LANG in /etc/locale.conf to de_DE.utf8, but GDM still used the US keyboard layout.

:frowning: then this will not help you, and I have no more potential solutions.
(Have you run sudo locale-gen after changing etc/locale.conf ?)

I hope there is a solution for this, it seems a straightforward problem that should be ‘simple’ to solve.

Oops! Nice catch, I didn’t run locale-gen. Unfortunately, even after running it, there’s no change to GDM’s keyboard layout.

A bit of good news: I figured out what was causing the error with localectl. For some reason the /etc/locale.conf file wasn’t owned by root. I’ve fixed the ownership, and now both localectl and gnome-control-center can successfully change the system keyboard layout. (But of course GDM still doesn’t respect the setting.)

So far i’ve done a bit of searching but I only find the same issue you have and no solutions: 1, 2

Link 2 seems to point to a situation that I might misunderstand and I don’t have non-qwerty keyboard to test this. This might help you in testing out options. It is for a earlier version of GDM.

For reference the list I went through: Issues · GNOME / gdm · GitLab

Best of luck to you and I hope you find a solution.