[PATCH] HID USB keyboards not working in initramfs

Bug #1412077 reported by legolas558
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
initramfs-tools (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

This bug might either be in the kernel extra package or initramfs-tools, can't decide.

I have tested all following version of the kernel:

- linux-image-3.13.0-35-generic
- linux-image-3.13.0-36-generic
- linux-image-3.13.0-37-generic
- linux-image-3.13.0-39-generic
- linux-image-3.13.0-40-generic
- linux-image-3.13.0-41-generic
- linux-image-3.13.0-43-generic
- linux-image-3.13.0-44-generic *

In all of them (* = except latest), if the corresponding -extra package is installed then USBs keyboard *will work* (and display mode will also be set correctly, although it's a separate issue).

Otherwise, no USB keyboard will be available at all for initramfs programs.

I have narrowed down the issue to the fact that hid, hid-generic and usbhid modules are missing and thus not loaded.

Possibly related bugs:

https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/1238194
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/1066376
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/229732
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/886149
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/1054292
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/1017991

==== Update 18 January

Sorry if you received too many notifications, I have tried my best document the issue and find a solution.

This issue can be split in 3 separate issues now:

1) functions in initramfs-tools' hook-functions do not handle command failures (please merge attached patch), also for modprobe which made it very difficult to troubleshoot the other issues

2) hid modules are currently in extra but - considering the past amount of bug reports and spoilt user experience - these ought better be in the -generic package*

3) linux-image-3.13.0-44-generic doesn't sport a modules.dep that covers the -extra package (as it did in the past)

I hope this bug report will be useful to you guys.

* = if this is not advisable for the -generic package, then would be nice that update-initramfs failed or displayed a warning about USB keyboard usage when -extra is not installed, instead of silently including all those goodies when it is, as it does now

legolas558 (legolas558)
description: updated
legolas558 (legolas558)
description: updated
summary: - Logitech USB keyboard not working in initramfs
+ USB keyboard not working in initramfs (hid issue)
Revision history for this message
legolas558 (legolas558) wrote : Re: USB keyboard not working in initramfs (hid issue)

I tried adding these modules:

ehci_pci
usbcore
usb_common
xhci_hcd
uhci_hcd
ehci_hcd
ohci_hcd
usbhid

Same result.

Would it be possible to have verbose errors output when initramfs-tools fails at loading some module? Silent failure is evil.

legolas558 (legolas558)
description: updated
description: updated
description: updated
Revision history for this message
legolas558 (legolas558) wrote :

I am now trying compiling my own kernel with CONFIG_HID_GENERIC=y

description: updated
Revision history for this message
legolas558 (legolas558) wrote :

I have been able to load hid modules in .36, it was a problem in my build hook script

description: updated
description: updated
Revision history for this message
legolas558 (legolas558) wrote :

I've found out that when the -extra package is installed for that kernel, the hid modules are correctly loaded! So it's not a dependency but it is necessary.

Furthermore, the video mode is not set correctly when -extra is missing.

description: updated
Revision history for this message
legolas558 (legolas558) wrote :

For some reason (probably invalid modprobe usage in initramfs-tools hook-functions) when you are building an initramfs image it does not give an error about the missing hid modules (even if you require to load them in such image). But installing -extra fixes this.

legolas558 (legolas558)
description: updated
summary: - USB keyboard not working in initramfs (hid issue)
+ HID USB keyboards not working in initramfs
legolas558 (legolas558)
description: updated
legolas558 (legolas558)
description: updated
Revision history for this message
legolas558 (legolas558) wrote : Re: HID USB keyboards not working in initramfs

By comparing -43 and -44, I noticed that no hid modules are present at all in the initramfs generated for -44 kernel.

Several other module directories are completely missing, although the kernel configurations are the same.

Is it possible that the correct generation of the initramfs depends on the kernel running when generating it?

Revision history for this message
legolas558 (legolas558) wrote :

First proposed patch: show modprobe's error message when there is a failure at querying for a module in manual_add_modules() and return proper exit code on failures.

This would make current functions less hacky and more deterministic.

summary: - HID USB keyboards not working in initramfs
+ [PATCH] HID USB keyboards not working in initramfs
Revision history for this message
legolas558 (legolas558) wrote :

I think I have found the root cause of this bug: /lib/modules/3.13.0-44-generic/modules.dep (and its .bin counterpart) are wrong and don't include the -extra modules.

You can easily verify diff with a diff from -43-generic modules.dep

In attachment the modprobe failure (ran on a -43 kernel) that documents this problem.

legolas558 (legolas558)
description: updated
description: updated
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "hook-functions-dont-ignore-modprobe-fails.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in initramfs-tools (Ubuntu):
status: New → Confirmed
Revision history for this message
Benjamin Drung (bdrung) wrote :

initramfs-tools 0.142ubuntu11 in Ubuntu 23.10 (mantic) uses dracut-install in manual_add_modules to speed up mkinitramfs (see #2031185). So the initramfs-tools patch for manual_add_modules is obsolete.

I am marking this bug as done for initramfs-tools since point 2 and 3 from the bug description are about the kernel, not initramfs-tools.

Changed in initramfs-tools (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.