When I switch to a TTY and turn on the caps lock, the caps lock LED on my keyboard isn't turning on. On X it works fine. When I activate caps lock and then switch to a TTY and then press caps lock (on the TTY) the LED stays on (Even though the TTY keeps it's own track of the caps lock). So it seems the TTYs don't care about the LED at all.

Can I somehow enable the LED on TTYs? It's very annoying to be forced to type something whilst not knowing if caps lock is activated.

I'm using Debian jessie (frequently updated) arch: amd64

up vote 7 down vote accepted

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
  • That's strange. The temporary fix works, but the fix in /etc/kbd/remap doesn't work. – Kritzefitz Jun 13 '14 at 9:32
  • @Kritzefitz updated, /etc/kbd/remap is only used in some circumstances. – Graeme Jun 13 '14 at 11:09
  • And is necessary to remove "exit 0" in the file /etc/rc.local – Vitor Mazuco Jul 16 '14 at 15:14
  • @VitorMazuco can you please explain why? It works fine for me with it exiting on zero. Have you not seen the comments at the top of the file? "Make sure that the script will "exit 0" on success or any other value on error". – carefulnow1 Nov 18 '16 at 23:53

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.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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