I also tried running, in my case,
sudo loadkeys be-latin1 with limited results though; keys such as
£ were not mapped correctly.
A variety of keyboard layouts are stored in
/usr/share/keymaps/ for PC, Mac, etc.
For my Bluestork Bluetooth Belgian AZERTY keyboard (with a bit of exotism), I (accidently) managed to find the closest keyboard layout from here:
To use this layout:
$ sudo mkdir -p /usr/local/share/keymaps/mac/
$ cd /usr/local/share/keymaps/mac/
$ sudo cp /usr/share/keymaps/mac/mac-fr-ext.kmap.gz ./
$ sudo gunzip mac-fr-ext.kmap.gz
$ sudo loadkeys /usr/local/share/keymaps/mac/mac-fr-ext.kmap
Follow this wiki to run a script on startup to avoid running manually
sudo loadkeys … after every reboot—although you could use
R to retrieve it quickly by only typing
You should now get a working keyboard in the console.
If some key does not work, get its key code:
$ sudo showkey -k
You should get the key code for your key.
Find the relevant line in
mac-fr-ext.kmap (with text editor nano, vi, etc.) and change the key code.
For example, in my case, I had to remap function keys from F1 to F5, the Escape key, the at sign key, and the less-than sign key. I also had to replace
Shift_Lock for key code 58.
keycode 172 = Escape
keycode 86 = at
keycode 58 = Shift_Lock
keycode 41 = less
string F1 = "\033[11~"
string F2 = "\033[12~"
string F3 = "\033[13~"
string F4 = "\033[14~"
string F5 = "\033[15~"
My keyboard is now mapped correctly for use in the console.