Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
udev appears slow to process Yubikey uevents
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
bryzinga
n00b
n00b


Joined: 14 May 2022
Posts: 4

PostPosted: Tue Jan 14, 2025 2:52 am    Post subject: udev appears slow to process Yubikey uevents Reply with quote

Hi there! Been a while since my last issue.

I currently am running into issues with my Yubikey 5C. Whenever I plug it into my laptop, it seems to take 15-20 for it to be usable by other applications such as KeePassXC and GPG.

Running programs such as "ykman" or "gpg --card-status" always fail to recognize the Yubikey for the first 15-20 seconds it is plugged in. When I run "pcscd -a -d -f", nothing gets output either for the first 15 seconds. But when I run "udevadm monitor", the kernel is clearly recognizing the device and populates two hidraw devices in /dev, but udev seems to be the one that takes forever to actually do anything with it (such as applying rules). I don't experience this issue when I boot a live Fedora image on my laptop or on my desktop running Arch, so I'm fairly confident this is an issue with udev and Gentoo, whether of my own misconfiguration or something else. I've done several searches with various terms, but I can't seem to find anyone else with the same problem on any Linux distro. This is really more of a convenience issue than a functional issue, since I have been accustomed to always plug in my Yubikey the second I need it, so I'm morealess peeved that it works fine elsewhere but not on my laptop.

I have pcscd added to my default runlevel and set to hotplug in the OpenRC conf file, as well as making sure that GPG was configured correctly as shown in the wiki article: https://wiki.gentoo.org/wiki/YubiKey/GPG . I also have tried installing Yubico's udev rules in /etc/udev/rules.d/: https://github.com/Yubico/libfido2/blob/main/udev/70-u2f.rules . I don't believe it's an issue with any other application either as the issue occurs in a TTY without any graphical applications running.

Something interesting I notice when monitoring udev is that when I plug in my Yubikey and immediately unplug it, udev will still register the device 15-20 seconds after it was first plugged in, then immediately de-register it:
Code:
$ udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

