How To Configure Linux Console For UK Keyboard

Ken Moffat ken at
Thu Sep 18 11:15:03 PDT 2008

On Thu, Sep 18, 2008 at 01:31:44AM +0100, Stan Thorovsky wrote:
> First hurdle (never had to bother about it on servers) - how to
> properly set Linux Console in /etc/sysconfig/console for UK keyboard
> (LFS 6.3, paragraph 7.6). Googling didn't produce that much but Gentoo
> wiki suggests this configuration:
> KEYMAP="uk"
> FONT=?
> Is keymap correct and what about font?
> Thanks in advance - your help will be very much appreciates.
> Stan

 I think "Is keymap correct?" is a question for someone with the
exact (unspecified) hardware.  Assuming you have a regular desktop
UK keyboard available to you, you can note what the normal mappings
are, then compare that to your laptop to see what, if anything, is
different or missing in the symbols on the keys.

 The other thing to do is to run 'showkey' to see what codes your
keyboard produces.  On a modern desktop keyboard, the common
variations in keys are between the space bar and the control keys
(Alt,AltGr,Windows,Menu).  Also, on UK keyboards the \| key next to
the space bar doesn't always work on usb.  Laptops may drop keys, or
may have idiosyncratic keycodes.  If you are working in the linux
console, you will need \|~#`'"<> (some of these have been "fun" to
set up on apple ppc laptop keyboards).

 You can compare your keys to the maps in

 If you do need to change, it's probably only a few keys which need
to be corrected.  I was going to point you to my in ~/ken
but apache can't access it so I'll attach it to this mail.  If you
are using UTF-8, it might work for you (but not all fonts have all
the symbols).  If you are using legacy latin1 encoding, you can't use
the U+ forms.  The names are in the kbd package, in src/ksyms.c.

 Also see keymaps (5)

das eine Mal als Tragödie, das andere Mal als Farce
-------------- next part --------------
# altered to ease UTF-8, compose, dead accents
# The display of non latin1 characters does not work in distributions using
# console-tools, even if you add the from the kbd package.
# For some reason, the non-ascii character codes seem to get garbled, at
# least on ppc.
# Note that this defaults to latin1, any other characters
# can _only_ be specified by unicode number, and the
# result ('to')  of a 'compose' must be in the latin1 charmap.
# So, although I really wanted to replicate what happens for me
# in X, I can't do it all - prioritise W. European, plus
# hungarian (polish, czech have too many other letters)
#keymaps 0-2,4-6,8,9,12
# these keymaps are a bit excessive, at the time I couldn't
# find the docs and this does make AltGr and Shift+AltGr work.
keymaps 0-15
include "qwerty-layout"
include "linux-with-alt-and-altgr"
# key any mapped unicode letter by ctrl-shift plus XXXX for the hex digits
include ""
strings as usual

# NB I use U+ notation for characters not in latin1 - dumpkeys will report the
# name, but loading by name gives messages about assume iso-8859-x (where x != 1)
# and produces the wrong result.
# Strangely, console-tools produces the messages and errors even when I use
# the U+xxxx form.  It also translates U+201E to a symbol name which it then
# claims to not recognise.
#		Normal		Shift		AltGr		AltGr+Shift
keycode   1 = Escape
keycode   2 = one              exclam		one		U+00A1
keycode   3 = two              quotedbl         at		U+201E
keycode   4 = three            sterling
	control	keycode   4 = Escape
# euro on AltGr 4 - 'currency' doesn't work for me
keycode   5 = four             dollar           U+20AC           Control_backslash
keycode   6 = five             percent
	control	keycode   6 = Control_bracketright
keycode   7 = six              asciicircum
	control	keycode   7 = Control_asciicircum
keycode   8 = seven            ampersand        braceleft        Control_underscore
keycode   9 = eight            asterisk         bracketleft      Delete
keycode  10 = nine             parenleft        bracketright
keycode  11 = zero             parenright       braceright
#	alt	keycode  11 = Meta_parenright
keycode  12 = minus            underscore       backslash	U+00BF
#keycode  13 = equal            plus		dead_cedilla	dead_ogonek
keycode  13 = equal            plus		dead_cedilla
keycode  14 = Delete
	control	keycode  14 = Control_underscore
keycode  15 = Tab
# łŁ on w
keycode  17 = w			W		U+0142		U+0141
# u with double acute
keycode  22 = u			U		U+0171		U+0170
# extra on o ø and Ø can be accessed from compose / o, compose / O
# so put the double-acute here : it isn't latin-1.
keycode  24 = o			O		U+0151		U+0150
# extra on p
keycode  25 = p			P		thorn		THORN
#keycode  26 = bracketleft      braceleft	dead_diaeresis	dead_ring
keycode  26 = bracketleft      braceleft	dead_diaeresis
	control	keycode  26 = Escape
#keycode  27 = bracketright     braceright       dead_tilde	dead_macron
keycode  27 = bracketright     braceright       dead_tilde
keycode  28 = Return
	alt	keycode  28 = Meta_Control_m
keycode  29 = Control
# add extras to 'a'
keycode  30 = +a		+A		ae		AE
# extra on s
keycode  31 = s			S		U+00DF
# extras on 'd'
keycode  32 = d			D		eth		ETH
# add kra to k (iso-8859-4 so specify as U+)
keycode  37 = k			K		U+0138
# łŁ also on l
keycode  38 = l			L		U+0142		U+0141
#keycode  39 = semicolon        colon		dead_acute	dead_doubleacute
keycode  39 = semicolon        colon		dead_acute
#keycode  40 = apostrophe       at		dead_circumflex	dead_caron
keycode  40 = apostrophe       at		dead_circumflex
	control	keycode  40 = Control_g
	shift	control	keycode  40 = nul
keycode  41 = grave            notsign          bar              nul
keycode  42 = Shift
keycode  43 = numbersign       asciitilde	dead_grave	dead_breve
	control	keycode  43 = Control_backslash
# extra on z « 
keycode  44 = z			Z		U+00AB
# extra on x »
keycode  45 = x			X		U+00BB
keycode  51 = comma            less
keycode  52 = period           greater
#keycode  53 = slash            question		slash		dead_abovedot
keycode  53 = slash            question		slash
	control	keycode  53 = Delete
keycode  54 = Shift
keycode  56 = Alt
keycode  57 = space
	control	keycode  57 = nul
keycode  58 = Caps_Lock
keycode  86 = backslash        bar              bar              Control_backslash
keycode  97 = Control

# right windows key and right menu key both mapped to Compose -
# my normal keyboards have one or other of these
keycode 126 = Compose
keycode 127 = Compose

include "compose.latin1"

# looks as if U+ compose results only work if in the same iso-8859-x set,
# and the default charset is iso-8859-1
# e.g. can put aring in (also on oa, aa)
compose '=' 'a' to U+00E5

More information about the lfs-support mailing list