FS#33135 - [mkinitcpio] usbinput hook does not add "hid_generic" and "usbhid" module under some circumstances

Attached to Project: Arch Linux
Opened by Andreas (Evilandi666) - Wednesday, 19 December 2012, 18:23 GMT
Last edited by Dave Reisner (falconindy) - Wednesday, 19 December 2012, 19:07 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To No-one
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
After I updated mkinitcpio to 0.12.0 I noticed a bug on two of my machines: the usb keyboard does not work anymore when the kernel is loading. Both machines need a password to boot, because root is encrypted.
Normally, I do not need usb keyboard to work, because both are headless machines, but in some situations I need it, so I put support for it in initramfs via the usbinit hook (and plug the keyboard only in if I need it, normally I access them via SSH).
But the combination of modconf and usbinput hook changed this: two modules are missing in initramfs when there is no usb keyboard plugged in while using mkinitcpio to generate initramfs image. ("hid_generic" and "usbhid" modules are missing in the image).
It works fine when I plug in my usb keyboard while generating initramfs.

Workaround: put
MODULES="hid_generic usbhid"
in /etc/mkinitcpio.conf.

I merged all .pacnews!
This worked before the "block"/"modconf" change was introduced, "usb"+"usbinput" somehow always included both modules, whether a usb keyboard was plugged in while generating initramfs or not.

Additional info:
mkinitcpio 0.12.0-2

Steps to reproduce:
- Boot a machine with encrypted rootfs
- Unplug USB keyboard (and maybe all other usb devices)
- Connect via SSH
- mkinitcpio -p linux (usbinput and modconf hook added to /etc/mkinitcpio.conf)
- Reboot to passphrase prompt
- Plugin your usb keyboard
- Keyboard does not work.
This task depends upon

Closed by  Dave Reisner (falconindy)
Wednesday, 19 December 2012, 19:07 GMT
Reason for closing:  Not a bug
Additional comments about closing:  autodetect only detects what's available. It isn't psychic.
Comment by Dave Reisner (falconindy) - Wednesday, 19 December 2012, 18:30 GMT
If the combination of modconf and usbinput causes this to break, then what exactly do you have in your modprobe configuration?

edit: this works just fine for me, btw. See attached.
   imgdump (1.4 KiB)
Comment by Andreas (Evilandi666) - Wednesday, 19 December 2012, 18:52 GMT
I think there is nothing special in my modprobe config ..

On one of the two machines I only have one file in /etc/modprobe.d/ with

/etc/modprobe.d/remote_blacklist.conf:
# For some reason udev loads the wrong kernel module for the X10 radio remote, so blacklist it
blacklist ati_remote

in it. I don't know if modules-load.d is important, there are only three files in it which load some modules - none of them related to usb things.

The other machine has two files in /etc/modprobe.d/:

/etc/modprobe.d/modprobe.conf:
options iwlwifi led_mode=1
options iwlagn 11n_disable=1
options i915 i915_enable_rc6=1
options i915 i915_enable_fbc=1
options i915 lvds_downclock=1
blacklist pcspkr

/etc/modprobe.d/alsa-base.conf:
options snd-hda-intel model=thinkpad

/etc/modules-load.d is same as above.

I don't think that this is related to some of the config above, I just think (without looking at the code), that usb added these modules somehow automatically and modconf just probes for them (and if there is no usb keyboard, those modules won't be added). I thought that the task of usbinput is to add those modules, no depending on what is plugged in, but it seems that this does not work.

Maybe that helps:
These are the mkinitcpio.conf hooks I use:
HOOKS="base udev autodetect net modconf block usbinput keymap dropbear encryptssh lvm2 filesystems fsck"

I tried also:
HOOKS="base udev autodetect net modconf block usbinput keymap encrypt lvm2 filesystems fsck"
Comment by Dave Reisner (falconindy) - Wednesday, 19 December 2012, 18:58 GMT
> modconf just probes for them (and if there is no usb keyboard, those modules won't be added).
modconf's sole purpose is to add modprobe configuration files. It's entirely passive. There's no "probing" going on.

Does mkinitcpio -M show the modules you expect to exist?

What's particularly odd about your bug report is that usbhid is _always_ loaded with the usbinput hook. Claiming that it isn't loaded means you've got a problem elsewhere -- perhaps you have corrupted module indicies.
Comment by Andreas (Evilandi666) - Wednesday, 19 December 2012, 19:01 GMT
I didn't know lsinitcpio .. that helps a lot.

See log.txt, first lsinitscpio is with MODULES="i915 hid_generic usbhid", second is with MODULES="i915".

Thx to lsinitcpio I think I was wrong: it is only hid_generic which is missing. Sorry for that.

Is my bug report now obsolete, or should usbinput add hid_generic?

I think the problem is clear:
-> No keyboard plugged in -> no hid_generic is added by modconf, usbinput does not add it
-> No keyboard at boot-passphrase-prompt.

Don't know if it is only my keyboard which needs hid_generic.
   log.txt (8.1 KiB)
Comment by Andreas (Evilandi666) - Wednesday, 19 December 2012, 19:05 GMT
Why do you have hid_generic in your imgdump? Some PS2/USB Keyboard plugged in?
Comment by Dave Reisner (falconindy) - Wednesday, 19 December 2012, 19:07 GMT
Again, modconf doesn't add any modules. Look at the hook. All it does is add configuration files from /etc/modprobe.d and /lib/modprobe.d.

If no devices which use hid-generic are plugged in at the time that mkinitcpio runs, the autodetect hook cannot possibly whitelist this module because it isn't in use. If you cannot guarantee that this is always the case, then it's probably most correct to add hid-generic to your config via MODULES=.

Closing, this is working as intended.

Loading...