KERNEL[1750.604759] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2 (usb)
KERNEL[1750.608010] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0 (usb)
KERNEL[1750.609050] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006 (hid)
KERNEL[1750.609129] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22 (input)
KERNEL[1750.660302] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::numlock (leds)
KERNEL[1750.686912] change   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::numlock (leds)
KERNEL[1750.686997] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::capslock (leds)
KERNEL[1750.716978] change   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::capslock (leds)
KERNEL[1750.717052] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::scrolllock (leds)
KERNEL[1750.746933] change   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::scrolllock (leds)
KERNEL[1750.746986] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::compose (leds)
KERNEL[1750.747003] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::kana (leds)
KERNEL[1750.780243] change   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::kana (leds)
KERNEL[1750.780577] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/event15 (input)
KERNEL[1750.780886] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/hidraw/hidraw3 (hidraw)
KERNEL[1750.780962] bind     /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006 (hid)
KERNEL[1750.781014] bind     /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0 (usb)
KERNEL[1750.781640] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.1 (usb)
KERNEL[1750.782867] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.1/0003:1050:0407.0007 (hid)
KERNEL[1750.783113] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.1/usbmisc/hiddev1 (usbmisc)
KERNEL[1750.783192] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.1/0003:1050:0407.0007/hidraw/hidraw4 (hidraw)
KERNEL[1750.783254] bind     /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.1/0003:1050:0407.0007 (hid)
KERNEL[1750.783285] bind     /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.1 (usb)
KERNEL[1750.783802] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.2 (usb)
KERNEL[1750.783864] bind     /devices/pci0000:00/0000:00:14.0/usb3/3-2 (usb)
KERNEL[1751.456926] change   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::numlock (leds)
KERNEL[1751.456987] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::numlock (leds)
KERNEL[1751.483401] change   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::capslock (leds)
KERNEL[1751.483446] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::capslock (leds)
KERNEL[1751.523563] change   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::scrolllock (leds)
KERNEL[1751.523622] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::scrolllock (leds)
KERNEL[1751.523640] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::compose (leds)
KERNEL[1751.550257] change   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::kana (leds)
KERNEL[1751.550324] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::kana (leds)
KERNEL[1751.590520] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/event15 (input)
KERNEL[1751.640481] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22 (input)
KERNEL[1751.640582] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/hidraw/hidraw3 (hidraw)
KERNEL[1751.640616] unbind   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006 (hid)
KERNEL[1751.640649] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006 (hid)
KERNEL[1751.640684] unbind   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0 (usb)
KERNEL[1751.640713] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0 (usb)
KERNEL[1751.641279] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.1/usbmisc/hiddev1 (usbmisc)
KERNEL[1751.641343] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.1/0003:1050:0407.0007/hidraw/hidraw4 (hidraw)
KERNEL[1751.641369] unbind   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.1/0003:1050:0407.0007 (hid)
KERNEL[1751.641401] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.1/0003:1050:0407.0007 (hid)
KERNEL[1751.641427] unbind   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.1 (usb)
KERNEL[1751.641455] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.1 (usb)
KERNEL[1751.641487] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.2 (usb)
KERNEL[1751.642449] unbind   /devices/pci0000:00/0000:00:14.0/usb3/3-2 (usb)
KERNEL[1751.642517] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2 (usb)
UDEV  [1766.988969] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2 (usb)
UDEV  [1767.022221] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.1 (usb)
UDEV  [1767.023436] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.1/0003:1050:0407.0007 (hid)
UDEV  [1767.024198] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.1/usbmisc/hiddev1 (usbmisc)
UDEV  [1767.026374] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.1/0003:1050:0407.0007/hidraw/hidraw4 (hidraw)
UDEV  [1767.027098] bind     /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.1/0003:1050:0407.0007 (hid)
UDEV  [1767.027946] bind     /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.1 (usb)
UDEV  [1767.222183] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0 (usb)
UDEV  [1767.222596] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006 (hid)
UDEV  [1767.223048] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22 (input)
UDEV  [1767.224911] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/hidraw/hidraw3 (hidraw)
UDEV  [1767.225127] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::numlock (leds)
UDEV  [1767.225160] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::capslock (leds)
UDEV  [1767.225193] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/event15 (input)
UDEV  [1767.225851] change   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::capslock (leds)
UDEV  [1767.226130] change   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::numlock (leds)
UDEV  [1767.226470] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::kana (leds)
UDEV  [1767.226807] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::scrolllock (leds)
UDEV  [1767.227255] change   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::kana (leds)
UDEV  [1767.227293] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::compose (leds)
UDEV  [1767.227887] change   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::scrolllock (leds)
UDEV  [1767.228522] bind     /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006 (hid)
UDEV  [1767.229175] bind     /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0 (usb)
UDEV  [1767.404524] add      /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.2 (usb)
UDEV  [1767.405330] bind     /devices/pci0000:00/0000:00:14.0/usb3/3-2 (usb)
UDEV  [1767.405589] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::compose (leds)
UDEV  [1767.405815] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/event15 (input)
UDEV  [1767.405851] change   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::numlock (leds)
UDEV  [1767.405891] change   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::kana (leds)
UDEV  [1767.405910] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.1/usbmisc/hiddev1 (usbmisc)
UDEV  [1767.405981] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::numlock (leds)
UDEV  [1767.406092] change   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::capslock (leds)
UDEV  [1767.406122] change   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::scrolllock (leds)
UDEV  [1767.406149] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.2 (usb)
UDEV  [1767.406163] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/hidraw/hidraw3 (hidraw)
UDEV  [1767.406174] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::kana (leds)
UDEV  [1767.406522] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.1/0003:1050:0407.0007/hidraw/hidraw4 (hidraw)
UDEV  [1767.406554] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::capslock (leds)
UDEV  [1767.406572] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22/input22::scrolllock (leds)
UDEV  [1767.406937] unbind   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.1/0003:1050:0407.0007 (hid)
UDEV  [1767.406975] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006/input/input22 (input)
UDEV  [1767.407243] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.1/0003:1050:0407.0007 (hid)
UDEV  [1767.407392] unbind   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006 (hid)
UDEV  [1767.407538] unbind   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.1 (usb)
UDEV  [1767.407557] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0/0003:1050:0407.0006 (hid)
UDEV  [1767.407713] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.1 (usb)
UDEV  [1767.407851] unbind   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0 (usb)
UDEV  [1767.408058] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2/3-2:1.0 (usb)
UDEV  [1767.408791] unbind   /devices/pci0000:00/0000:00:14.0/usb3/3-2 (usb)
UDEV  [1767.409181] remove   /devices/pci0000:00/0000:00:14.0/usb3/3-2 (usb)


