How to fix keymap of ISO keyboard - default Debian desktop
#1
Problem Statement

In an x11 terminal if you press Shift-` or Shift-3, or AltGr-4, you do not get the expected characters.

And if you open a console (Ctrl-Alt-F1) and login, and you press Shift-`, or Shift-3, or AltGr-`, or AltGr-4, you again do not get the expected characters.

Disclaimer/Recognition

The solution provided below works on the default Debian desktop that is shipped with the Pinebook Pro. Thanks @Mrfixit2001  and @Luke for your work on crafting this.

Solution

You will need an internet connection to install a package (console-setup) farther down.

Confirm you have the problem by checking the keys as described in the Problem Statement above, this could potentially be fixed in a later version of the default Debian desktop.

Open a terminal in an x11 session (the second icon from the left next to the Menu button) and run the following:

Code:
$ localectl
$ sudo localectl set-keymap uk
$ sudo localectl set-x11-keymap gb pc105
$ localectl
$ systemctl reboot

The localectl command shows you what's currently configured, the last command does what you expect and reboots the machine.

Open a terminal in an x11 session again, and run the following:

Code:
$ sudo dpkg-reconfigure keyboard-configuration

Enter the following when prompted:

Keyboard model:

Generic 105-key (Intl) PC

Keyboard layout:

English (UK)

Key to function as AltGr:

Right Alt (AltGr)

Compose key:

No compose key

Use Control+Alt+Backspace to terminate the X server?

No

Then in the terminal run:

Code:
$ localectl
$ systemctl reboot

After the system reboots and you have logged into an x11 session, open a terminal and run the following:

Code:
$ sudo dpkg-reconfigure locales

When prompted, enter the following:

Locales to be generated:

Select your specific locale, in my case I would select en_US.UTF-8 UTF8. If you are in the UK, it would be en_GB.UTF-8 UTF8

Default locale for the system environment:

Select the same thing you entered in the previous question

Then run in the terminal:

Code:
$ localectl
$ systemctl reboot

After you have logged back into an x11 session, if you open a terminal and check the keys, they should be fully functional in the x11 session.

In a terminal run:

Code:
$ localectl
$ sudo apt install console-setup

This should not require user input, and when finished the console keymap should work fully as the x11 keymap does. A reboot is not required.

Some of the reboots above may not be required, but they don't hurt. The localectl commands peppered throughout may be omited, I just thought it was interesting to watch the changes show up.
#2
Great write up! Should we add/move this to tutorials?
#3
That's your call =)  I wasn't sure if it belonged in tutorials, as it might be a temporary fix.
#4
Why not? It's helpful, and I believe we have a few other temporary/quick fixes posted there as well. (Copied over to Tutorials.)

I was thinking more of the community might weigh in before doing anything, but I think this fits the criteria of a good tutorial.
#5
Really helpful thank you.

I was pulling my hair out wondering why the keyboard combo for the ° symbol wasnt working.
I resorted to googling and even the unicode wasnt working.
Thanks to this post its working fine now (hopefully there is a degree symbol above :-) )
Linux n00b trying to learn.
Brute force and ignorance sometimes works!
| Pinebook Pro + Toshiba OCZ RC100 240GB |
#6
(01-07-2020, 05:06 AM)gandlers Wrote: Thanks to this post its working fine now (hopefully there is a degree symbol  above :-) )

The degree symbol works =) Glad to help!
#7
Just received my ANSI keyboard model Pinebook Pro yesterday. Fooling around using the terminal and soon found some issues on the keyboard mapping.

Key ~ (i.e. shift + `) will move the cursor to the beginning of the line
Key @ (i.e. shift + 2) becomes " (double quote)
Key # (i.e. shift + 3) will move the cursor to the next line
Key | (i.e. shift + \) becomes ~
Key " becomes @
Key \ becomes #

I followed hmuller suggestion above, and here is what I did:

$ sudo localectl set-keymap us
$ sudo localectl set-x11-keymap us pc104
$ systemctl reboot

$ sudo dpkg-reconfigure keyboard-configuration

Keyboard model: Generic 104-key PC
Keyboard layout: English (US)
Key to function as AltGr: Right Alt (AltGr)
Compose key: No compose key
Use Control+Alt+Backspace to terminate X server? No

$ systemctl reboot

$ sudo dpkg-reconfigure locales

Locales to be generated: en_US.UTF-8 UTF8
Default locale for the system environment: en_US.UTF-8 UTF8

$ systemctl reboot

$ localectl
$ sudo apt install console-setup

After all the steps above, my keyboard behaves as below:

Key ~ (i.e. shift + `) becomes ┐
Key @ (i.e. shift + 2) becomes "
Key # (i.e. shift + 3) becomes £
Key | (i.e. shift + \) becomes ~
Key \ becomes #

I still missing the | key and \ key. (with extra ┐ and £)

Any idea what can I do to fix this.

(Update: 15 Jan 2020 - one last step to fix it)
From the GUI desktop, click on Menu (lower left corner)
=> On the second column: Applications
=> click on Preferences
=> On the third column, click on keyboard

A "Keyboard Preference" window pops up
=> go to Layout tab
=> Here I only have one entry English (US). (no sign of EU keyboard defines here)
=> click on [Show...] button
=> it pops up a UK keyboard which is exactly what's wrong to my keyboard
=> close the show keyboard screen
=> back to Keyboard Preference window
=> click on [Reset to Defaults] button (this is where the magic happen)
=> on the Type to test settings field, try the key, and it is fixed.

Now my ANSI keyboard is working.
#8
I found the keyboard problem on my ANSI PBP was in the software settings under keyboard.

I added 'US keyboard' then deleted 'EU keyboard'

MY @ key and my " keys were reversed. Fixed now.
      LINUX = CHOICES
         **BCnAZ**
               Idea
   Donate to $upport
your favorite OS Team
#9
(01-15-2020, 01:54 AM)bcnaz Wrote: I found the keyboard problem on my ANSI PBP was in the software settings under keyboard.

I added   'US keyboard'     then deleted    'EU keyboard'  

MY   @   key  and my    "   keys were reversed.  Fixed now.

Thanks bcnaz with the hints.

My keyboard setting did not have EU Keyboard setup there.

However, I'm able to fix mine with a little twist. I've update my post above to include all steps. Thanks again.
#10
(01-15-2020, 11:42 AM)chip ling Wrote:
(01-15-2020, 01:54 AM)bcnaz Wrote: I found the keyboard problem on my ANSI PBP was in the software settings under keyboard.

I added   'US keyboard'     then deleted    'EU keyboard'  

MY   @   key  and my    "   keys were reversed.  Fixed now.

Thanks bcnaz with the hints.

My keyboard setting did not have EU Keyboard setup there.

However, I'm able to fix mine with a little twist. I've update my post above to include all steps. Thanks again.

  Are we talking the OEM  Debian/Mate operating system ?   or did you install a different OS  ?
      LINUX = CHOICES
         **BCnAZ**
               Idea
   Donate to $upport
your favorite OS Team


Possibly Related Threads…
Thread Author Replies Views Last Post
  Deepin Desktop Installation (Fedora 32 Workstation) Tutorial Upokupo 2 5,161 11-04-2020, 07:19 PM
Last Post: tllim
  Tutorial: Run Debian off NVMe hive 4 6,226 10-19-2020, 10:09 AM
Last Post: hive
  Is there a MMC upgrade instruction from debian-mate to manjaro factory (20.06)? pljanson 4 7,918 06-23-2020, 12:41 AM
Last Post: pljanson

Forum Jump:


Users browsing this thread: 1 Guest(s)