[SOLVED] Luks passphrase wrong keyboard language

I have installed mabox on a laptop with encryption (LUKS).
My language is fr_CA and its close to the us keyboard, but not exactly.
When I boot I’m asked to enter the luks passphrase but the keyboard is not mapped to my language. Since I have few charaters in it that are not at the same place on the us keyboard, it makes typing the passphrase a little complicated.

I have modified the /etc/mkinitcpio.conf to place the keyboard hook at the beginning. I recompiled it but no luck, it still is not using my keyboard layout.

here are my hooks in the mkinitcpio.conf :

HOOKS="base udev autodetect keyboard keymap modconf block consolefont encrypt openswap resume filesystems fsck"

This config should normally work but anybody can tell me why it doesn’t ???

Regards,
BT

1 Like

Anybody has an answer ???

Is my question clear ???

1 Like

Personally I have never used Luks while using linux.Maybe this can help some partially :
https://dev.getsol.us/T1216

2 Likes

Thanks for the hints.

I tried first to place the keyboard hook before the autodetect hook as it was said in archlinux wiki on mkinitcpio https://wiki.archlinux.org/title/Mkinitcpio_(Fran%C3%A7ais)#Hooks_communs but it doesn’t seem to change anything on Manjaro for the LUKS passphrase.

Then I tried to change vconsole.conf, add vconsole.keymap in the linux command line, added keylayouts to the grub_preload_modules, update-grub, …

Until now nothing seems to change the keyboard layout when asking for LUKS passphrase.

So I’m still looking for a solution to this.

Regards and thanks for the links,

          BT
1 Like

This problem is still there and I haven’t found how to have the correct keymap on LUKS when it ask for the password. Anybody out there is using luks and anything other than the us keymap ???
Am I alone in the world using LUKS on a not US keymap ???

I tried several workarounds with partial success only. Leave / un-encrypted :worried: and encrypt /home.
If during installation you select manual partitioning (or replace partition) and you create a separate /home partition with encryption and so it works with non-us passphrases as well. Refind also can be used instead of grub2. additional info for trim and resize of SSD
Eight keys/passphrases can be used:

sudo cryptsetup luksAddKey /dev/sdxx

Mabox being based on Manjaro being based on Arch, the hooks in the mkinitcpio should work the same. I have Arch on the main disk of my laptop and it’s encrypted and I did placed the keyboard hook just after autodetect and before the encrypt hook. And I can decrypt the disk with my correct keymap.
So Mabox or Manjaro did something that break the hook logic somehow.

I know about the 8 passphrases but I can’t create a passphrase with the equivalent US character since on the US the “altCar+2” is a dead key and on the canadian french keyboard it the “@”. The @ is one of the special character I did use in my passphrase. So I have to type “shift+2” to obtain the @ instead of the usual “AltCar+2” in my french-canadian keyboard. It’s not a big deal but I make the mistake of typing the wrong character very often. And if I was using a very different keyboard I would probably be unable to decrypt my disk . I think it’s not acceptable to for anybody using another keymap/language.

Still searching for a solution,
BT

Supposing you are not on BTRFS and systemd-boot is acceptable here is a working scenario:
Switch to sytemd-boot
In my case the test drive was a pendrive: /dev/sdb2
This was the hardest for me : /boot/loader/entries/mabox.conf
(the options line is copied mostly from /etc/default/grub

title  Mabox_Linux
linux  /vmlinuz-5.15-x86_64
initrd /intel-ucode.img 
initrd /initramfs-5.15-x86_64.img
options cryptdevice=UUID=77121593-4b86-47c2-af1f-f1cdf9d6423b:luks-77121593-4b86-47c2-af1f-f1cdf9d6423b root=/dev/mapper/luks-77121593-4b86-47c2-af1f-f1cdf9d6423b rw

At first there will be no prompt for luks passkey.
remedy by dalto 5/12
Feel free to ask questions.

It boot faster but the passphrase is still in the wrong keymap : US.

Thanks but problem not solved.

@PerfMonk As a successive approximation I did the following:
Maybe it is not the shortest way

setxkbmap ca -variant fr
sudo localectl set-x11-keymap ca variant fr
cat /etc/vconsole.conf
KEYMAP=cf
FONT=
FONT_MAP= 

sudo mkinitcpio -P

rebooted
and voilà @@@ passphrase was accepted by typing “AltCar+2” (with me “AltGr+2”) 3 times.

I tried this without success. I can’t use the AltCar+2 for the @ character in the passphrase.

Also I didn’t had the variant specified in /etc/default/keyboard. I did add it.

2023-02-10_22-38

2023-02-10_22-51

I have the hooks specified like this in /etc/mkinitcpio.conf
```
HOOKS=“base udev autodetect keyboard keymap modconf block consolefont encrypt openswap resume filesystems fsck”


But the only passphrase accepted was with the "shift+2" wich give @ on the US keyboard.
I can't explain this :thinking:

Thanks

@PerfMonk
From scratch reinstalled to another SSD. Selected:
French (Canada) Default keybouard
migrated to systemd-boot as in section 8 here above
ran mkinitcpio -P
locale-gen sees only 2 lines

# Locales enabled by Calamares
en_US.UTF-8 UTF-8
fr_CA.UTF-8 UTF-8

cat /etc/vconsole.conf

KEYMAP=cf
FONT=
FONT_MAP=

HOOKS line both default and yours are OK
upgraded to 6.1 both versions accept @@@ passphrase by hitting AltrGr+2.

cat /etc/default/keyboard

# KEYBOARD CONFIGURATION FILE

# Consult the keyboard(5) manual page.

XKBMODEL="pc105"
XKBLAYOUT="ca"
XKBVARIANT=""
XKBOPTIONS=""

BACKSPACE="guess"

What else should I do?

It works! I’m using refind and it still directed me to boot with grub on mabox (I didn’t uninstalled grub yet). I didn’t noticed there is another choice to boot with systemd.

I booted with systemd and I could enter the correct “@” character in my passphrase. :+1:

Thus the problem seems to be with grub not really with the keyboard hook.

Thank you very much for solving the mystery!
I will mark this problem as SOLVED.

I can’t edit the title of the thread to mark it solved.
It must be too old. Sorry :smiling_face_with_tear:

As Japanese say:
勉強になりました benkyouni narimashita I learned a lot.