Skip to contentSkip to conversation

(dracut) hwdb needed in early boot for some keyboards

PATCH In review Colin Guthrie 6 participants 16 messages Nov 12, 2013 – Nov 14, 2013 10 messages not in the archive

lore
Share & tools
lore
#0 lore raw

cover (dracut) hwdb needed in early boot for some keyboards

Hi,

In this bug report https://bugs.mageia.org/show_bug.cgi?id=11645 a user is unable to enter their encrypted root password via a wireless keyboard connected with a Logitech, Inc. Unifying Receiver.

This information has moved from a 95-keymap.rules in the olden days to the hwdb infrastructure (I think the 95-keymap.rules was upstream and not something we did downstream)

In order to get this working I have to include the hwdb.bin generated from the 20-usb-vendor-model.hwdb file.

The attached patch series adds this infrastructure to dracut, but it has the side effect of adding 1.5Mb to the initrd. The pre-processed hwdb file itself is around 1Mb. I suspect there is a lot of unneeded info in this file, so perhaps it can be split out into separate files and only include keyboard related bits in one of them?

There may also be other hwdb files needed for keyboards so please advise if others should be added by default to dracut (60-keyboard.hwdb seems a likely candidate)

If anyone has any other suggestions and also any idea how to make the hwdb.bin file any smaller for the initrd that would be great too.

Cheers

Col

Colin Guthrie (2):
Provide infrastructure to include udev hwdb files. Include support for Logitec, Inc. Unifying Reveiver keyboard

 dracut-functions.sh                    | 29 +++++++++++++++++++++++++++++
 dracut.sh                              |  3 +++
 modules.d/95udev-rules/module-setup.sh |  3 +++
 3 files changed, 35 insertions(+)
Signature · 1 line
1.8.4.2

A message that is not in the archive (sent off-list or not yet received): 1384249140-20683-1-git-send-email-colin-odJJhXpcy38dnm+yROfE0A@public.gmane.org

#2 lore raw

PATCH 1/2 Provide infrastructure to include udev hwdb files.

This is needed to provide keyboard support for some models of keyboard which have now been converted over to the new format.

---
 dracut-functions.sh | 29 +++++++++++++++++++++++++++++
 dracut.sh           |  3 +++
 2 files changed, 32 insertions(+)
dracut-functions.sh +29 -0
index 2872516..6ca6444 100755
@@ -926,6 +926,35 @@ prepare_udev_rules() {
     done
 }
 
+# udev hwdb files always get installed in the same place, so
+# create a function to install them to make life simpler.
+inst_hwdb() {
+    local _target=/etc/udev/hwdb.d _hwdb _found
+
+    #inst_dir "${udevdir}/hwdb.d"
+    #inst_dir "$_target"
+    for _hwdb in "$@"; do
+        if [ "${_hwdb#/}" = "$_hwdb" ]; then
+            for r in ${udevdir}/hwdb.d ${hostonly:+/etc/udev/hwdb.d}; do
+                if [[ -e $r/$_hwdb ]]; then
+                    _found="$r/$_hwdb"
+                    inst_simple "$_found"
+                fi
+            done
+        fi
+        [[ $_found ]] || dinfo "Skipping udev hwdb: $_hwdb"
+    done
+}
+
+consolidate_hwdb() {
+    if [[ -d "${initdir}/etc/udev/hwdb.d" || -d "${initdir}/${udevdir}/hwdb.d" ]]; then
+        dinfo "*** Consolidating udev hwdb ***"
+        udevadm hwdb --root="${initdir}" --update
+        rm -rf "${initdir}/etc/udev/hwdb.d" "${initdir}/${udevdir}/hwdb.d"
+    fi
+}
+
+
 # install function specialized for hooks
 # $1 = type of hook, $2 = hook priority (lower runs first), $3 = hook
 # All hooks should be POSIX/SuS compliant, they will be sourced by init.
dracut.sh +3 -0
index 03472ba..9711907 100755
@@ -1370,6 +1370,9 @@ if [[ $acpi_override = yes ]] && [[ -d $acpi_table_dir ]]; then
 fi
 
 rm -f -- "$outfile"
+
+consolidate_hwdb
+
 dinfo "*** Creating image file ***"
 if [[ $create_early_cpio = yes ]]; then
     # The microcode blob is _before_ the initramfs blob, not after
Signature · 1 line
1.8.4.2
#3 lore raw

PATCH 2/2 Include support for Logitec, Inc. Unifying Reveiver keyboard

In reply to a message not in the archive
---
 modules.d/95udev-rules/module-setup.sh | 3 +++
 1 file changed, 3 insertions(+)
