FS#12867 - [mkinitcpio] kernel26-2.6.28 (.1) doesn't recognize USB keyboard at boot when using luks-encryption
Attached to Project:
Arch Linux
Opened by lobotomisator (lobotomisator) - Tuesday, 20 January 2009, 14:46 GMT
Last edited by Thomas Bächler (brain0) - Sunday, 07 June 2009, 12:12 GMT
Opened by lobotomisator (lobotomisator) - Tuesday, 20 January 2009, 14:46 GMT
Last edited by Thomas Bächler (brain0) - Sunday, 07 June 2009, 12:12 GMT
|
Details
Description:
When booting the 28 or 28.1 kernel with root encryption the USB keyboard is not recognized at password requestion. So one is unable to enter the password and a hard reset is needed (MagicSysRq is not working either). Unplugging and plugging the keyboard in again brings those messages: hub 3-2:1.0: unable to enumerate USB device on port 3 hub 3-2:1.0: Cannot enable port 3. Maybe the USB cable is bad? My mkinitcpio.conf has the following line: HOOKS="base udev autodetect pata scsi sata usbinput keymap encrypt filesystems" Affected versions: kernel26-2.6.28 and kernel26-2.6.28.1 Steps to reproduce: 1. install root encryption 2. update to 2.6.28+ kernel 3. get stuck In the german archlinux board a developer found a possible workaround (http://forum.archlinux.de/?page=Postings;id=20;thread=11170) MODULES="... hid usbhid usbcore uhci_hcd ehci_hcd ..." PS/2 keyboards are not affected. |
This task depends upon
Closed by Thomas Bächler (brain0)
Sunday, 07 June 2009, 12:12 GMT
Reason for closing: Fixed
Additional comments about closing: This should be fixed in mkinitcpio git, entering testing soon.
Sunday, 07 June 2009, 12:12 GMT
Reason for closing: Fixed
Additional comments about closing: This should be fixed in mkinitcpio git, entering testing soon.
Using my laptop with an USB keyboard i could use this during cups menu, but not on crypt-Hook passphrase input.
Using instead my laptop keyboard i could unlock the crypt partitions, boot goes on and after that i could use also the usb keyboard to login on tty-console.
Seems that the usb/usbinput hooks not load the necessary modules. (I found the workaraound above). But loading only hid and usbhid in MODULES is not enough, only with usbcore (this should normally be loaded during mkinitcpio -M) and the uhci/ehci modules this workaround works.
Temporary workaround seems to be to either load the modules mentioned in the bug report or to attach the keyboard with an USB-to-PS/2 adapter.
From what I can see, all the necessary modules should be added by the usbinput hook and loaded by udev at runtime. What confuses me is the order of modules here: "uhci_hcd ehci_hcd" - in recent versions of filesystem and mkinitcpio, we ensured that ehci is always loaded before uhci (which is apparently required from the kernel end). Does it still work when you change the order in your MODULES line to load ehci first?
BTW: The workaround with enhancing the MODULES seems to not to work for me. My MODULES were so far:
MODULES="pata_acpi ahci pata_jmicron ata_generic scsi_mod ata_piix"
Adding those for the workaround didn't change here anything.
Oh, I'm using x86_64, too, (I forgot that to mention)
EDIT: It's the autodetect hook, mkinitcpio -M does not list uhci or ohci here either.
EDIT2: And I know how to fix the problem now, expect a new mkinitcpio package tomorrow.
filelist.bad is with this settings in mkinitcpio.conf (my normal settings):
MODULES="ata_generic ata_piix nls_cp437 vfat"
HOOKS="base udev autodetect usb usbinput pata keymap encrypt filesystems"
filelist.work This work with a USB keyboard i use for this tests.
MODULES="ata_generic ata_piix nls_cp437 vfat hid usbhid usbcore uhci_hcd ehci_hcd"
HOOKS="base udev autodetect usb usbinput pata keymap encrypt filesystems"
Diffing the filelists i got these:
--- filelist.bad 2009-01-21 00:30:08.000000000 +0100
+++ filelist.work 2009-01-21 00:24:25.000000000 +0100
@@ -15,6 +15,16 @@
/lib/modules/2.6.28-ARCH/kernel/fs/fat
/lib/modules/2.6.28-ARCH/kernel/fs/fat/fat.ko
/lib/modules/2.6.28-ARCH/kernel/fs/fat/vfat.ko
+/lib/modules/2.6.28-ARCH/kernel/drivers/hid
+/lib/modules/2.6.28-ARCH/kernel/drivers/hid/hid.ko
+/lib/modules/2.6.28-ARCH/kernel/drivers/usb
+/lib/modules/2.6.28-ARCH/kernel/drivers/usb/core
+/lib/modules/2.6.28-ARCH/kernel/drivers/usb/core/usbcore.ko
+/lib/modules/2.6.28-ARCH/kernel/drivers/hid/usbhid
+/lib/modules/2.6.28-ARCH/kernel/drivers/hid/usbhid/usbhid.ko
+/lib/modules/2.6.28-ARCH/kernel/drivers/usb/host
+/lib/modules/2.6.28-ARCH/kernel/drivers/usb/host/uhci-hcd.ko
+/lib/modules/2.6.28-ARCH/kernel/drivers/usb/host/ehci-hcd.ko
/etc
/etc/udev
Exactly the needed modules are not in the not-working kernel26.img.
And cause no usb module (also usbcore is not included from usb/usbinput hook) i see that i could also not access my usb-stick during initrd phase (encrypt).
filelist.work (7.6 KiB)
bsdtar -tf /boot/kernel26.img
Please test
With the patch mkinitcpio -M now detects uhci_hcd, usbcore and usbhid (i only checked these before i above sayed: fixed)
But the usb/usbinput hooks don't add these detected modules to the generated initrd image!
So i have still no (usb)keyboard when i have to enter the passphrase. But it seems that there is on my side only a probelm with usb 1.1 hsot controllers.
On my desktop pc USB 2.0 (normally i don't need usb keyboard support during initrd) all wen't fine - also without the patch.
Activating usbinput hook i have all needed modudles in initrd image.
Is the usb entry in HOOKS required? I only have usbinput there.
Or is it a problem, that I compile the kernel while chrooted from GRML64? (Don't have a PS/2 keyboard here for testing.)
I've modified /lib/initcpio/install/usbinput to get some debug values.
usbinput hook:
install ()
{
MOD=" $(checked_modules "/usb/host" ) "
echo $MOD > /tmp/usbinput
MODULES=" $(checked_modules "/usb/host" | grep -ve "_cs" -e "sl1811-hcd" -e
MODULES=$(echo ${MODULES}) #trim whitespace
if [ -n "${MODULES}" ]; then
MODULES="${MODULES} usbhid"
echo "with hid!"
echo $MODULES > /tmp/usbinput-hid
fi
BINARIES=""
FILES=""
SCRIPT=""
}
PC: USB 2.0 without patch (USB Keyboard inserted)
-------------------------
HOOKS="base udev autodetect pata scsi sata keymap usbinput filesystems"
mkinitcpio -M | grep -e usb -e hcd
usblp
usbcore
ehci-hcd
mkinitcpio -g /boot/kernel26.img.test
:: Begin build
:: Parsing hook [base]
:: Parsing hook [udev]
:: Parsing hook [autodetect]
:: Parsing hook [pata]
:: Parsing hook [scsi]
:: Parsing hook [sata]
:: Parsing hook [keymap]
:: Parsing hook [usbinput]
with hid!
:: Parsing hook [filesystems]
:: Generating module dependencies
:: Generating image '/boot/kernel26.img.test'...SUCCESS
bsdtar -tf /boot/kernel26.img.test |grep usb
/etc/modprobe.d/usb-load-ehci-first
/lib/modules/2.6.28-ARCH/kernel/drivers/usb
/lib/modules/2.6.28-ARCH/kernel/drivers/usb/core
/lib/modules/2.6.28-ARCH/kernel/drivers/usb/core/usbcore.ko
/lib/modules/2.6.28-ARCH/kernel/drivers/usb/host
/lib/modules/2.6.28-ARCH/kernel/drivers/usb/host/ehci-hcd.ko
/lib/modules/2.6.28-ARCH/kernel/drivers/hid/usbhid
/lib/modules/2.6.28-ARCH/kernel/drivers/hid/usbhid/usbhid.ko
Seems all went fine with this PC. I use usbinput, so i have the
needed modules in initrd.
Doing the same without usbinput hook:
bsdtar -tf /boot/kernel26.img.test |grep usb
/etc/modprobe.d/usb-load-ehci-first
On my desktop i would say: I'm not affected from Bug
FS#12867All neccassary modules are in the initrd image.
Laptop: USB 1.1 (with USB keyboard plugged in)
=======================================
HOOKS="base udev autodetect usb usbinput pata keymap encrypt filesystems"
without Patch:
mkinitcpio -M | grep -e usb -e hcd
usbcore
mkinitcpio -g /boot/kernel26.img.test
:: Begin build
:: Parsing hook [base]
:: Parsing hook [udev]
:: Parsing hook [autodetect]
:: Parsing hook [usb]
:: Parsing hook [usbinput]
:: Parsing hook [pata]
:: Parsing hook [keymap]
:: Parsing hook [encrypt]
:: Parsing hook [filesystems]
:: Generating module dependencies
:: Generating image '/boot/kernel26.img.test'...SUCCESS
bsdtar -tf /boot/kernel26.img.test |grep usb
/etc/udev/rules.d/8-usbstick.rules
/etc/modprobe.d/usb-load-ehci-first
/hooks/usb
So without the patch no usb support in initrd, and so no usb keyboard.
with Patch:
mkinitcpio -M | grep -e usb -e hcd
uhci_hcd
usbcore
usbhid
mkinitcpio -g /boot/kernel26.img.test
:: Begin build
:: Parsing hook [base]
:: Parsing hook [udev]
:: Parsing hook [autodetect]
:: Parsing hook [usb]
:: Parsing hook [usbinput]
:: Parsing hook [pata]
:: Parsing hook [keymap]
:: Parsing hook [encrypt]
:: Parsing hook [filesystems]
:: Generating module dependencies
:: Generating image '/boot/kernel26.img.test'...SUCCESS
bsdtar -tf /boot/kernel26.img.test |grep usb
/etc/udev/rules.d/8-usbstick.rules
/etc/modprobe.d/usb-load-ehci-first
/hooks/usb
Altough that with the patch mkinitcpio autodetect the needed modules, they
don't get inserted from usb/usbinput hook in the initrd.
Seems the hooks have problem to work correctly with USB1.1 (uhci_HCD)
On this Laptop i could still not use usb keyboard to enter passphrases.
@lobotomisator: I suspected as much, your problem is deeper:
hub 3-2:1.0: unable to enumerate USB device on port 3
hub 3-2:1.0: Cannot enable port 3. Maybe the USB cable is bad?
This suggests there is a USB controller loaded, but the device cannot be added. No idea where to go from here.
EDIT: Can we get some more output from your boot screen?
I installed testing/mkinitcpio-0.5.22-1 (but had the patch even installed before) and then compiled the kernel again.
At the moment the keyboard and mouse even have no power at password requestion. Only on event triggering (pressing a button on mouse/keyboard) they have power for half a second. I don't get the "unable to enumerate" messages anymore, the usb support seems to be disabled completely. A look at dmesg shows, that usb devices are detected at line 518, but password requestion is already at line 472, I guess.
My mkinitcpio.conf is:
MODULES="pata_acpi ahci pata_jmicron ata_generic scsi_mod ata_piix"
HOOKS="base udev autodetect pata scsi sata usbinput keymap encrypt filesystems"
(respectively HOOKS="base udev autodetect pata scsi sata usb usbinput keymap encrypt filesystems", that had no effect)
$ bsdtar -tf /boot/kernel26.img | grep usb
/etc/modprobe.d/usb-load-ehci-first
/hooks/usb
Which else information could be interesting for you?
/sbin/mkinitcpio -k 2.6.28-ARCH -c /etc/mkinitcpio.conf -g /boot/kernel26.img
I also tried reinstalling the kernel26 package.
/sbin/mkinitcpio -k 2.6.28-ARCH -c /etc/mkinitcpio.conf -v > output.txt
And attach the output file here?
(I have the USB keyboard and a PS/2 keyboard plugged in at the moment)
$ for a in $(find /sys/devices/ -name modalias -exec cat {} \;); do resolve-modalias /lib/modules/2.6.28-ARCH/modules.alias $a; done
(Tried to contact you with your jabberid, but it seem to be out of date - could be easier for those debugging?)
$ . /lib/initcpio/functions
$ KERNELVERSION=2.6.28-ARCH
$ auto_modules
....
usbcore usbhid uhci_hcd usbcore
usbcore uhci_hcd usbcore
usbcore uhci_hcd usbcore
usbcore hci_usb hci_usb hci_usb hci_usb ehci_hcd usbcore
....
You should have similar output. Are you using a custom kernel or the stock kernel?
There are a few solutions, here's one:
http://dev.archlinux.org/~aaron/underscore-and-dash-crap.patch
Patching for - vs. _ makes no difference on my side (i need only uhci_hcd, which gets not included in initrd).
But maybe we should think about the reason for this report: this problem is first since 2.6.28.
Our mkinitcpio tools/functions/hooks work well before this kernel. What have changed in this version on the usb stuff that breaks our process of creating initrd images (I personally have not idea ATM).
The kernel has no bearing on whether modules are included in the ramfs.
The original solution to the usb2/usb1.1 bug was to add a special file for modprobe which would load ehci first, and that is what caused this issue.
The initial fix (use resolve-modalias) didn't fix 100% of this (- vs _ changes). So I need to know what ELSE could be broken.
mkinitcpio -v -g /boot/kernel26.img.test -> output.txt
for a in $(find /sys/devices.... -> find.txt
auto_modules -> auto-modules.txt
And this from my desktop pc(USB2.0). Here it seems that all would work right.
mkinitcpio -v |grep -e usb -e hcd -> pc-ok.txt
find.txt (0.4 KiB)
output.txt (9.5 KiB)
pc-ok.txt (0.5 KiB)
I've installed now the testing version and this works (with the dash/underscore patch).
Before i've made the changes (the resolve-modalias thing and dash/underscore) by hand and there i must have made a misktake....
So silly....
But I had a closer look on my dmesg again (see attachment) and I wondered a bit. (I don't have much knowledge about the inner processes, so that all are guessings from me, don't blame me if I say something wrong)
There are the interesting events in this order:
line 547:
device-mapper: uevent: version 1.0.3
device-mapper: ioctl: 4.14.0-ioctl (2008-04-23) initialised: dm-devel@redhat.com
=== here comes the pw request ===
line 552:
usb 4-1: new low speed USB device using uhci_hcd and address 2
usb 4-1: configuration #1 chosen from 1 choice
usbcore: registered new interface driver hiddev
input: Cypress Keypad&Remote Control as /class/input/input2
generic-usb 0003:04B4:0102.0001: input,hidraw0: USB HID v1.00 Keyboard [Cypress Keypad&Remote Control] on usb-0000:00:1a.1-1/input0
=== my remote ir usb keyboard device is detected, loaded and working (the console output also comes after the pw question) ===
line 585:
SGI XFS with ACLs, security attributes, realtime, large block/inode numbers, no debug enabled
SGI XFS Quota Management subsystem
=== pw was correct and fs is loaded here ===
line 633 & 635 (!):
input: HID 046a:0023 as /class/input/input9
cherry 0003:046A:0023.0003: input,hidraw5: USB HID v1.11 Keyboard [HID 046a:0023] on usb-0000:00:1d.0-1/input0
=== usb keyboard is loaded here first, almost after the complete boot sequence ===
Does that information sound useful for you?
Is it "bad" that the driver says "cherry" and not "generic-usb"?
I hope this brings us forward.
I forgot to say that it of course pauses before line 585 until I entered the pw.
And an addition:
If I unplug and plug in my mouse on boot it looks like that:
usb 5-2.4: USB disconnect, address 4
usb 5-2.4: new low speed USB device using uhci_hcd and address 9
usb 5-2.4: configuration #1 chosen from 1 choice
input: Razer Razer Diamondback 3G as /class/input/input7
generic-usb 0003:1532:000D.000A: input,hidraw2: USB HID v1.10 Mouse [Razer Razer Diamondback 3G] on usb-0000:00:1a.2-2.4/input0
And with my keyboard just like that:
usb 5-2.3: USB disconnect, address 3
usb 5-2.3: new low speed USB device using uhci_hcd and address 8
usb 5-2.3: configuration #1 chosen from 1 choice
=== and long long after pw entry then sometime ===
cherry 0003:046A:0023.0008: input,hidraw5: USB HID v1.11 Keyboard [HID 046a:0023] on usb-0000:00:1a.2-2.3/input0
Is there a special keyboard driver needed, which is stored on the crypted hdd and for some reason still not included in the initrd?
:)
But the final bug is not dead yet...
BTW: I can truly hardly remember that with <=2.6.27 the usb power was off for a short time on boot.
Between GRUB and password entry all usb devices go down for 2-3 seconds (good noticable e.g. at the glowing mousewheel).
I think this behaviour is new, I would have noticed when my external harddisk drives spun down on every boot in the past!
Do you have these issues too? Did you have them earlier?
About the power down, that was always the case for me (Logitech mouse that lights up red when USB is on): Up to grub, the hid boot protocol would keep them alive and they would shut down when linux loads (not the usb devices themselves though, only the hid components).
I think this bug is solved now, after we decided what's up with the hid-* modules.
i ahve a cherry keybord here and i don't need this module at all
Aaron, I'll add all those hid-* modules as auto_modules, so they will only be added if a matching keyboard is connected, or if the fallback image is built.
http://projects.archlinux.org/?p=mkinitcpio.git;a=commitdiff;h=8182def24483ea7894e0153fb56668555ebf2656
When you add this line to /lib/initcpio/install/usbinput and remove hid-cherry from your mkinitcpio.conf, hid-cherry.ko should still be added to your image (assuming the keyboard is connected to your computer while generating the image). It will always be added to your fallback image.
I do have the latest and greatest mkinitcpio 0.5.23-1 and of course I did regenerate my initramfs.
Still there is no option to use the USB Keyboard (neither normal nor fallback-image).
My modell is a Microsoft Wireless Comfort Keyboard 1.0A (shame on me).
I attached the following information:
Output of "mkinitcpio -v -p kernel26": mkinit.log
Contents of /boot/kernel26.img: kernel26cont.log
Contents of /boot/kernel26fallback.img: kernel26fallbackcont.log
kernel26cont.log (4.2 KiB)
kernel26fallbackcont.log (11.2 KiB)
Could you give us the output of lsmod on a live system? Also, perhaps try applying the patch Thomas linked above and regenerating the image?
I applied Thomas fix and regenerated my initramfs but it didn't work out which wasn't that surprising since a quick diff over the contents of the normal initramfs shows that they both contain exactly the same files.
On the other side I see the same effect as lobotomisator, the fallback-image now works and contains the hid_microsoft module.
I also attached the output of lsmod when having the keyboard plugged in via ps/2 respectively usb. Diffing the files shows that I obviously need the module hid_microsoft.
kernel26fallbackWithPatch.txt (12.4 KiB)
lsmodps2.txt (2.7 KiB)
lsmodusb.txt (2.8 KiB)
mkinitcpio.txt (0.3 KiB)
Note the only modalias supported is: hid:b0003v0000046Ap00000023
Same with the hid-microsoft module.
Looks like we don't get modalias lines for hid devices...
Interim solution: add ALL hid modules in the usbinput hook. They're 284K total. No big deal
I'm pretty confused why these modules don't get autodetected. It worked like a charm for all the previous kernel versions I used with arch. So maybe we're trying to workaround a kernel/udev-bug? On the other hand I guess Arch users aren't the only ones who tried to decrypt their HDDs with kernel 2.6.28 so there would have been a lot more fuss about it.
Striking logic, isn't it? ;)
BTW: It's impressive how fast you guys react and work on this stuff!
mkinitcpioAutodetect.txt (0.2 KiB)
My guess is that usbhid loads these modules, or something of the sort.
@Thomas: For now, lets just add all hid-* modules in the usbhid hook. This will solve the problem and adds very little overhead.