As a place to work on my IPS packages, I have a minimal Solaris 11 x86 VM under VirtualBox. By minimal, I mean the “server_install” set that you get by default from the text installer.
I’d like to ssh to it from my normal terminal emulator but I have to use the text console since the bridged networking makes my laptop unstable. Probably an interaction with VPN clients on the machine.
Alas, the out-of-the-box experience on the text console is … suboptimal. Pressing the key on the top right of the keyboard (normally “Backspace” but labeled “delete” on my Mac) sends the “^H” character to the session, while the default terminal device settings from stty(1) expect the delete (^?) character. The upshot of this is that pressing Backspace at the login prompt prints ^H. Nice.
It’s also less than ideal for an emacs user, since ^H (C-h in emacs parlance) is the help key. This can be fixed, but seriously, should I have to?
Anyway, I’ve found a minimal workaround that seems to work for me. Maybe it will help others.
We need to swap the backspace and delete keys on the keyboard. So, first we find which keys backspace and delete are on:
eleven# dumpkeys | grep '\\\\b'
key 11 base h shift H caps H ctrl '\\b' altg nop
key 42 all '\\b'
eleven# dumpkeys | grep '\\\\177'
key 76 all '\\177'
So, Backspace is on key 42 and key 11 (the “H” key) with Control held down. Delete is on key 76. So, for my purposes it’s good enough to swap those two keys.
Turns out that’s surprisingly easy:
#!/usr/bin/loadkeys
# Swap backspace and delete
swap 42 with 76
Just chmod +x that file and run it (as a user logged on at the console) and we’re finished!
To make this persistent across reboots is not much harder. First find the type and layout of your keyboard:
eleven# kbd -l
type=6
layout=33 (0x21)
delay(ms)=500
rate(ms)=40
The layout for this keyboard is defined in /usr/share/lib/keytables/type_6/layout_21.
Personally I’ve not made this change persistent since it’s not clear to me that editing these files is supported. Also, I’m not sure what would happen in the case of an upgrade of the system/data/keyboard/keytables package that contains them.
Now, if only someone can help me with getting the meta key to work…