linuxkeyboardfedoraluks

Kernel update causes keyboard layout change and unable to decrypt luks encryption


I'm using Fedora 23, LUKS encrypted disk and multiple keyboard input sources for all the languages I'm daily using and switching between. When there is kernel update available and I forget to switch to enUS as primary keyboard layout then I can not decrypt LUKS partition since wrong keyboard layout is set when I update kernel.

So I solved this issue by booting up previous kernel and opened the terminal...

[root@local ]# uname -a
Linux local.localhost 4.2.3-300.fc23.x86_64 #1 SMP Mon Oct 5 15:42:54 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

then found last updated/downloaded kernel...

[root@local ]# rpm -qa | grep kernel
kernel-4.2.5-300.fc23.x86_64
kernel-core-4.2.5-300.fc23.x86_64
kernel-modules-4.2.5-300.fc23.x86_64
kernel-4.2.3-300.fc23.x86_64
kernel-core-4.2.3-300.fc23.x86_64
kernel-modules-4.2.3-300.fc23.x86_64
kernel-4.2.0-300.fc23.x86_64
kernel-core-4.2.0-300.fc23.x86_64
kernel-modules-4.2.0-300.fc23.x86_64
libreport-plugin-kerneloops-2.6.3-1.fc23.x86_64
abrt-addon-kerneloops-2.7.0-1.fc23.x86_64

so from the list took obviously highest version nr, one which was causing problem and removed the listed kernel packages.

[root@local ]#  dnf remove kernel-4.2.5-300.fc23.x86_64 kernel-modules-4.2.5-300.fc23.x86_64 kernel-core-4.2.5-300.fc23.x86_64

then made sure that my primary language enUS is selected and updated kernel again

[root@local ]# dnf upgrade

After the kernel update is done I can decrypt my LUKS partition and everything is fine but my question is. Can this issue if occurs be solved some other way (faster) or is there way to prevent that happening even when I use many keyboard layouts? And which input source, kernel update uses. One which is currently active or one which is set as primary (first in the list) PS: I'm using gnome


Solution

  • When you can not decrypt your LUKS partition after kernel update and you have possibility that this is because you use multiple keyboard layouts then following is one of the solutions.

    1# Boot up to previous kernel which worked before update and just verify current kernel used.

    [root@local ]# uname -a
    

    2# Find last downloaded kernel.

    root@local ]# rpm -qa | grep kernel
    

    3# From the list find kernel packages which cause you a trouble and run following by replacing package names with ones you want to remove.

    [root@local ]#  dnf remove kernel-4.2.5-300.fc23.x86_64 kernel-modules-4.2.5-300.fc23.x86_64 kernel-core-4.2.5-300.fc23.x86_64
    

    4# Set your keyboard language to one which is your primary or you used when creating the LUKS pass phrase for your disk,

    5# and update the kernel.

    [root@local ]# dnf upgrade
    

    and you are good to go and boot with updated kernel.