Setxkbmap option in /etc/default/keyboard not working

Hi there,

I just installed the 16.04 beta, and have come across a weird bug. On all Debian and Ubuntu based systems one of the first things I do is make some adjustments to the default gb keyboard. I do this by editing /etc/default/keyboard and changing the line:

XKBOPTIONS=""

to:

XKBOPTIONS=“caps:swapescape,lv3:ralt_alt,terminate:ctrl_alt_bksp”

…and then restarting.

The usual result of this on every Debian and Ubuntu based system I’ve used over the last few years is to make these changes to both the X11 keyboard and the console keyboard. On the 16.04 Beta (which is up to date) neither of these things happen and the keyboard remains as a stock gb.

Relevent documentation here:

http://manpages.ubuntu.com/manpages/wily/man5/keyboard.5.html
https://wiki.debian.org/Keyboard

However running setxkbmap -option ‘caps:swapescape,lv3:ralt_alt,terminate:ctrl_alt_bksp’ manually works fine under X11. Does anyone have any idea what’s changed and why this no longer has the expected result?

OK, so the plot thickens… I attempted to go another route that I’ve gone in the past when fiddling with keyboard layouts and actually edited the gb file located at /usr/share/X11/xkb/symbols (after making a backup of course). I changed it to this:

// based on a keyboard map from an ‘xkb/symbols/gb’ file

default partial alphanumeric_keys
xkb_symbols “basic” {

// Describes the differences between a very simple en_US
// keyboard and a very simple U.K. keyboard layout defined by
// the SVR4 European Language Supplement and sometimes also
// known as the IBM 166 layout.
include "latin"
name[Group1]="English (UK, ThinkPad Sanity)";
key <AE02>  { [         2,   quotedbl,  twosuperior,    oneeighth ] };
key <AE03>  { [         3,   sterling, threesuperior,    sterling ] };
key <AE04>  { [         4,     dollar,     EuroSign,   onequarter ] };
key <AC11>  { [apostrophe,         at, dead_circumflex, dead_caron] };
key <TLDE>  { [     grave,    notsign,          bar,          bar ] };
key <BKSL>  { [numbersign, asciitilde,   dead_grave,   dead_breve ] };
key <LSGT>  { [ backslash,        bar,          bar,    brokenbar ] };
// restore sanity!
key <CAPS>  { [ Escape    ] };
key <ESC>   { [ Caps_Lock ] };
key <PRSC>  { [ Super_R   ] };
// Ctrl Alt Backspace terminates the X11 server
key <BKSP>  { type="CTRL+ALT", symbols[Group1] = [ NoSymbol, NoSymbol, NoSymbol, NoSymbol, Terminate_Server ] };

};

This has worked perfectly well in the past on Debian/Ubuntu based systems, Fedora, Arch and even Free & OpenBSD as of course it’s just X11 specific. However this layout does not get loaded when I log in despite the fact that it’s now replacing the gb map, and my /etc/default/keyboard file specifies the gb layout.

What’s also extremely odd is that once logged in, the keymap will work if manually called by setxkbmap, but ONLY if it’s renamed to something other than plain ol’ gb. ie) calling setxkbmap gb does nothing, but if I copy the file to, say, gb_tpsanity, and then call setxkbmap gb_tpsanity, it works fine… Very, very odd.

So half the issue seems to be solved by running dpkg-reconfigure keyboard-configuration with my modified /etc/default/keyboard. This then works some kind of magic (other than just running update-initramfs -u) and, lo and behold, after a reboot, my console keymap is as I expect it.

Unfortunately it does not change anything for my X11 session, which remains as a stock gb layout. I have worked around this by setting the keyboard options I want in the mate keyboard configuration GUI, however, it really annoys and baffles me that the trusty, system wide, /etc/default/keyboard config file is not working.

Also, the fact that even changing the gb map file does nothing, suggests to me that either this is a bug or something in the way the keyboard is configured has drastically changed… It’s also really annoying from the POV of using or trying out different window managers or desktop environments, as I shall have to fiddle with the layout again and again for each DE or WM.

Surely setxkbmap options should be set once, at a system level, not repeatedly.