I installed Ubuntu 20.04.1 with encrypted root with LUKS/LVM but the passphrase is not accepted randomly at boot time (actually never on the first try). However it is always accepted with a booted system or from the Ubuntu live cd with just one try.
To guard gainst typos or keyboard layout problems, I changed the passphrase to the single letter “a” but still I need 2 to 8 tries until the password is accepted.
To guard against problems with the keyboard, I create a keyscript /lib/cryptsetup/scripts/decrypt_echo with contents:
#!/bin/sh echo -n "a"
and changed crypttab to
sda6_crypt UUID=<someUUID> none,luks,discard,keyscript=decrypt_echo,initramfs
When I reboot the system, I see several error messages:
no key available with this passphrase cryptsetup: ERROR: sda6_crypt: cryptsetup failed: bad passpword or options?
The system boots after two to 8 tries with this error message.
Also I can always decrypt the disk (or test-passphrase) with just one try after system boot up. Only initramfs at boot has this problem. Before reinstalling I used Ubuntu 18.04 LTS which unlocked the root fs without any problems. So what changed in the new version and why initramfs only has the problem of unlocking (and who so solve or debug this)?
What is also strange: The same installation boots without problems on another PC, but just swapping hard disks.