Skip to contentSkip to conversation

Changing default keyboard layout

DISCUSSION Andrei Borzenkov 2 participants 4 messages Aug 9, 2015 – Sep 2, 2015 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Please in future send such mails to grub-devel or open bug on savannah.

В Sat, 8 Aug 2015 19:36:58 +0200
Hervé Werner <[email protected]> пишет:

Quoted 7 lines

Hello

I'm trying to change the default US keyboard layout on
Grub2 but I don't manage to get it working. Here is basically what I did
:

$ ckbcomp fr bepo |grub-mklayout -v -o /boot/grub/bepo.gkb
Quoted 8 lines

and then I added these lines :

terminal_input at_keyboard
insmod keylayouts
keymap /boot/grub/bepo.gkb

After running grub-mkconfig, grub.cfg looks fine. Unfortunately at boot the layout is still qwerty.

I can't reproduce it, at least in QEMU (grub build for i386-pc). Loading custom keyboard does change keyboard layout.

Quoted 3 lines

I'm using Grub version 2.02~beta2-22 as shipped by Debian.

There is a bug reported on Debian : https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=741464 but unfortunately it is still pending.

This bug is not clear, but I notice that at least in QEMU interrupt is not disabled after startup and we never explicitly do it either. So grub may race with BIOS for input characters. The commands mentioned in this bug report (outb 0x64 0x60 ; outb 0x60 0x64) effectively disable keyboard interrupt.

@Marco: would you be willing to test a patch that does it by default?

Quoted 5 lines

I also stubbled upon similar bugs pertaining to other distros so it looks like a global issue though I did not find anything on Grub BTS.

I'm looking for help pertaining this issue.

Well, you will need to debug this, as I said, I cannot reproduce it and bug report you mentioned does not show any debug information either. If you are willing to compile your grub, we could add debug output to verify what you actually get from controller.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 13 lines · Hervé Werner

As requested I compiled the latest development version of Grub and installed it on a test laptop. Without any further configuration, Grub works fine, it is able to boot as intended but the keyboard mapping is us.

I then added the following snippet :
grubdir="echo "/boot/grub" | sed 's,//*,/,g'"

grub-kbdcomp -o "${grubdir}"/layout.gkb fr

cat <<EOF
terminal_input at_keyboard
insmod keylayouts
keymap make_system_path_relative_to_its_root "${grubdir}"/layout.gkb EOF

Quoted 7 lines

and ran grub-mkconfig which produced the following output in grub.cfg :
terminal_input at_keyboard
insmod keylayouts
keymap /grub/layout.gkb

I checked that the file /boot/grub/layout.gkb (as you have probably figured out, I have a dedicated partition for Grub's files), it is fine the file has been successfully created. At last I executed grub-install and rebooted. This time I'm no longer able to boot : the screen is freezing at Grub's main menu, the timeout counter isn't even decreasing and I'm not able to enter into Grub's rescue. Removing the insmod line doesn't change anything.

To be sure - does it hang without at_keyboard as well? keylayouts is loaded automatically as dependency of at_keyboard anyway, and it is quite unlikely anything in this module would cause observed effect.

Quoted 2 lines

Could you please tell me what I could do to increase debugging output ?

First try to reproduce it without GUI - it is rather hard to see anything in this case. Just boot grub without any grub.cfg - you will be left in plain CLI. Now try

insmod at_keyboard
terminal_input at_keyboard

does it still work? If yes, try keymap /grub/layout.gkb; does it still work?

and to be sure - could you send me your gkb file for test?

#4 lore raw
Quoted 2 lines

To be sure - does it hang without at_keyboard as well?

No it doesn't with only the keymap line (but the layout is still us).

Quoted 6 lines

First try to reproduce it without GUI - it is rather hard to see anything in this case. Just boot grub without any grub.cfg - you will be left in plain CLI. Now try

insmod at_keyboard
terminal_input at_keyboard

Hangs right after this last command.

Quoted 4 lines

does it still work? If yes, try keymap /grub/layout.gkb; does it still work?

and to be sure - could you send me your gkb file for test?

Sure you'll find it enclosed. Please also note that grub-kbdcomp is displaying the following warnings when creating the file :
Unknown keyboard scan code 0x54
Unknown keyboard scan code 0x65
Unknown keyboard scan code 0x7f

Thanks for your help.

dud

#5 lore raw

Hello

After some tests on different boxes I found out that terminal_input at_keyboard does work well on some hardware :
- Dell laptop & tower : OK. Some keys doesn't respond (such as escape), but this may correspond to the "Unknown keyboard scan code" message
- Acer laptop : fails
- HP laptop : fails

So it may confirm a bios issue (please note that firmware is up-to-date on every box).

However I've also lost interest in this feature as my main usage was to be able to enter a LUKS password in my native language and unfortunately I found out despites that keymap works as intended on Dell computers, Grub2 still asks for password in us layout. AFAIU disk decryption is executed even before grub.cfg is read, so this might mean that the layout stuff has to be installed at early disk place.

dud

From: [email protected]
To: [email protected]
CC: [email protected]; [email protected]; [email protected]
Subject: RE: Changing default keyboard layout
Date: Thu, 13 Aug 2015 21:05:48 +0200

Quoted 1 line

To be sure - does it hang without at_keyboard as well?

No it doesn't with only the keymap line (but the layout is still us).

Quoted 6 lines

First try to reproduce it without GUI - it is rather hard to see anything in this case. Just boot grub without any grub.cfg - you will be left in plain CLI. Now try

insmod at_keyboard
terminal_input at_keyboard

Hangs right after this last command.

Quoted 4 lines

does it still work? If yes, try keymap /grub/layout.gkb; does it still work?

and to be sure - could you send me your gkb file for test?

Sure you'll find it enclosed. Please also note that grub-kbdcomp is displaying the following warnings when creating the file :
Unknown keyboard scan code 0x54
Unknown keyboard scan code 0x65
Unknown keyboard scan code 0x7f

Thanks for your help.

dud