Linux – How to use Dvorak keyboard layout in GRUB2 LUKS passphrase prompt

arch linuxgrub2keyboard-layoutluks

I've tried to piece together how to do this from various sources. First approach, based on 1 and 2:

$ grep ^HOOKS /etc/mkinitcpio.conf
HOOKS="base udev autodetect modconf block lvm2 keyboard keymap encrypt filesystems fsck"
$ grep ^KEYMAP /etc/vconsole.conf

Then run sudo mkinitcpio -p linux successfully and reboot. Result: the password prompt still uses the US layout.

Second approach, based on 3:

  1. Install ckbcomp
  2. Run:

    sudo mkdir /boot/grub/layout
    sudo grub-kbdcomp -o /boot/grub/layout/us-dvorak-alt-intl.gkb us dvorak-alt-intl

    (ignored "Unknown keyboard scan code 0x…" warnings)

  3. In /etc/default/grub set GRUB_TERMINAL_INPUT=at_keyboard
  4. In /etc/grub.d/40_custom add:

    insmod keylayouts
    keymap /boot/grub/layout/us-dvorak-alt-intl.gkb
  5. Run:

    sudo grub-mkconfig -o /boot/grub/grub.cfg
    sudo grub-install --target=i386-pc /dev/sda

Now I can use Dvorak in the GRUB menu, but not on the LUKS prompt.

Other sources mention a similar approach which I don't think can work because the LUKS prompt shows up before the relevant files can even be read. Finally, one source says this can't be done at all.