Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

2 Answers

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
add comment

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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