Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Whenever I use setxkbmap in a terminal (or my .bashrc), the next time I press any modifier keys (ctrl, shift, alt) the NumLock LED on my keyboard goes off, but NumLock itself is still active so it's in some kind of inconsistent state.

If I now press NumLock, the LED stays off but NumLock turns off, and a second press on NumLock turns both the numpad and the LED on again. Curiously, while the LED is in this inconsistent state, pressing caps lock turns both the NumLock and CapsLock LEDs on.

The command that I have in my .bashrc causing this is setxkbmap -option compose:ralt but it also happens if I issue a plain setxkbmap with no parameters, or do anything else with that command.

Why is this happening (and am I doing something wrong)?

Dump of Xorg -version in case it helps (I'm running Xubuntu/XFCE):

X.Org X Server 1.7.6
Release Date: 2010-03-17
X Protocol Version 11, Revision 0
Build Operating System: Linux 2.6.24-30-server x86_64 Ubuntu
Current Operating System: Linux xxxxx 2.6.32-41-generic #94-Ubuntu SMP Fri Jul 6 18:00:34 UTC 2012 x86_64
Kernel command line: BOOT_IMAGE=/boot/vmlinuz-2.6.32-41-generic root=UUID=xxxxx ro quiet splash
Build Date: 25 February 2012  06:57:33AM
xorg-server 2:1.7.6-2ubuntu7.11 (For technical support please see http://www.ubuntu.com/support) 
Current version of pixman: 0.16.4
share|improve this question
FWIW, I am seeing the exact same issue on X.Org X Server 1.13.0 (vanilla Ubuntu 12.04.2, Das Keyboard P/N DKI-USB). Possibly related bug report. – l0b0 Apr 10 '13 at 11:38

Looks like this quote explains it:

Warning. setxkbmap not only alters the alphanumeric keys to the values given in the map; it also resets all other keys to the startup default. If you have assigned values to the Windows keys or the multimedia keys, these settings may be lost.

Since the default visual and system (or "actual") state of the Num Lock key presumably is off, I'm guessing that's why this happens at all. Why the system state is untouched and why this only happens when pressing certain keys is still a mystery.

share|improve this answer

This bug sucks big time. I've reported upstream at https://bugs.freedesktop.org/show_bug.cgi?id=78012.

As long as you're invoking setxkbmap from a script, you can work it around by executing "numlockx off; numlockx on" afterwards. But you can't do this if you're using a desktop hotkey (e.g. Alt+Shift).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.