...making Linux just a little more fun!

Caps Lock

By Anonymous

Coming back again to Ubuggy in the text console, be sure you are relaxed and in tolerance mode.

First, if you do not know it by its legal name, Ubuggy goes mostly by the nickname of Ubuntu. I have no problems using the nickname.

Second, assume that we have switched from the Ubuntu desktop to pure text mode with Ctrl-Alt-F1 or Ctrl-Alt-F2 or whatever. We are not in a graphic terminal.

Third, adjustments to the keymap in text mode do not affect the desktop.

Fourth, you have superuser privileges or else you can stop here.

And what are we dealing with this time? The caps lock key. When pressing it intentionally or inadvertently in the text console, you notice that other keys are not responding or are responding the wrong way. The caps lock LED is not lighting up.

[ Just for the record: I'm using Ubuntu, and my text terminal keys all seem to work fine - although the caps lock LED does fail to come on. -- Ben ]

Google to the rescue: the problem is at least 6 years old. Has it been solved? You have one guess and if you fail, nobody can help you.

It turns out that Ubuntu has just inherited the problem, although you can assume they made it worse. The problem is:


So the traditional caps lock action - called Caps_Lock in the kernel keymap - only works for ASCII or more precisely for latin1.

The intended solution is to replace it with CtrlL_Lock which is nothing but a sticky Ctrl key to help produce Unicode capitals when set.

The way to hell is paved with Unicode intentions. For the moment, the patches do not work properly. Or maybe they do in a different distro but Ubuntu has further complications:

  1. The Ubuntu text mode keymap has a total of 127 combos on top of any plain key. I'd bet the farm that they have not been tested one by one.
  2. Debian is still winding up the legacy of console-tools:


This was a project with alternative loadkeys/dumpkeys, launched in the late 90s and stuck into non-maintenance shortly afterwards. Its short life was, however, long enough to lure Debian into a costly mistake they still have not recovered from. OK, but Ubuntu is Ubuntu and they are responsible for what they do even if they are based on Debian. Just thank console-tools if you change your text mode keymap and later on it is rolled back unbeknownst to you.

So what has to be done until isolated kernel patchers close in on a safe caps lock solution and Ubuntu converts to a safe text mode keymap?

I was asking myself the question and couldn't find an answer. But then it occurred to me that normally you and me do not type lengthy texts all caps. For a short text of half a screen line it is not difficult to hold down the Shift key and type the letters. For lengthy text, should necessity really arise, type the lowercase text in an editor, turn it upper case with the editor and paste it wherever it is supposed to go. In other words, who needs Caps Lock besides the Nigerians offering you millions?

And where does this key originate from in the first place? Decades ago in the world of telegraph and telex, there was no lower case. Typewriters could be shifted to upper case. When ca. 1970 dedicated text processing machines were introduced, they had keyboards with lower case and were mimicking typewriters, so they got the caps lock key. But why the hell is it still there firmly planted on our keyboards forty years on?

Let's solve the problem without waiting for the perfect kernel patch: let's nuke Caps Lock.

In step 1, issue:

dumpkeys -1 > kdump.txt

In step 2, load kdump.txt into an editor and replace all instances of CtrlL_Lock with VoidSymbol. Save the modified file.

In step 3, issue:

loadkeys -s kdump.txt

Done. Of course, you may also assign to the key some other action of your choice. For instance, I came across a guy who assigned Tab to it because his normal Tab key was damaged. If you want to do that, do nuke CtrlL_Lock first as indicated above, then issue:

echo "keycode 58 = Tab" | loadkeys

or whatever you want to use.

This solution is ephemeral. At the next boot you will again get the CtrlL_Lock treatment. So save the keymap as you need it and load it automatically from your bash profile.

Hello, Dell? Please extend an invitation to Microsoft and others and remove the Caps Lock key from our PC keyboards.


Talkback: Discuss this article with The Answer Gang

Bio picture A. N. Onymous has been writing for LG since the early days - generally by sneaking in at night and leaving a variety of articles on the Editor's desk. A man (woman?) of mystery, claiming no credit and hiding in darkness... probably something to do with large amounts of treasure in an ancient Mayan temple, and a beautiful dark-eyed woman with a snake tattoo winding down from her left hip. Or maybe A.N. is just into privacy. In any case, we're grateful for the contributions.
-- Editor, Linux Gazette

Copyright © 2011, Anonymous. Released under the Open Publication License unless otherwise noted in the body of the article.

Published in Issue 186 of Linux Gazette, June 2011