Solved How to change the gdm greeter keyboard layout ?

Hi !

I've been searching for hours but I can't find a solution to something which seems easy...

My gnome system settings are changed to my local ones, the keyboard layout is OK when logged in but not before.

On the logging screen I can only use the US keyboard layout. How can I change this ?

I found something on Google, which consists of modifying the /usr/local/etc/gdm/Init/Default and adding "setxkbmap be" just before the exit call, but it doesn't work neither.

Thanks for you help (because my passwords have specials chars ;-)).

You can specify a keymap in /etc/rc.conf by something as
or so. I do now know if this has an effect on x11/gdm, but it should be worth to try.
Hi chrbr !

Thanks for you reply.

This configuration has been done at the first installation of FreeBSD, even before the installation of Xorg and Gnome. I've got the right keyboard layout everywhere (including all ttys) except on the Gnome login screen.

One thing I also tried yesterday is modifying /usr/local/etc/gdm/locale.conf but this has no effect at all...
Ok so it seems to be an Xorg problem.

I've read the section you mentioned (which is not present in the French translated handbook).

I've added this to my /etc/X11/xorg.conf :
Section    "InputClass"
    Identifier    "KeyboardDefaults"
    Driver        "keyboard"
    MatchIsKeyboard    "on"
    Option        "XkbLayout" "be"
but when I do this I have no more keyboard at all.

The driver used by my Xorg configuration is "kbd" not "keyboard". Can this cause my problem ?
Section "InputDevice"
   Identifier   "Keyboard0"
   Driver       "kbd"

I then modified Xorg configuration file like this :
Section "InputClass"
   Identifier    "Keyboards"
   Driver        "kbd"
   MatchIsKeyboard   "True"
   Option    "XkbLayout" "be"

The keyboard works but still in US layout...
The Xorg log file indicates that the KB layout be is loaded.

[    88.584] (**) kbdmux: Applying InputClass "Keyboard-be"
[    88.584] (II) LoadModule: "kbd"
[    88.618] (II) Loading /usr/local/lib/xorg/modules/input/
[    88.621] (II) Module kbd: vendor="X.Org Foundation"
[    88.621]     compiled for 1.18.4, module version = 1.9.0
[    88.621]     Module class: X.Org XInput Driver
[    88.621]     ABI class: X.Org XInput driver, version 22.1
[    88.621] (II) Using input driver 'kbd' for 'kbdmux'
[    88.621] (**) kbdmux: always reports core events
[    88.621] (**) kbdmux: always reports core events
[    88.621] (**) Option "Protocol" "standard"
[    88.621] (**) Option "XkbRules" "base"
[    88.621] (**) Option "XkbModel" "pc105"
[    88.621] (**) Option "XkbLayout" "be"
[    88.621] (**) Option "config_info" "devd:kbdmux"
[    88.621] (II) XINPUT: Adding extended input device "kbdmux" (type: KEYBOARD, id 6)
[    88.654] (II) config/devd: kbdmux is enabled, ignoring device atkbd0

But the keyboard is still in US layout when logging in... o_O
I would try
set | grep "GDM_LANG"
. If it's not the appropriate "be" configuration, you'll probably have to set the $LANG
set didn't return any result for that variable, but with setenv | grep GDM_LANG I've got fr_FR.UTF-8.

That's not the right value but it's not "US" either...

I've set the value of LANG to fr_BE.UTF-8 in /usr/local/etc/gdm/locale.conf, this has an effect on my Gnome sessions (right language, right kb layout) but not on logging screen.
Ok while waiting an answer I tried some things.

1. On the problematic laptop I reinstalled FreeBSD from scratch. The shell keyboard layout is OK. I then installed Xorg and configured it. When I started X with startx, the keyboard layout was also OK i a XTerm. I then installed Gnome3 but still the same problem : US keyboard layout when typing my password in the logging screen.

2. I did the same operations on an other laptop, the result is exactly the same issue.

Does anyone else encouter this issue even with other layouts ?

Still no answer to this issue but I'm going ahead on my side.

I've tried other display managers such as x11/xdm and x11/kde4, both of them are working fine. Nothing special to do to get the right keyboard layout (except X basic configuration of course).

If no solution can be found I think I will continue on x11/kde4, that's too bad for Gnome...
Salut Sebel,

I'm having the exact same problem with you. I installed a FreeBSD in a VBox guest, everything is ok until I start X.

Well I didn't set it through Gnome because I want to find the solution and set it with instead so it'll apply everywhere.

So the same as you but with my french keyboard :(

olivierd: That directory is empty in my virtual machine.
Ok I'm coming back because I may have found something interesting.

I set my xorg.conf like this :

Section "InputClass"
Identifier "Clavier FR"
Option "XkbLayout" "fr"

When I try to run Gnome3, my keyboard is still in en_US even the Xorg.log tells me my keyboard is pc105, fr_FR, etc...

So I decided to give a try with a simpler graphical interface using i3 instead of Gnome3 and my keyboard is in french in i3 thanks to my xorg.conf. So the problem is that Gnome3 is doing too much things on the locale of the keyboard but I don't really know how to avoid that or to force Gnome3 to use the configuration file...
Hi again and sorry for the delay as I haven't been notified of your answers till now !

I'm now using x11/xdm to log into my Gnome Desktop and this works great. No idea how to make x11/gdm working with my belgian keyboard.

Thanks for all your replies !

Usually, I am hesitant to resurrect old threads, and even more when these had been marked solved.

However, this one was not solved for x11/gdm, but without it, which is not quite the same, is it?

I was in need to solve this exactly for GDM, because I started shipping systems with it. It began with a subtle annoyance, namely, I could not login a user who got a letter Z in the password, while logging-in others went fine. No problem, let’s change the keyboard layout from QUERTY to German QWERTZ. This must not be too difficult, must it?

Hours of trial and error, and reading so many bullshit articles and suggestions in the internet on how to achieve this, lead to the following:
  • GDM does not honour org.gnome.desktop.input-sources in it’s home/.config
  • GDM does ignore all the scripts in home/Init, home/PreSession, home/PostSession, home/Xsession, although the GDM doc´s tell otherwise
  • GDM does ignore layout="de" in home/locale.conf, which was the elegant solution of GNOME 2.
Now, what worked is to put the following .desktop file into /usr/local/share/gdm/greeter/autostart:
[Desktop Entry]
Name=Set Login Keyboard
Exec=/usr/local/bin/setxkbmap -display :0 'de'

Someone on the internet suggested to abandon GNOME 3 in favour of another desktop „whose developers clearly do not hate their users“. I reached a point where I consider this to be right.
Last edited:
That's awesome ! I'll give it a try later and, if it works for my AZERTY keyboard, I'll be able to continue and finish my french tutorial on how to install and use FreeBSD for a desktop. It's been sleeping for a year and a half now.

Thank you very much for your perseverance, obsigna ! 👍