I'm getting this error when trying to use xmodmap
to get rid of caps lock:
$ xmodmap -e 'clear Lock'
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 118 (X_SetModifierMapping)
Value in failed request: 0x17
Serial number of failed request: 8
Current serial number in output stream: 8
I'm running xfce. This problem did not occur before I added the Keyboard Layouts applet to a panel; before doing that, I was able to run my xmodmap script to swap Esc and CapsLock:
!Remap Caps_Lock as Escape
remove Lock = Caps_Lock
keysym Caps_Lock = Escape
It may be relevant that I chose alt-capslock as the keyboard switch combo in the Keyboard Layouts preferences.
I've had a similar problem before, on a different machine, running openbox. On that machine, this problem started when I upgraded to Lucid. I reported a bug in xorg. However, it remains unclear whether it's really a problem with xorg, or if I'm just doing something wrong with my configuration.
Have other people experienced this problem? Can someone shed some light on what's going on here? It seems there are quite a few layers involved, and I don't understand any of them particularly well, so any information would be helpful.
update
I've discovered that the problem is specifically triggered by adding the Canada layout variant "Multilingual" (ca-multix). If I instead add the variant "Multilingual (first part)" (ca-multi), the problem does not occur. I think this will probably end up being a usable workaround, but I don't yet know what the difference between these variants is.
I've filed a freedesktop issue, and am commenting on a related ubuntu issue.
Best Answer
Modern Xorg uses the XKB extension for supporting keyboard layouts. Xmodmap is emulated through a compatibility layer, but it has quirks. You can disable XKB entirely and Xorg will revert to using the old Xmodmap keyboard mappings. I think it's setting the option XkbDisable to true in xorg.conf, but you probably want to do it the XKB method. There are many configurable options located in /usr/share/X11/xkb/rules/xorg.xml and I think you want caps:swapescape which swaps Caps Lock and Escape. Try setxkbmap -option caps:swapescape