Here is the output of some relevant files/commands, if there is any other information needed let me know:
Code:
$ rc-service pcscd status
 * status: started
$ cat /etc/rc.conf | grep pcscd
rc_hotplug="pcscd"
$ cat ~/.gnupg/scdaemon.conf
card-timeout 300
disable-ccid
pcsc-shared
$ equery uses systemd-utils
[ Legend : U - final flag setting for installation]
[        : I - package is installed with flag     ]
[ Colors : set, unset                             ]
 * Found these USE flags for sys-apps/systemd-utils-254.17:
 U I
 - - abi_x86_32                      : 32-bit (x86) libraries
 + + acl                             : Add support for Access Control Lists
 - - boot                            : Enable systemd-boot (UEFI boot manager)
 - - kernel-install                  : Enable kernel-install
 + + kmod                            : Enable kernel module loading via sys-apps/kmod
 - - python_single_target_python3_10 : Build for Python 3.10 only
 - - python_single_target_python3_11 : Build for Python 3.11 only
 + + python_single_target_python3_12 : Build for Python 3.12 only
 - - secureboot                      : Automatically sign efi executables using user specified key
 - - sysusers                        : Enable systemd-sysusers
 - - test                            : Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)
 + + tmpfiles                        : Enable systemd-tmpfiles
 + + udev                            : Enable systemd-udev (userspace device manager)
 - - ukify                           : Enable systemd-ukify
$ gunzip -c /proc/config.gz  | grep HID_GENERIC
CONFIG_HID_GENERIC=y
$ uname -r
6.12.8-gentoo-dist


Thanks for any help you can provide! :D
Back to top
View user's profile Send private message
bryzinga
n00b
n00b


Joined: 14 May 2022
Posts: 4

PostPosted: Wed Jan 22, 2025 10:31 pm    Post subject: Reply with quote

Hi all! Does anyone happen to have an idea or know where else I can look to solve this? I appreciate any help! :D
Back to top
View user's profile Send private message
mturnbull
n00b
n00b


Joined: 26 Jan 2025
Posts: 1

PostPosted: Sun Jan 26, 2025 11:12 pm    Post subject: Reply with quote

Hi all! Also no solutions just yet, but also experiencing this issue. i don't have a yubikey 5c, but rather a 5 NFC, and plugged in through a USB-A to USB-C adapter (Framework 16 laptop). I thought this was a hardware issue for a few months, but seeing this posted here gives me hope it's a configuration issue. Might be worth adding that I've used the same Yubikey (not just the same model, but the same one) on multiple other computers (mostly Debian or Ubuntu, one Windows) without seeing this issue.

Time permitting, I'll see if I can mess around with udev rules, but it may be a few days before I can get to that... :/

Interestingly, though `gpg --cardd-status` doesn't work for sometimes upwards of 60 seconds, a `ykman info` can read the device's serial number instantly. I wonder if this may be a useful lead?
_________________
Don't comment your code -- if it was hard to write, it should be hard to read.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum