Getting the backspace key to work
By: Matt McCollow
Preface
Several of the newer distributions seem to have a problem with the
Backspace key when using kdm, xdm, or gdm (a.k.a. run-level 5). For some
reason (unknown to me) they will make the Backspace key into a Delete
key. I know that RedHat 6.X and Slackware 7 both fall victim to this
problem. If you are using another distribution and have encountered the
same problem, this text will most likely apply to you too. I will be
focusing on how I solved the problem in RedHat 6.1.
Introduction
So, you just installed one of the new Linux distributions on your
computer, and in keeping with your Windows experiences, you'd like to be
presented with a graphical log-on to the system. This is quite easy to
do in Linux, and I will not focus on it (you'll probably be able to
figure out how to do it from this text anyways). Now, having configured
the appropriate script(s) to allow a graphical log-on, and rebooting your
computer, you are presented with a window that asks for your login name
and password. You type them in, and are greeted with your favorite
desktop/window manager's interface. Everything seems right, but when you
open your favorite IRC client and make a mistake while typing, you
realize your backspace key doesn't do anything. However if you put the
cursor in front of some text, and hit the backspace key, it deletes
it. What's going on?!?
The Problem
It seems that the problem is when Linux starts up, it looks for a file in
/etc/rc.d/ called rc.sysinit. This script (among other things) tells
Linux about your keyboard layout. Unfortunately, sometimes one is not
specified, and Linux uses "default.kmap", a default keyboard map
file. This one works fine in run-level 3, and appears to work fine in
run-level 5, until you try the backspace key.
The Solution
The solution to this problem is fairly simple and only requires you to
know how to use find/whereis/locate, how to use gunzip (or gzip -d) and
how to use a text editor. The object here is to find the location of
the keymap you want to use (in this article we're going for the US keymap,
which is standard in North America), decompress the keymap file, and tell
/etc/rc.d/rc.sysinit about it. From here on out, the information I am
giving has only been tested on RedHat 6.1, so your machine may vary
slightly.
First you want to locate the US keymap on your machine. In RedHat you
can do this by typing "locate us.kmap.gz" at the bash prompt. On my
computer, it's stored in /usr/lib/kbd/keymaps/i386/qwerty/ but yours
might be different. Once you have found us.kmap.gz, you will need to log
on as root to do the rest of this stuff. (I prefer to su to root instead
of actually logging on as root).
Now, once logged on as root, cd into the directory where your us.kmap.gz
file is being stored and issue the following command: "gzip -d
us.kmap.gz". This should leave a file called us.kmap in that
directory. When that's done, cd into /etc/rc.d and load rc.sysinit into
your favorite editor (I prefer pico). Now, you are looking for the
comment "# Load keymap" or something similar, and the line right under it
should say "KEYMAP=" (now is a good time to tell you that those
quotations should NOT be part of the file, and I'm simply using them for
clarity in this article). I hope you've remembered what directory your
us.kmap file is in, because you need to type that after "KEYMAP=". For
example, on my computer the line says:
# Load keymap
KEYMAP=/usr/lib/kbd/keymaps/i386/qwerty/us.kmap
Once this line reflects the location of your keymap file, save the
script, and exit the editor. If all went well, you should now be able to
reboot your system and have use of the backspace key using ren-level 5.
Notes
If none of this works, don't be paranoid, the system will simply use the
old "default.kmap" if i can't find the one you specified in rc.sysinit.
For some reason, the backspace key still doesn't work properly on the
login screen (for example, misspell your log-on name, and try to
backspace it). I don't know why this happens, but once you do log on,
the key should work just fine.
Would you like to have your article published online? Send them in to newfiles@linuxnewbie.org
|