Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Debian Sqeeze, I created a script called /etc/init.d/capslock that contains this:

#!/bin/sh
echo "Remapping Caps Lock key to Escape"
setkeycodes 0x3a 1
echo " ...done"

I made it executable, and linked it to /etc/rc2.d/S95capslock. When I run it from the command line, it works. But it doesn't fire on a reboot for some reason. Am I missing a step?

share|improve this question
up vote 1 down vote accepted

That looks like a useful snippet, but when I try it, I get the error "KDSETKEYCODE: Invalid argument".

Anyway, for Squeeze, you should probably use insserv to manage your init scripts. Add a header to the script like so:

### BEGIN INIT INFO
# Provides:       capslock-remap
# Required-Start: $all
# Required-Stop:  
# Default-Start:  2 3 4 5
# Default-Stop:   
# Description:    Remap CapsLock to Escape
### END INIT INFO

And then run insserv:

insserv capslock
share|improve this answer
    
You must have posted right after I replied to my own question. In the spirit of points, you can have the answer. – Matt Alexander Nov 21 '11 at 2:24
    
Yeah, I hit the post button and your answer showed up as "one minute ago"! Thanks for the points. :) – scott.squires Nov 21 '11 at 16:52

I used the command insserv capslock and everything started working.

Also, I needed to add an LSB header:

#!/bin/sh
### BEGIN INIT INFO
# Provides:          capslock
# Required-Start:    
# Required-Stop:     
# Default-Start:     1 2 3 4 5 6
# Default-Stop:      
# Short-Description: 
# Description:       Remaps Caps Lock key to Escape
### END INIT INFO
setkeycodes 0x3a 1
share|improve this answer

You must log in to answer this question.

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