Configuring Keyboard Mapping on Debian

debiankeyboard-layout

Tried a few different answers from here and other websites, but I can't seem to get my laptop keyboard mapping correctly on Debian at all.

My keyboard is a slightly abnormal layout.

It's qwerty, and UK.

Immediately to the right of my space bar, before Alt Gr, I have the | and \ key. When I press this key, I get < and >(shift) respectively.

Above my enter key, I have ~ and #. Currently when I press this, I get \ and |(shift) respectively.

I'm used to having GBP sign on shift+3, but instead I have #. Same applies for " being on shift+2, instead having @.

Here's the keyboard:

cevos p150sm keyboard

I suspect I'm going to need a slightly manual keymapping for this – or at least a default keymapping with some minor changes. Where do I start?

I've tried the following, with different options, to no avail. I can't get the keys to change… at all, let alone to the wrong/right options.

for i in 'console-data' 'console-setup' 'console-locales' 'keyboard-configuration'; do sudo apt-get install $i; done

for i in 'console-data' 'console-setup' 'keyboard-configuration'; do sudo dpkg-reconfigure $i; done

System info:

$ cat /etc/os-release                     
PRETTY_NAME="Debian GNU/Linux bullseye/sid"
NAME="Debian GNU/Linux"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

I'm also using i3wm.

Thanks in advance.

— EDIT

$ cat /etc/default/keyboard 
# KEYBOARD CONFIGURATION FILE

# Consult the keyboard(5) manual page.

XKBMODEL="pc105"
XKBLAYOUT="gb"
XKBVARIANT=""
XKBOPTIONS="lv3:ralt_switch,compose:rctrl"

BACKSPACE="guess"

-----

$ sudo dpkg-reconfigure keyboard-configuration
Options chosen:
 - Generic 105-key PC (intl.)
 - English (UK)
 - Default
 - No compose key
 - No Ctrl+Alt+Backspace

Best Answer

@rastafile's answer sent me down the right track for finding the solution to this.

https://medium.com/@damko/a-simple-humble-but-comprehensive-guide-to-xkb-for-linux-6f1ad5e13450

The above excellent guide gave me the solution.

setxkbmap -layout gb has, without any additional input, mapped all of my keys correctly - exactly as they appear on the laptop.

Related Question