Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keyboard not initialize before rd.cmdline=ask prompt #728

Open
Neurognostic opened this issue Feb 19, 2020 · 19 comments
Open

Keyboard not initialize before rd.cmdline=ask prompt #728

Neurognostic opened this issue Feb 19, 2020 · 19 comments
Labels

Comments

@Neurognostic
Copy link
Contributor

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
Copy link
Contributor Author

Neurognostic commented Feb 20, 2020

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?

@haraldh
Copy link
Collaborator

haraldh commented Mar 6, 2020

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

@haraldh
Copy link
Collaborator

haraldh commented Mar 6, 2020

Just try it with a Fedora VM

@mwberry
Copy link
Contributor

mwberry commented May 31, 2020

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.

@stale
Copy link

stale bot commented Dec 16, 2020

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 stale bot added the stale communication is stuck label Dec 16, 2020
@Aetf
Copy link

Aetf commented Dec 16, 2020

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

@stale stale bot removed the stale communication is stuck label Dec 16, 2020
@stale
Copy link

stale bot commented Jan 15, 2021

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 stale bot added the stale communication is stuck label Jan 15, 2021
@Aetf
Copy link

Aetf commented Jan 15, 2021

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

@stale stale bot removed the stale communication is stuck label Jan 15, 2021
@stale
Copy link

stale bot commented Feb 14, 2021

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 stale bot added stale communication is stuck and removed stale communication is stuck labels Feb 14, 2021
@Aetf
Copy link

Aetf commented Feb 15, 2021

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

@johannbg johannbg added the bug Our bugs label Feb 15, 2021
@johannbg
Copy link
Collaborator

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

@Neurognostic
Copy link
Contributor Author

Neurognostic commented Dec 31, 2022

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?

@LaszloGombos
Copy link
Collaborator

LaszloGombos commented Aug 1, 2023

"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 6ae68b4

@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.

@Aetf
Copy link

Aetf commented Aug 3, 2023

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?

@LaszloGombos
Copy link
Collaborator

LaszloGombos commented Aug 3, 2023

@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

@Aetf
Copy link

Aetf commented Aug 4, 2023

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
Copy link

Aetf commented Aug 4, 2023

IMG_20230804_013501

Without systemd, still not working...

@LaszloGombos
Copy link
Collaborator

LaszloGombos commented Aug 4, 2023

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

@Aetf
Copy link

Aetf commented Aug 5, 2023

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants