You are not logged in.

#1 2025-08-22 12:07:27

WaiRo
Member
Registered: 2025-01-02
Posts: 8

Cryptsetup prompt appears before the keyboard gets detected

So I'm using LUKS encryption with the sd-encrypt hook. What happens is that the password prompt appears before the keyboard has been detected, and my keyboard presses don't get registered for about 5 seconds, is there a way to make the keyboard appear faster, or make the password prompt always appear after the keyboard has loaded?

I'm using the linux kernel.

Relevant log:

systemd[1]: Started Dispatch Password Requests to Console.
systemd-tty-ask-password-agent[283]: Starting password query on /dev/tty1.
kernel: usb 1-1: New USB device found, idVendor=XXXX, idProduct=XXXX, bcdDevice= 1.00
kernel: usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
kernel: usb 1-1: Product: USB OPTICAL MOUSE 
kernel: input: USB OPTICAL MOUSE  as /devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb1/1-1/1-1:1.0/0003:XXXX:XXXX.0001/input/input3
kernel: hid-generic 0003:XXXX:XXXX.0001: input,hidraw0: USB HID v1.10 Mouse [USB OPTICAL MOUSE ] on usb-0000:05:00.3-1/input0
kernel: input: USB OPTICAL MOUSE  Keyboard as /devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb1/1-1/1-1:1.1/0003:XXXX:XXXX.0002/input/input4
kernel: hid-generic 0003:XXXX:XXXX.0002: input,hiddev96,hidraw1: USB HID v1.10 Keyboard [USB OPTICAL MOUSE ] on usb-0000:05:00.3-1/input1
kernel: usb 1-3: new high-speed USB device number 3 using xhci_hcd
kernel: usb 1-3: New USB device found, idVendor=XXXX, idProduct=XXXX, bcdDevice= 0.11
kernel: usb 1-3: New USB device strings: Mfr=3, Product=1, SerialNumber=2
kernel: usb 1-3: Product: Integrated Camera
kernel: usb 1-3: Manufacturer: Chicony Electronics Co.,Ltd.
kernel: usb 1-3: SerialNumber: 0001
kernel: usb 1-4: new high-speed USB device number 4 using xhci_hcd
kernel: usb 1-4: New USB device found, idVendor=XXXX, idProduct=XXXX, bcdDevice= 1.00
kernel: usb 1-4: New USB device strings: Mfr=5, Product=6, SerialNumber=7
kernel: usb 1-4: Product: Wireless_Device
kernel: usb 1-4: Manufacturer: MediaTek Inc.
kernel: usb 1-4: SerialNumber: 000000000
kernel: usb 1-5: new high-speed USB device number 5 using xhci_hcd
kernel: usb 1-5: New USB device found, idVendor=XXXX, idProduct=XXXX, bcdDevice=61.60
kernel: usb 1-5: New USB device strings: Mfr=0, Product=1, SerialNumber=0
kernel: usb 1-5: Product: USB2.0 Hub
kernel: hub 1-5:1.0: USB hub found
kernel: hub 1-5:1.0: 2 ports detected
kernel: usb 1-5.1: new full-speed USB device number 6 using xhci_hcd
kernel: usb 1-5.1: New USB device found, idVendor=XXXX, idProduct=XXXX, bcdDevice= 8.00
kernel: usb 1-5.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
kernel: usb 1-5.1: Product: ITE Device(8176)
kernel: usb 1-5.1: Manufacturer: ITE Tech. Inc.
kernel: input: ITE Tech. Inc. ITE Device(8176) Keyboard as /devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb1/1-5/1-5.1/1-5.1:1.0/0003:XXXX:XXXX.0003/input/input6
kernel: input: ITE Tech. Inc. ITE Device(8176) Wireless Radio Control as /devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb1/1-5/1-5.1/1-5.1:1.0/0003:XXXX:XXXX.0003/input/input7
kernel: hid-generic 0003:XXXX:XXXX.0003: input,hiddev97,hidraw2: USB HID v1.10 Keyboard [ITE Tech. Inc. ITE Device(8176)] on usb-0000:05:00.3-5.1/input0
systemd-tty-ask-password-agent[283]: Password query on /dev/tty1 finished successfully.

Offline

#2 2025-08-22 12:53:34

tekstryder
Member
Registered: 2013-02-14
Posts: 510

Re: Cryptsetup prompt appears before the keyboard gets detected

$ grep ^HOOKS /etc/mkinitcpio.conf

What's the order?

Offline

#3 2025-08-22 13:43:46

frostschutz
Member
Registered: 2013-11-15
Posts: 1,640

Re: Cryptsetup prompt appears before the keyboard gets detected

You can try adding required usb/keyboard modules in mkinitcpio.conf MODULES (will be translated to /etc/modules-load.d/MODULES.conf you can see in lsinitcpio) and see if it gets loaded earlier that way.

Offline

#4 2025-08-22 14:39:59

WaiRo
Member
Registered: 2025-01-02
Posts: 8

Re: Cryptsetup prompt appears before the keyboard gets detected

tekstryder wrote:
$ grep ^HOOKS /etc/mkinitcpio.conf

What's the order?

Here you go:

HOOKS=(base systemd autodetect microcode modconf keyboard sd-vconsole block sd-encrypt filesystems fsck)

Offline

#5 2025-08-22 15:08:46

WaiRo
Member
Registered: 2025-01-02
Posts: 8

Re: Cryptsetup prompt appears before the keyboard gets detected

frostschutz wrote:

You can try adding required usb/keyboard modules in mkinitcpio.conf MODULES (will be translated to /etc/modules-load.d/MODULES.conf you can see in lsinitcpio) and see if it gets loaded earlier that way.

I've tried these, with no success:

