January 27, 2009

Reset your keyboard in X

I was using VMware and my keyboard went to Horkytown. My recipe for resetting the keyboard (at least on Fedora 10):

  1. egrep -i 'rules|layout|model' /var/log/Xorg.0.log to find out your rules, layout, and model for your keyboard.
  2. setxkbmap -rules xorg -layout us -model pc105 substituting the values from step 1 where appropriate.

If you have to SSH in and do this, like I did, prepend DISPLAY=:0 to setkbmap of course.

Comments (4)

  1. June 11, 2009
    bitmage said...

    Thanks! Just saved me from the same issue!

  2. July 5, 2010
    digitaltrails said...

    Thanks – saved me from having to restart X11. I was able to plug in a USB keyboard and follow your advice to restore my normal keyboard.

  3. October 10, 2011
    Joseph C said...

    Thanks! I hope this will solve a long-standing problem that I have with my VNC sessions on Ubuntu — every one in a while, my ALT key gets virtually stuck, and although I can see key events showing the alt key presses and releases, all input continues to behave as if the alt key was down.

  4. April 19, 2015

    [...] I found the answer on this blog post. [...]