7

I installed grub on a EFI based system. So I have the EFI partition on /dev/sdc2 and my LUKS container in /dev/sdc5. I have only one linux partition in the LUKS container. So even /boot with the stage 2 of grub is encrypted.

When the system boots the EFI boots the grub entry and grub stage 1 loads. This tries to open the LUKS container in /dev/sdc5 and wants a password.

This is the time where I want to have a german layout instead of the english-us one. I know how to change the layout in grub stage 2 but how do I change it in stage 1. Is this even possible?

OS is Debian Jessie.

7
  • Have you seen this? forums.debian.net/viewtopic.php?f=16&t=76833 – MariusMatutiae Sep 18 '15 at 16:27
  • @MariusMatutiae This seems to be about stage 2 of grub. That's the easy part. My problem is that I use GRUB to unlock my LUKS partition. This is done by stage 1 which sits in the MBR of your harddrive and is only around 500 bytes big. – XenGi Sep 21 '15 at 14:49
  • There's an instruction in the arch wiki that claims to work: ArchWiki - Custom keyboard layout – 1125 Oct 8 '16 at 21:12
  • Grub2 has no "stage 1" or "stage 2". That was how legacy grub worked. – psusi Mar 14 '17 at 13:05
  • 1
    Maybe they aren't called that anymore but there are still two parts of grub. The one that loads before the decryption and the one after. And in a bios setup this should be basically the same as stage 1 and 2. For UEFI you have more space so the grub binary in your ESP can do a lot more stuff. – XenGi Mar 14 '17 at 13:59
4

Since you're using EFI with an encrypted /boot, I'm assuming you're already familiar with grub-mkstandalone

Add in /etc/default/grub :

GRUB_TERMINAL_INPUT=at_keyboard

Add in /etc/grub.d/40_custom :

insmod keylayouts
keymap /boot/grub/de.gkb

Next run grub-kbdcomp -o /tmp/de.gkb de to generate the german grub layout.

Now all you need to do is add "boot/grub/de.gkb=/tmp/de.gkb" to your grub-mkstandalone command. In my case it looks like this:

grub-mkstandalone -d /usr/lib/grub/x86_64-efi/ -O x86_64-efi --compress="xz" --modules="part_gpt part_msdos crypto cryptodisk luks disk diskfilter lvm" --fonts="unicode" -o "/boot/efi/EFI/linux/grubx64.efi" "boot/grub/grub.cfg=/tmp/grub.cfg" "boot/grub/de.gkb=/tmp/de.gkb"
2
  • So this generate an UEFI binary with grub and the defined layout? That's pretty cool thx! – XenGi Mar 14 '17 at 13:49
  • Yes. You can also use this to include background images etc (if you want to personalize your grub menu). – Darky Mar 14 '17 at 14:33
3

It cannot be done, see this Introduction to Grub2 which states explicitly:

Important: Keyboard Layout during the Boot Procedure

The US keyboard layout is the only one available when booting

2
  • This can't work because the kernel and initramfs is on the encrypted partition and not accessible until the drive is unlocked. That's not even a solution if I would be in stage 2. – XenGi Sep 22 '15 at 23:31
  • thx, haven't seen this in the docs. – XenGi Sep 23 '15 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.