MODULES=(usbhid hid_generic xhci_hcd)

Offline

#6 2025-08-22 15:22:11

WaiRo
Member
Registered: 2025-01-02
Posts: 8

Re: Cryptsetup prompt appears before the keyboard gets detected

I added loglevel=7 to the kernel parameters and noticed that it hangs on a specific part:
Before hang:

systemd[1]: Started Dispatch Password Requests to Console.
systemd-tty-ask-password-agent[283]: Starting password query on /dev/tty1.
kernel: usb 1-1: New USB device found, idVendor=XXXX, idProduct=XXXX, bcdDevice= 1.00
kernel: usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
kernel: usb 1-1: Product: USB OPTICAL MOUSE 
kernel: input: USB OPTICAL MOUSE  as /devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb1/1-1/1-1:1.0/0003:XXXX:XXXX.0001/input/input3
kernel: hid-generic 0003:XXXX:XXXX.0001: input,hidraw0: USB HID v1.10 Mouse [USB OPTICAL MOUSE ] on usb-0000:05:00.3-1/input0
kernel: input: USB OPTICAL MOUSE  Keyboard as /devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb1/1-1/1-1:1.1/0003:XXXX:XXXX.0002/input/input4
kernel: hid-generic 0003:XXXX:XXXX.0002: input,hiddev96,hidraw1: USB HID v1.10 Keyboard [USB OPTICAL MOUSE ] on usb-0000:05:00.3-1/input1
kernel: usb 1-3: new high-speed USB device number 3 using xhci_hcd
kernel: usb 1-3: New USB device found, idVendor=XXXX, idProduct=XXXX, bcdDevice= 0.11
kernel: usb 1-3: New USB device strings: Mfr=3, Product=1, SerialNumber=2
kernel: usb 1-3: Product: Integrated Camera
kernel: usb 1-3: Manufacturer: Chicony Electronics Co.,Ltd.
kernel: usb 1-3: SerialNumber: 0001
kernel: usb 1-4: new high-speed USB device number 4 using xhci_hcd
kernel: usb 1-4: New USB device found, idVendor=XXXX, idProduct=XXXX, bcdDevice= 1.00
kernel: usb 1-4: New USB device strings: Mfr=5, Product=6, SerialNumber=7
kernel: usb 1-4: Product: Wireless_Device
kernel: usb 1-4: Manufacturer: MediaTek Inc.
kernel: usb 1-4: SerialNumber: 000000000
kernel: usb 1-5: new high-speed USB device number 5 using xhci_hcd
kernel: usb 1-5: New USB device found, idVendor=XXXX, idProduct=XXXX, bcdDevice=61.60
kernel: usb 1-5: New USB device strings: Mfr=0, Product=1, SerialNumber=0
kernel: usb 1-5: Product: USB2.0 Hub
kernel: hub 1-5:1.0: USB hub found
kernel: hub 1-5:1.0: 2 ports detected

hang:

kernel: usb 1-5.1: new full-speed USB device number 6 using xhci_hcd          <--- Hangs on this line
kernel: usb 1-5.1: New USB device found, idVendor=XXXX, idProduct=XXXX, bcdDevice= 8.00
kernel: usb 1-5.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
kernel: usb 1-5.1: Product: ITE Device(8176)
kernel: usb 1-5.1: Manufacturer: ITE Tech. Inc.
kernel: input: ITE Tech. Inc. ITE Device(8176) Keyboard as /devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb1/1-5/1-5.1/1-5.1:1.0/0003:XXXX:XXXX.0003/input/input6
kernel: input: ITE Tech. Inc. ITE Device(8176) Wireless Radio Control as /devices/pci0000:00/0000:00:08.1/0000:05:00.3/usb1/1-5/1-5.1/1-5.1:1.0/0003:XXXX:XXXX.0003/input/input7
kernel: hid-generic 0003:XXXX:XXXX.0003: input,hiddev97,hidraw2: USB HID v1.10 Keyboard [ITE Tech. Inc. ITE Device(8176)] on usb-0000:05:00.3-5.1/input0
systemd-tty-ask-password-agent[283]: Password query on /dev/tty1 finished successfully.

Offline

#7 2025-08-26 11:30:00

gromit
Administrator
From: Germany
Registered: 2024-02-10
Posts: 1,523
Website

Re: Cryptsetup prompt appears before the keyboard gets detected

Does the same also happen if you use linux-lts?

Offline

#8 2025-08-29 18:40:58

WaiRo
Member
Registered: 2025-01-02
Posts: 8

Re: Cryptsetup prompt appears before the keyboard gets detected

gromit wrote:

Does the same also happen if you use linux-lts?

I have tried three kernels: linux, linux-lts, and the cachyos kernel. I've also noticed that adding those kernel modules to the initramfs does improve the speed of keyboard initialization, which I hadn’t noticed before. However, it still feels like a half solution, since the keyboard loads after the password prompt appears. Ideally, I would like the password prompt to always appear only after the keyboard has fully loaded, no matter how long it takes. I’d appreciate it if anyone has a solution like that.

Offline

#9 2025-08-29 19:37:47

mmy8x
Member
Registered: 2025-03-02
Posts: 97

Re: Cryptsetup prompt appears before the keyboard gets detected

WaiRo wrote:

I added loglevel=7 to the kernel parameters and noticed that it hangs on a specific part:

You can run 'dmesg' later to get the same output, with timestamps.

WaiRo wrote:
kernel: usb 1-5.1: new full-speed USB device number 6 using xhci_hcd          <--- Hangs on this line

So this line appears and then it hangs (how long?) or it hangs before this line appears?

You seem to have the keyboard plugged into a hub. Did you try connecting it directly to the motherboard?

Offline

Board footer

Powered by FluxBB