Change keyboard layout at boot / initramfs

Hi everyone,

I’m currently testing Leap 15.6. I have encrypted the whole disk of my VM during the installation thanks to the graphical installer. The problem is that I have set the passphrase thanks to an AZERTY keyboard layout but grub2 is stuck on the QWERTY layout when I unlock the partition. Is it possible to change that? I’m not expert so I don’t know if the keyboard layout problem is caused by grub2 or initramfs. I’ve already read this doc and this one. Is there nothing I can do?

Is this problem caused by the fact that I am testing on a VM and not from a computer with an AZERTY keyboard? The bios used in this VM is SeaBIOS (version 1.16.2-debian-1.16.2-1).

Thank you for your help!

No. On PC GRUB is using firmware (BIOS or UEDFI) services to get input. It is the firmware that translates key presses into ASCII characters. GRUB has some support for remapping keyboard layout when running on bare metal for AT and USB keyboards. But that will unlikely work on top of normal BIOS/UEFI firmware.

I have just installed openSUSE on a laptop with an AZERTY keyboard to test things out and it doesn’t use the correct layout at boot up… Too bad.

Where can I find instructions to remap the keys?

I am afraid in the source code only. Or try to google for “grub keymap”.

I’ve found this section in Arch wiki, I’ll give it a try if the same tools and commands exist on openSUSE.

I’ll need help on this one. The commands are not the same in openSUSE.

There is also documentation on Debian but I can’t use the commands either.

Which commands? We do not read your mind nor are staying behind your shoulder.

I’ve just read that

subquent runs of grub-install(1) will override these changes.

in the Debian documentation. Does it mean that a patch to the kernel or if a new kernel version is install, I’ll lose the changes applies to grub?

No, on kernel installation only grub.cfg is regenerated, as long as your custom grub binary is using the default location of grub.cfg it should still be used. On grub (and shim depending on your platform) update new bootloader is installed and it will override your changes.

OK, so in what circumcircumstances is a new bootloader going to be installed and as a consequence override my custom grub?

At this point I’m assessing whether it’s worth the trouble to repeat that process. If I can’t encrypt the whole disk, including /boot, because of the keyboard layout issue, I can’t perform btrfs rollbacks safely either.

When grub or shim package is updated. When you manually force re-installation e.g. using YaST (which is rather popular advice on this forum). Maybe something else can trigger it.

Thank you for your answer, I’ll ponder this.