I'm using CentOS 7 with a luks encrypted root partition. Usually I have to type my password during boot, but sometimes the system doesn't accept it. It reacts as it was wrong, but it isn't. I did not change the keyboard layout (maybe it changed itself. How can I check this?)

Is this a known bug?

  • And then, later on, does it works again, or is it always failing after this problem starts happening?
    – Celada
    Dec 16, 2014 at 23:20
  • After a reboot it works again, usually...
    – sedrubal
    Dec 18, 2014 at 10:21

1 Answer 1


My solution to LUKS and keyboard layout problems is to add the passphrase twice. So the same sequence of key presses will be accepted in both US/qwerty layout and whatever you usually use (in my case, DE/qwertz).

If you use more than one keyboard layout you can add more passphrases for them; LUKS supports up to 8 in total, and most people never use more than 2 (one passphrase, one keyfile).

# cryptsetup luksAddKey foobar
Enter any existing passphrase: [type: qwertzqwertz]
--- in another terminal: loadkeys us ; setxkbmap us ---
Enter new passphrase for key slot: [type: qwertzqwertz]
Verify passphrase: [type: qwertzqwertz]

So you add a key, physically typing the same key sequence (qwertzqwertz) three times, but because you changed the keyboard layout after entering the existing passphrase, what LUKS actually sees for the added passphrase is its representation in another layout (qwertyqwerty instead of qwertzqwertz).

Afterwards, it doesn't matter if your Initramfs manages to load your native keyboard layout or not; LUKS will accept either one.

  • 3
    hihi thats a good idea :D
    – sedrubal
    Dec 18, 2014 at 10:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .