Comment 7 for bug 140786

enoksrd (enoksrd) wrote :

I've got this mostly figured out.

Short version

1. Edit /etc/default/console-setup and add an X11 style caps lock modification:

$ diff -u console-setup.orig console-setup
--- console-setup.orig 2009-02-09 03:05:27.000000000 -0500
+++ console-setup 2009-02-09 03:59:31.000000000 -0500
@@ -37,7 +37,7 @@

you can do "ctrl:nocaps" instead if you want to two control keys.

2. Trick dpkg into integrating your changes:

$ sudo dpkg-reconfigure console-setup

and choose all the defaults. It will warn that you're using a keyboard setup it doesn't understand and is skipping keyboard configuration. I tried running the dkpg-reconfigure with the stock /etc/default/console-setup and it never prompted me for the xkboptions, so I think the warning can be ignored.

Your new control key setup should work immediately, and persist across reboots.

Long version

The console-tools package conflicts with the kbd package which is required by the ubuntu-minimal package (which I assume is essential). The kbd package installs a /etc/kbd/remap which does what /etc/console-tools/remap did. The /etc/kbd/remap gets integrated by /etc/init.d/ (lines 235-238) in runlevel S, but only if the setupcon program is not installed. However, setupcon is installed by the package console-setup, which is also a dependency of ubuntu-minimal, so the remap part gets skipped. So we have to use console-setup.

Now console-setup is apparently configured by /etc/default/console-setup, and the configuration would be integrated by /etc/init.d/keyboard-setup (also provided by console-setup) in runlevel S, except that init script skips the keyboard setup if usplash is running when the /etc/rcS.d scripts get run, and usplash is a dependency of ubuntu-desktop, so it probably is running. You can run the keyboard-setup script manually after making the above mentioned edit to /etc/default/console-setup to get the keymap changes temporarily, but they don't get applied on each boot.

But all is not lost, because when you run dpkg-reconfigure console-setup (as suggested by /usr/share/doc/console-setup/README.Debian to "fine-tune your keyboard setup") it makes your changes permanent, even though it's unable to configure the changes you actually made :P It says

* Saving console font and keymap for next boot... [ OK ]
update-initramfs: Generating /boot/initrd.img-2.6.27-11-generic

when it runs. I have no idea what's actually happening there, but someone who does can probably explain how to do this last part without having to actually run dpkg-reconfigure console-setup, which is a little annoying because you have to hit enter 15 times.