I plugged a second keyboard into my computer to test something, and now my NumLock light is out of sync with the lock status (the light is off when NumLock is on, and vice-versa). How can I get the two back in sync? I'm running Gentoo Linux, if it matters.

2 Answers 2


This is the expected behavior unter elder Versions of X11 if there is more than a single keyboard (X11 always has a virtual keyboard, so a single physical keyboard acts as a second one; See command xinput).

Newer Kernels and newer X11 synchronize the leds of all keyboards, but for a long time, it was such, that you can invert the NumLock-LED on purpose. AFAICS this is no more possible with newer X11, sigh.

There is a program numlockx which is designed to programmatically set the NumLock status along with all LEDs to a wanted state. However there is no direct way to fix the status if it was disturbed, so you need a short bourne shell script to do so:

numlockx `numlockx status | egrep -o 'on|off'`

Beware! This has a small race condition between state check and forching the state for all keyboards. So better do not run this in background from cron etc., better just run it on-demand when needed.


This normally happens when the light is "on" on the first keyboard while plugging in the seconds. So make sure the light is of on the first keyboard (which has the right status), unplug the second keyboard and plug it back in.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .