dracut icon indicating copy to clipboard operation
dracut copied to clipboard

Keyboard not initialize before `rd.cmdline=ask` prompt

Open Neurognostic opened this issue 5 years ago • 19 comments

Summary

OS: Arch Linux Dracut Version: 16abea2

If I specify the rd.cmdline=ask parameter, when I am presented with the prompt to add additional kernel parameters the prompt will not receive any input.

If I remove rd.cmdline=ask then the first prompt is the LUKS passphrase prompt and the keyboard input works fine.

Keyboard works fine in firmware setup and in both rEFInd and systemd-boot.

How the issue was verified

I have tried to forcefully add every kernel module for input devices I could find loaded on my system. I can see they have indeed all been added to the initramfs with lsinitrd(1).

# /etc/dracut.conf.d/keyboard.conf
add_drivers+=' serio psmouse atkbd hid usbhid isp116x-hcd thinkpad_acpi i8042 '
force_drivers+=' serio psmouse atkbd hid usbhid isp116x-hcd thinkpad_acpi i8042 '

I have tried multiple USB keyboards, the issue is not limited to my built-in ThinkPad keyboard.

Testing keyboard at every break point when initramfs drops to emergency shell:

Break Point Keyboard Function
rd.break=cmdline
rd.break=pre-udev
rd.break=pre-trigger
rd.break=initqueue
rd.break=pre-mount
rd.break=mount
rd.break=pre-pivot
rd.break=cleanup
rd.break
Debug output up to the prompt

image

Any idea what is going on here? Why does the keyboard work at some points in the initramfs but not in the rd.cmdline=ask prompt?

Editing the kernel parameters from the initramfs is highly desired when EFISTUB booting directly from the firmware.

Neurognostic avatar Feb 19 '20 09:02 Neurognostic

The dracut(8) command I am currently using to test with:

cmdline=(
        rd.cmdline=ask
        rw
        rd.luks.name=$(cryptsetup luksUUID /dev/disk/by-partlabel/cryptsystem)=system
        root=LABEL=system
        zswap.enabled=1
        zswap.compressor=lz4
        zswap.zpool=z3fold
)

kmods=( lz4 lz4_compress serio psmouse atkbd hid usbhid isp116x-hcd thinkpad_acpi )

dracut --uefi --early-microcode --kver $kver --kernel-cmdline="${cmdline[*]}" \
    --force-drivers=" ${kmods[*]} " \
    --uefi-stub /usr/lib/systemd/boot/efi/linuxx64.efi.stub \
    /efi/EFI/archlinux/linux.test.efi

efibootmgr --create --disk /dev/disk/by-label/ESP --label 'Arch Linux (test)' \
    --loader EFI/archlinux/linux.test.efi

Can someone test rd.cmdline=ask with master and let me know what their configuration is if you get a working prompt?

Neurognostic avatar Feb 20 '20 05:02 Neurognostic

Hmm, this works for me with Fedora 31 and current master

haraldh avatar Mar 06 '20 09:03 haraldh

Just try it with a Fedora VM

haraldh avatar Mar 06 '20 09:03 haraldh

I'm also experiencing this. I notice that the caps lock light does not illuminate, as if the USB drivers have not been loaded. There's unfortunately no serial port on this hardware. lsinitrd does appear to include the xhci drivers.

mwberry avatar May 31 '20 20:05 mwberry

This issue is being marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. If this is still an issue in the latest release of Dracut and you would like to keep it open please comment on this issue within the next 7 days. Thank you for your contributions.

stale[bot] avatar Dec 16 '20 15:12 stale[bot]

I'm on Archlinux, with dracut 051. Both the laptop builtin keyboard and external USB keyboard are still unusable during rd.cmdline=ask.

Aetf avatar Dec 16 '20 19:12 Aetf

This issue is being marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. If this is still an issue in the latest release of Dracut and you would like to keep it open please comment on this issue within the next 7 days. Thank you for your contributions.

stale[bot] avatar Jan 15 '21 19:01 stale[bot]

The latest release is still 051 and the issue is still there.

Aetf avatar Jan 15 '21 20:01 Aetf

This issue is being marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. If this is still an issue in the latest release of Dracut and you would like to keep it open please comment on this issue within the next 7 days. Thank you for your contributions.

stale[bot] avatar Feb 14 '21 21:02 stale[bot]

Not sure what else to add. Still on version 051.

Aetf avatar Feb 15 '21 02:02 Aetf

@Aetf is this still an issue with latest dracut and arch release?

johannbg avatar Dec 22 '22 11:12 johannbg

This is still an issue with both 056 (latest in official Arch repos) and 059-10-g10cf8e46. Have tested on several different systems over the last 3 years with the same results.

Is there any other information I can provide?

Neurognostic avatar Dec 31 '22 02:12 Neurognostic

"forced" modules are only loaded after cmdline.service if systemd is in the initramfs - https://github.com/dracutdevs/dracut/blob/master/modules.d/98dracut-systemd/dracut-pre-udev.service#L8

If systemd is NOT in the initramfs, this use-case might already work due to https://github.com/dracutdevs/dracut/blob/master/modules.d/90kernel-modules/module-setup.sh#L150 .

This is because https://github.com/dracutdevs/dracut/blob/master/modules.d/90kernel-modules/parse-kernel.sh#L12 loads the forced kernel modules earlier than systemd.

Perhaps we can remove the ! systemd condition and that might resolve the problem. This would effectively revert https://github.com/dracutdevs/dracut/commit/6ae68b467447dab87e0f2796285d2751252b8b9a

@Neurognostic @Aetf @mwberry - are you in a position to make this change locally and confirm that this resolves your issue ?

Hmm, this works for me with Fedora 31 and current master

This is likely as Fedora has those kernel modules pre-built into kernel.

LaszloGombos avatar Aug 01 '23 16:08 LaszloGombos

Tried edit modules.d/90kernel-modules/module-setup.sh as suggested.

Looks like there is an additional step to load kernel modules, but keyboard is still not working.

PXL_20230803_051600283 MP

Is there anyway to know what kernel modules are necessary for my input device?

Aetf avatar Aug 03 '23 05:08 Aetf

@Aetf Thanks for helping to debug this.

Some ideas (you can try perhaps all of them at once)

  • you can invoke dracut with --debug and include the log here.
  • you can try to add rd.debug to dracut command line option and try to boot again.
  • you can try to preload ALL modules that is used by your computer (see lsmod)
  • you can even try to omit systemd from initramfs - as that would trigger a different code path which would help us understand the scope of the problem

LaszloGombos avatar Aug 03 '23 10:08 LaszloGombos

Tried with force_drivers+= all modules. Keybaord still not working.

Here's dracut.log with --debug.

Adding rd.debug doesn't seem to be very useful, as the screen only shows a handful of lines with no extra info than what I already posted. Since the system basically hangs without taking any input I have to force reboot, so there is no way to preserve those outputs either.

Let me try next to omit systemd.

Aetf avatar Aug 04 '23 08:08 Aetf

IMG_20230804_013501

Without systemd, still not working...

Aetf avatar Aug 04 '23 08:08 Aetf

1./ Let's stick to omitting systemd just because I am more familiar with that flow. We can later fix the systemd enabled version as well.

Can you please try the following change

diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh
index ca1df90d..e171c79f 100755
--- a/modules.d/99base/init.sh
+++ b/modules.d/99base/init.sh
@@ -107,6 +107,15 @@ fi
 
 source_conf /etc/conf.d
 
+for i in $(getargs rd.driver.pre -d rdloaddriver=); do
+    (
+        IFS=,
+        for p in $i; do
+            modprobe "$p" 2>&1 | vinfo
+        done
+    )
+done
+
 if getarg "rd.cmdline=ask"; then
     echo "Enter additional kernel command line parameter (end with ctrl-d or .)"
     while read -r -p "> " ${BASH:+-e} line || [ -n "$line" ]; do

2./ If the above does not work, can you confirm if you remove rd.cmdline=ask and replace it with rd.break then keyboard works ? This would at least confirm that the issue is NOT with initramfs generation, but with initramfs execution.

In the original report you mentioned that "Both the laptop builtin keyboard ". When you tested recently you still testing on laptop builtin keyboard or only on USB ?

3./ In an unlikely scenario, perhaps firmware is missing for USB

From the log

dracut-install: Firmware renesas_usb_fw.mem                                                                                                                                                                  
dracut-install: stat(/lib/firmware/updates/6.4.4-zen1-1-zen/renesas_usb_fw.mem) != 0                                                                                                                         
dracut-install: Possible missing firmware renesas_usb_fw.mem for kernel module xhci_pci                                                                                                                      
dracut-install: stat(/lib/firmware/updates/renesas_usb_fw.mem) != 0                                                                                                                                          
dracut-install: Possible missing firmware renesas_usb_fw.mem for kernel module xhci_pci                                                                                                                      
dracut-install: stat(/lib/firmware/6.4.4-zen1-1-zen/renesas_usb_fw.mem) != 0                                                                                                                                 
dracut-install: Possible missing firmware renesas_usb_fw.mem for kernel module xhci_pci                                                                                                                      
dracut-install: stat(/lib/firmware/renesas_usb_fw.mem) != 0                                                                                                                                                  
dracut-install: Possible missing firmware renesas_usb_fw.mem for kernel module xhci_pci    

4./ FYI

force_drivers+= all

I might be wrong, but I do not think dracut supports this feature with this syntax (unless you meant manually listing all the modules ).. There are some out of tree dracut modules trying to implement this - https://github.com/DragoonAethis/dracut-force-add-loaded-modules

LaszloGombos avatar Aug 04 '23 20:08 LaszloGombos

In the original report you mentioned that "Both the laptop builtin keyboard ". When you tested recently you still testing on laptop builtin keyboard or only on USB ?

I haven't tried builtin keyboard recently, since my laptop is connected to a dock and closed all the time. I'll remember to try it next.

I might be wrong, but I do not think dracut supports this feature with this syntax (unless you meant manually listing all the modules )..

Yeah I meant manually listing all modules. (Well probably not all as in lsmod, I created a list of modules needed by my hardware by find /sys -name modalias and resolve the alias to modules and included all those)

Aetf avatar Aug 05 '23 02:08 Aetf