How can I fix my keyboard layout?

I'll tell you what eventually worked best for me.

  1. Open the gnome preference "keyboard layout" pane
  2. Move the layout order, if you have more than one
  3. Delete all layouts except the default one (mine was a US layout)

The previous two steps have been suggested as fixes on their own (on the Ubuntu forums?). They did not work for me. I tried them together consecutively and this again did not work for me. Thus my next step.

  1. Press, "Reset to Defaults"
  2. Layout changes effectuated from both the layout pane and indicator now result in a change in layout.
  3. Of course, add layouts back before attempting to change to them. Use the preview function to find a layout that easily produces the diacritical marks you seek.

I think my problem was from the fact that some of the layouts had changed in name, at least that's my take considering that the layout names weren't exactly what I expected when reassigning them. Deleting my extra layouts and then assigning new ones from a fresh list seems to have circumvented my issues, that being that the layouts of my choice now point to existing layouts with names to match.


You should be able to run the following to reselect your keyboard.

sudo dpkg-reconfigure keyboard-configuration

If it doesn't stick, you'll probably need to change /etc/default/keyboard. I think I have your keyboard and my pertinent file shows the following, running through an old IBM clone 104 keyboard.

XKBMODEL="pc104"
XKBLAYOUT="us"
XKBVARIANT="intl"
XKBOPTIONS="terminate:ctrl_alt_bksp"

So do that with gksudo gedit /etc/default/keyboard or however kids are editing files these days. Read pertinent info here for what to plug in.

I see sudo udevadm trigger --subsystem-match=input --action=change is suggested elsewhere herein.

If that doesn't work, your layout is probably corrupt or just wrong, and I can't be sure what would help but I would try reinstalling xkb-data, iso-codes.

Perhaps updating your locale since language and layouts are intertwined. See this but something like:

dpkg-reconfigure locales 
update-locale LANG=en_US.UTF-8

I guess I should mention that I've made good use of "English International AltGr dead keys" layout, if you're looking for dead keys. I don't know what the /etc/default/keyboard file would reflect for this one but googling would surely bring an answer, but first try adding it via the Keyboard Layout pane. Warning, there seems to be a limit of 4 before you can't add any more.

Other than that I'd point you towards xmodmap. It's capable of overriding layout defaults. Let me know if any, or which ones help.

What languages are you writing other than English? Spanish (because of the ñ)? and?


I am not certain this will help you, but when I asked this question of a German co-worker of mine (who also uses Ubuntu) he sent me this link:

http://ubuntuforums.org/showthread.php?t=1654199&highlight=.Xmodmap

As I am unfamiliar with keyboard layout definitions, I can't be certain it will work for you but I thought I'd send it along just in case.

Best of luck in solving this!