Keyboard layout reverts at every boot

I also have the same problem. I did a lot of research, but I have not found a solution for me. Instead, for many people, this was the solution:

  1. Open Terminal
  2. Type sudo vim /etc/default/keyboard
  3. The values ​​within the file should be as follows:

    XKBMODEL="pc105"
    XKBLAYOUT="it"
    XKBVARIANT=""
    XKBOPTIONS=""
    
  4. XKBLAYOUT is the code of your keyboard layout. Type man xkeyboard-config for shows the codes for keyboard model and layout.

  5. exit

Reboot and check. I hope this is the right solution for you too ;)


This (the second, not the first) solution definitely works. I had the same problem with the US layout I wanted to use and kept having to remove and readd each time I logged into Ubuntu 13.04. It kept reverting back to the UK Keyboard layout, despite having run:

dpkg-reconfigure keyboard-configuration

(EVEN WHEN THE LANGUAGE ICON ON THE TOP RIGHT OF THE SCREEN ACTUALLY SAYS 'en US') so this is definitely a serious bug as even changing keyboard layouts by clicking on them is completely unresponsive! Hope there will be some kind of fix for this soon.

Anyway, I found that, in fact, simply typing the command:

setxkbmap

into the 'Startup Applications' command tab solves the problem of Ubuntu forgetting the keyboard layout settings upon each boot.

HOWEVER: I did discover something else: If you are also running xmodmap in startup, then it will be OVERWRITTEN by the setxkbmap command. The setxkbmap command thus overrides the xmodmap commands at startup. (I found this out because I had finally succeeded in getting Ubuntu to remember my keybinding of Scroll Lock (which I use for my backlit keyboard) by means of running an .Xmodmap file including the modification (in my case:

add mod3 = Scroll_Lock

Would be nice if anyone has any ideas on how to be able to run both on startup, at least until there is a permanent fix for the very very common, obvious and serious language layout problem in Ubuntu (i.e. Ubuntu forgetting keyboard layout settings after every boot).