Ubuntu – Keyboard layout ignored in initramfs since kernel 4.4.0-34. How to use non-US layout

bootinitramfskernelkeyboard-layout

I use a German keyboard layout and a luks-encrypted harddrive on my up-to-date 16.04. I could enter my luks password using my German keyboard layout with no problems until I installed the latest kernel update 4.4.0-34-generic. Now the layout is en_US for the cryptsetup on boot, but after that it's all German (e.g. for login).

I can still select to boot the old kernel 4.4.0-31-generic and have the German keyboard layout on cryptsetup.

I tried adding "KEYMAP=y" to my /etc/initramfs-tools/initramfs.conf and rebuilding my initramfs with "sudo update-initramfs -u", but that did not help.

How can I set a keyboard layout on cryptsetup with the newest kernel?

Best Answer

I had the same problem on a fresh install* of ubuntu 17.10.

This bit of information by F.Raab was proven very useful:

However /usr/share/initramfs-tools/hooks/console_setup do not generate /etc/console-setup/cached.kmap.gz and just use the existing one, in contrast to Debian. I assume that the generation has to do once right and then it should work again and then call ´update-initramfs -u`.

It seems the file /etc/console-setup/cached.kmap.gz was missing on my system, and apparently, the responsible programs do not create it.

The steps that did work on my system:

  1. cd /etc/console-setup
  2. Find a file to use as template: ls | grep kmap (search for filenames containing 'kmap' in current folder). I choose cached_UTF-8_del.kmap.gz.
  3. Create a duplicate of the template file and call it cached.kmap.gz: sudo cp cached_UTF-8_del.kmap.gz cached.kmap.gz(except NVIDIA drivers enabled via software & updates and grub quiet splash disabled because of shutdown bug)
  4. run sudo update-initramfs -u so cached.kmap.gz can be integrated in the boot sequence.

(I tested that cached.kmap.gz whas being used by running stat cached.kmap.gz before and after step 4 and comparing the access timestamps.)

After reboot, cryptsetup would accept my LUKS pasphrase in my preferred keyboard layout, instead of QUERTY.

(That means cached_UTF-8_del.kmap.gz already contained the correct layout. If above method does not work for you, you may try your luck with one of the commands at Change keyboard layout (English UK) on command line to English US or https://apps.ubuntu.com/cat/applications/language-selector-gnome/)

I'm on kernel 4.13.0-32-generic' (check usinguname -r`). Upgrading the kernel might mitigate the issue as well, but I did not want to do that as I feared that would result in conflicts with the NVIDIA driver again. (Why I had to leave Fedora; after almost every kernel update, my system would turn unstable again, and I don't have the skills and time to solve that.)

* except NVIDIA drivers enabled via software & updates and grub quiet splash disabled because of shutdown bug

Related Question