Keyboard layout error: Couldn't interpret _XKB_RULES_NAMES property

Hi All,

I am in the process of setting up a FreeBSD desktop. I have set the British keyboard layout on installation which works fine on the console.

However in X it defaults to US layout so I set it to the GB layout using "setxkblayout gb".

This does change the layout to GB but I lose all of my control keys ( up/down/left/right arrows, tab, pgup/pgdown/home/end/insert/delete/, etc... ).

It also throws the "Couldn't interpret _XKB_RULES_NAMES property" when I make the change. A restart of the Xserver and it is back to US layout with all keys working.

Interestingly if I print the output upon a clean X run with US layout, I get the same error:

Code:
$ setxkbmap -print -verbose
Couldn't interpret _XKB_RULES_NAMES property
Use defaults: rules - 'base' model - 'pc105' layout - 'us'
Trying to build keymap using the following components:
keycodes:   xfree86+aliases(qwerty)
types:      complete
compat:     complete
symbols:    pc+us+inet(pc105)
geometry:   pc(pc105)
xkb_keymap {
    xkb_keycodes  { include "xfree86+aliases(qwerty)"    };
    xkb_types     { include "complete"    };
    xkb_compat    { include "complete"    };
    xkb_symbols   { include "pc+us+inet(pc105)"    };
    xkb_geometry  { include "pc(pc105)"    };
};

When I try to set the layout to GB, I get the following error:

Code:
~$ setxkbmap gb
Couldn't interpret _XKB_RULES_NAMES property
Use defaults: rules - 'base' model - 'pc105' layout - 'us'

~$  setxkbmap -print -verbose
Trying to build keymap using the following components:
keycodes:   xfree86+aliases(qwerty)
types:      complete
compat:     complete
symbols:    pc+gb+inet(pc105)
geometry:   pc(pc105)
xkb_keymap {
    xkb_keycodes  { include "xfree86+aliases(qwerty)"    };
    xkb_types     { include "complete"    };
    xkb_compat    { include "complete"    };
    xkb_symbols   { include "pc+gb+inet(pc105)"    };
    xkb_geometry  { include "pc(pc105)"    };
};

Anyone know what I need to do to set the keyboard layout properly? As this is my first attempt at a FreeBSD desktop it may be a simple thing I am missing.

Using xev it seems setxkbmap gets the mappings wrong. I didn't check all the non functional keys, but for example:
  • "Up arrow" key is "Print"
  • "Down Arrow" is "Super_R"
  • "Left Arrow" is "ISO_Level3_Shift"
  • "Right Arrow" is "NoSymbol"
  • "Delete" key is "NoSymbol"
 
Is this relevant?

pkg info -D libxkbcommon
Code:
libxkbcommon-1.6.0_2:
On install:
If arrow keys don't work under X11 switch to legacy rules e.g.,

For sh/bash/ksh/zsh run and (optionally) add into ~/.profile:
  export XKB_DEFAULT_RULES=xorg

For csh/tcsh run and (optionally) add into ~/.login:
  setenv XKB_DEFAULT_RULES xorg
 
Is this relevant?

pkg info -D libxkbcommon
Code:
libxkbcommon-1.6.0_2:
On install:
If arrow keys don't work under X11 switch to legacy rules e.g.,

For sh/bash/ksh/zsh run and (optionally) add into ~/.profile:
  export XKB_DEFAULT_RULES=xorg

For csh/tcsh run and (optionally) add into ~/.login:
  setenv XKB_DEFAULT_RULES xorg

Unfortunately it didn't help, both the error message and the broken key mappings persist:

Code:
~$ export XKB_DEFAULT_RULES=xorg
~$ setxkbmap gb
Couldn't interpret _XKB_RULES_NAMES property
Use defaults: rules - 'base' model - 'pc105' layout - 'us'
 
Interestingly I don't have to change keyboard layout to break the keymap. If I try "setxkbmap us" my keyboard remains US layout but the same keys stop working as mentioned above. So the act of running setxkbmap breaks the keys even if the layout is the same.
 
How are you starting X? I have the following set in my ~/.xinitrc and that seems to work correctly for me:

setxkbmap gb

Another option is to create a custom X configuration file for your keyboard. Here's an example.
 
I am starting X with "startx" and I have that setting in my ~/.xinitrc. That is what brought the issue to my attention, as after adding it the keys would not work on X as described.

I have now set the Xorg.config according to what I found here: Thread windowmaker-language-switching-in-wmaker.10981
Without the setkxbmap in my xinitrc it works fine, and I now have GB keyboard layout.

However running setkxbmap in a terminal causes the same problem again, as with the "us" test if I try "setxkbmap gb" it breaks the keys.

I sometimes need to switch my keyboard config to another language, and I don't want to have to edit the xorg.conf and restart X every time I need to do that, so ideally a solution to the issue of setxkbmap is needed.
 
Last edited:
And things get more curious. If I leave my machine idle for a while, at some point it will automatically switch back to "US" layout, despite "us" not being set in the xorg.conf. When this occurs all the keys keep working, except that the layout has changed.

Of course, if I set it to "gb" again with setxkbmap, it switches the layout and the keys break, forcing a restart of the x server.

Anyone seen this behaviour before?
 
Ok, this is interesting. It mentions being unable to write to /var/lib/xkb as a possible cause. To test this I started X on my root user, and I can confirm that I was able to use "setxkbmap" just fine to change the layout without any issues with the keyboard.

I then chmod 777 /var/lib/xkb and tried running X as my non-root user. That fixed the problem, but only partially.

If i use "setxkbmap" on my primarily display ( :0.0 ) it works perfectly. The keyboard layout can be changed and the key mappings don't break.

However if I try to run "setxkbmap" on my secondary display ( :0.1 ) the same problems with mapping occur.

I have no idea why running setxkbmap on different screens results in the different results, but as long as I remember to run it on my primarily screen I can at least now set my keyboard layout without breaking the mapping.

This also hints that it does in some way relate to permissions. I start my X session using xinit (startx) as my non root user, rather than going through a X login. I didn't think that would make a difference so didn't mention it earlier.
 
Back
Top