modules.d/95udev-rules/module-setup.sh +3 -0
index 88c3da2..f4498b3 100755
@@ -36,6 +36,9 @@ install() {
         "$moddir/59-persistent-storage.rules" \
         "$moddir/61-persistent-storage.rules"
 
+    # Needed for some keyboards e.g. "Logitech, Inc. Unifying Receiver"
+    inst_hwdb 20-usb-vendor-model.hwdb
+
     prepare_udev_rules 59-persistent-storage.rules 61-persistent-storage.rules
     # debian udev rules
     inst_rules 91-permissions.rules
Signature · 1 line
1.8.4.2
#4 lore raw
In reply to a message not in the archive
Quoted 5 lines · Colin Guthrie

Hi,

In this bug report https://bugs.mageia.org/show_bug.cgi?id=11645 a user is unable to enter their encrypted root password via a wireless keyboard connected with a Logitech, Inc. Unifying Receiver.

Just in case, I do have the same model of wireless keyboard and will validate the bug (for the LUKS-password case) later today on my laptop.

The keyboard does work on my desktop, but there's no initramfs there.

Signature · 1 line
Alexander E. Patrakov

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

2013/11/13 Alexander E. Patrakov <[email protected]>:

Quoted 9 lines
Quoted 6 lines · Colin Guthrie

Hi,

In this bug report https://bugs.mageia.org/show_bug.cgi?id=11645 a user is unable to enter their encrypted root password via a wireless keyboard connected with a Logitech, Inc. Unifying Receiver.

Quoted 4 lines

Just in case, I do have the same model of wireless keyboard and will validate the bug (for the LUKS-password case) later today on my laptop.

The keyboard does work on my desktop, but there's no initramfs there.

I hereby confirm that the wireless Logitech keyboard works for entering the LUKS password on the laptop, if one does not create a host-only initramfs. This is with dracut-031.

Some relevant kernel config bits:

CONFIG_HID=y
CONFIG_HID_GENERIC=y
CONFIG_HID_LOGITECH=y
CONFIG_HID_LOGITECH_DJ=m # dracut is smart enough to include it,
even though the password entry works well without it

CONFIG_USB_HID=m

CONFIG_USB_XHCI_HCD=m
CONFIG_USB_EHCI_HCD=m
CONFIG_USB_EHCI_PCI=m

Signature · 1 line
Alexander E. Patrakov

A message that is not in the archive (sent off-list or not yet received): CAN_LGv2h3jYopc4xBn+206MpdoeEzB6Hy3iBqPw4eqvcuOPQ-A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#8 lore raw

'Twas brillig, and Alexander E. Patrakov at 13/11/13 16:49 did gyre and gimble:

Quoted 10 lines

2013/11/13 Alexander E. Patrakov <[email protected]>:

Quoted 9 lines
Quoted 6 lines · Colin Guthrie

Hi,

In this bug report https://bugs.mageia.org/show_bug.cgi?id=11645 a user is unable to enter their encrypted root password via a wireless keyboard connected with a Logitech, Inc. Unifying Receiver.

Quoted 8 lines
Quoted 4 lines

Just in case, I do have the same model of wireless keyboard and will validate the bug (for the LUKS-password case) later today on my laptop.

The keyboard does work on my desktop, but there's no initramfs there.

I hereby confirm that the wireless Logitech keyboard works for entering the LUKS password on the laptop, if one does not create a host-only initramfs. This is with dracut-031.

thanks for that. If it's easy enough for you to test, does it also work with a host-only initrd?

Col

Signature · 10 lines
Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/
#9 lore raw

2013/11/13 Colin Guthrie <[email protected]>:

Quoted 17 lines

'Twas brillig, and Alexander E. Patrakov at 13/11/13 16:49 did gyre and gimble:

Quoted 15 lines

2013/11/13 Alexander E. Patrakov <[email protected]>:

Quoted 13 lines
Quoted 6 lines · Colin Guthrie

Hi,

In this bug report https://bugs.mageia.org/show_bug.cgi?id=11645 a user is unable to enter their encrypted root password via a wireless keyboard connected with a Logitech, Inc. Unifying Receiver.

Just in case, I do have the same model of wireless keyboard and will validate the bug (for the LUKS-password case) later today on my laptop.

The keyboard does work on my desktop, but there's no initramfs there.

Quoted 7 lines
Quoted 3 lines

I hereby confirm that the wireless Logitech keyboard works for entering the LUKS password on the laptop, if one does not create a host-only initramfs. This is with dracut-031.

thanks for that. If it's easy enough for you to test, does it also work with a host-only initrd?

It doesn't, because (at least whe creating the initramfs without the USB keyboard connected) it does not include the usbhid module.

Signature · 1 line
Alexander E. Patrakov

A message that is not in the archive (sent off-list or not yet received): CAN_LGv2H3pDZ+Sp6LpxkN+Ay_4LbZbR4Av1_j0B2WLO=TcxvAw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#11 lore raw

'Twas brillig, and Alexander E. Patrakov at 13/11/13 17:18 did gyre and gimble:

Quoted 23 lines

2013/11/13 Colin Guthrie <gmane-D409yXkIzt2rnn0nCzrM/[email protected]>:

Quoted 22 lines

'Twas brillig, and Alexander E. Patrakov at 13/11/13 16:49 did gyre and gimble:

Quoted 18 lines

2013/11/13 Alexander E. Patrakov <[email protected]>:

Quoted 9 lines
Quoted 6 lines · Colin Guthrie

Hi,

In this bug report https://bugs.mageia.org/show_bug.cgi?id=11645 a user is unable to enter their encrypted root password via a wireless keyboard connected with a Logitech, Inc. Unifying Receiver.

Quoted 4 lines

Just in case, I do have the same model of wireless keyboard and will validate the bug (for the LUKS-password case) later today on my laptop.

The keyboard does work on my desktop, but there's no initramfs there.

I hereby confirm that the wireless Logitech keyboard works for entering the LUKS password on the laptop, if one does not create a host-only initramfs. This is with dracut-031.

Quoted 5 lines
Quoted 2 lines

thanks for that. If it's easy enough for you to test, does it also work with a host-only initrd?

It doesn't, because (at least whe creating the initramfs without the USB keyboard connected) it does not include the usbhid module.

What about if you generate it with the keyboard plugged in? It should include the usbhid module then, but does it actually work?

The problem we're encountering is that even with the usbhid module included in the host-only initrd, it still doesn't work - even after manually modprobing it from a ps/2 keyboard.

As I don't have the h/w I cannot tell what component is missing to make it all work. I'm currently suspecting some kind of usb host controller interface driver or something, but have yet to hear back from the user so any insights or info you have would be appreciated.

Col

Signature · 10 lines
Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/

A message that is not in the archive (sent off-list or not yet received): 5283B76B.8070902-D409yXkIzt2rnn0nCzrM/[email protected]

#13 lore raw

2013/11/13 Colin Guthrie <gmane-D409yXkIzt2rnn0nCzrM/[email protected]>:

Quoted 2 lines

What about if you generate it with the keyboard plugged in? It should include the usbhid module then, but does it actually work?

Will try a bit later, but I suspect this is the wrong direction of thought.

Quoted 3 lines

The problem we're encountering is that even with the usbhid module included in the host-only initrd, it still doesn't work - even after manually modprobing it from a ps/2 keyboard.

All modules that are needed for the user's keyboard are included in the initrd.

Quoted 4 lines

As I don't have the h/w I cannot tell what component is missing to make it all work. I'm currently suspecting some kind of usb host controller interface driver or something, but have yet to hear back from the user so any insights or info you have would be appreciated.

I'd suspect something related to USB power saving. This is the most frequent reason for USB keyboards and mice to misbehave - the host just turns them off mistakenly. So /lib/udev/rules.d/42-usb-hid-pm.rules does look relevant.

Signature · 1 line
Alexander E. Patrakov
#14 lore raw

2013/11/13 Alexander E. Patrakov <[email protected]>:

Quoted 5 lines

2013/11/13 Colin Guthrie <[email protected]>:

Quoted 2 lines

What about if you generate it with the keyboard plugged in? It should include the usbhid module then, but does it actually work?

Will try a bit later, but I suspect this is the wrong direction of thought.

A host-only initramfs generated with the USB keyboard plugged in works.

Signature · 1 line
Alexander E. Patrakov

A message that is not in the archive (sent off-list or not yet received): CAN_LGv08+8fmvqdz2afiuuET2cJLC9diGDMn6mtc904rdJGMog-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#16 lore raw

'Twas brillig, and Alexander E. Patrakov at 13/11/13 17:55 did gyre and gimble:

Quoted 8 lines

2013/11/13 Alexander E. Patrakov <[email protected]>:

Quoted 5 lines

2013/11/13 Colin Guthrie <gmane-D409yXkIzt2rnn0nCzrM/[email protected]>:

Quoted 2 lines

What about if you generate it with the keyboard plugged in? It should include the usbhid module then, but does it actually work?

Will try a bit later, but I suspect this is the wrong direction of thought.

A host-only initramfs generated with the USB keyboard plugged in works.

OK, thanks for that. Will have to investigate with my user as to whether this is a new problem in a more recent kernel (e.g. with module splits etc) or something else.

What kernel are you using out of interest?

Col

Signature · 10 lines
Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/

A message that is not in the archive (sent off-list or not yet received): 5283C886.10300-D409yXkIzt2rnn0nCzrM/[email protected]

#18 lore raw

2013/11/14 Colin Guthrie <gmane-D409yXkIzt2rnn0nCzrM/[email protected]>:

Quoted 1 line

What kernel are you using out of interest?

This kernel is a git snapshot between 3.12.0-rc2 and -rc3. Compiled on Gentoo.

Signature · 1 line
Alexander E. Patrakov

A message that is not in the archive (sent off-list or not yet received): CAN_LGv18zK37_35F23XG7SkhEMMat0VVOxv3yoNMXzG4nUCZNg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#20 lore raw

'Twas brillig, and Alexander E. Patrakov at 13/11/13 19:02 did gyre and gimble:

Quoted 4 lines

2013/11/14 Colin Guthrie <gmane-D409yXkIzt2rnn0nCzrM/[email protected]>:

Quoted 1 line

What kernel are you using out of interest?

This kernel is a git snapshot between 3.12.0-rc2 and -rc3. Compiled on Gentoo.

Thanks for that.

After trying harder, it seems my initial suspicion on the bug report was correct after all and a missing host controller driver is the culprit.

For reference dracut is not including ohci-pci which I presume has been split out recently and thus needs to be added explicitly.

Alexander's tests perhaps used a different type of USB host controller.

Will send a dracut patch shortly and sorry for the noise.

Col

Signature · 10 lines
Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/

A message that is not in the archive (sent off-list or not yet received): 52848565.6020303-D409yXkIzt2rnn0nCzrM/[email protected]

#22 lore raw
Quoted 12 lines · Colin Guthrie

'Twas brillig, and Alexander E. Patrakov at 13/11/13 19:02 did gyre and gimble:

Quoted 4 lines

2013/11/14 Colin Guthrie <gmane-D409yXkIzt2rnn0nCzrM/[email protected]>:

Quoted 1 line

What kernel are you using out of interest?

This kernel is a git snapshot between 3.12.0-rc2 and -rc3. Compiled on Gentoo.

Thanks for that.

After trying harder, it seems my initial suspicion on the bug report was correct after all and a missing host controller driver is the culprit.

Quoted 8 lines

For reference dracut is not including ohci-pci which I presume has been split out recently and thus needs to be added explicitly.

Alexander's tests perhaps used a different type of USB host controller.

Will send a dracut patch shortly and sorry for the noise.

Col

http://git.kernel.org/cgit/boot/dracut/dracut.git/commit/?id=28609baf6e9581ea97c4550340e2a6031c1b6fbd

#23 lore raw
In reply to Colin Guthrie
Quoted 3 lines · Colin Guthrie

In this bug report https://bugs.mageia.org/show_bug.cgi?id=11645 a user is unable to enter their encrypted root password via a wireless keyboard connected with a Logitech, Inc. Unifying Receiver.

This sounds weird. Why exactly is this needed. The hwdb should be non-essential information only, and not be needed for basic operations or in the initrd.

If the basics of the keyboard aren't working properly, it might need a kernel fix.

Kay

A message that is not in the archive (sent off-list or not yet received): CAPXgP13EujKcEgsc_1N-_VbsYOdOw2jLZHHaxiRWQv1tL1ECcA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#25 lore raw

'Twas brillig, and Kay Sievers at 12/11/13 11:28 did gyre and gimble:

Quoted 11 lines · Colin Guthrie
Quoted 3 lines

In this bug report https://bugs.mageia.org/show_bug.cgi?id=11645 a user is unable to enter their encrypted root password via a wireless keyboard connected with a Logitech, Inc. Unifying Receiver.

This sounds weird. Why exactly is this needed. The hwdb should be non-essential information only, and not be needed for basic operations or in the initrd.

If the basics of the keyboard aren't working properly, it might need a kernel fix.

Hmmm, OK I perhaps jumped the gun a bit on this one - lemme check with the user first then to see if there is something else I'm missing.

Ultimately it seems that the usb hid module is not loaded in the initrd but works fine later on. I initially presumed that host driver was not included but it seems from feedback this is OK, but I'll probe deeper before bugging you guys again :)

Cheers

Col

Signature · 10 lines
Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/