caps lock led not working on Linux console
This is a long standing Debian bug. It seems to relate to an underlying kernel bug which has been long since fixed. The problem seems to have been that Caps_Lock
did not work for non-ASCII characters, so the workaround was to map Shift_Lock
or CtrlL_Lock
to the caps lock key instead.
On the Debian side the issue is created by ckbcomp
which is used by console-setup
to create the console keymap from the XKB keyboard description. Note that the original code referenced in the bug report using Shift_Lock
seems to have been replaced by different code which switches for CtrlL_Lock
instead. If you are interested you can search for usages of the broken_caps
variable in the ckbcomp
Perl script.
I have no idea if the code is still necessary for any reason, maybe it is worth bumping the bug report. However, the workaround is to put the following line in /etc/kbd/remap
and it should be fixed after a reboot:
s/CtrlL_Lock/Caps_Lock/
Or for a temporary fix until the next reboot, run the following in a tty
session:
dumpkeys | sed s/CtrlL_Lock/Caps_Lock/ | sudo loadkeys
Update
It seems that /etc/kbd/remap
is only actually used if setupcon
is not available. A better workaround is just to put the following line in /etc/rc.local
:
dumpkeys | sed s/CtrlL_Lock/Caps_Lock/ | loadkeys
I found solutions for Debian 6 and Debian 7.
Debian 6
Put the following at the end of the /etc/console-setup/remap.inc
file:
keycode 58 = Caps_Lock
Then run setupcon
Debian 7
Put the following at the end of the /etc/default/keyboard
script:
dumpkeys | sed -e "s/keycode 58 = CtrlL_Lock/keycode 58 = Caps_Lock/" | \
loadkeys 2>&1 >/dev/null
Then run setupcon
Note that there are two spaces between keycode and 58. The redirect into /dev/null
just suppresses annoying console output.