Yubico Forum
https://forum.yubico.com/

Multiple udev events triggered by (un)plugging yubikey
https://forum.yubico.com/viewtopic.php?f=23&t=1111
Page 1 of 1

Author:  coventry [ Wed Jul 17, 2013 8:09 pm ]
Post subject:  Multiple udev events triggered by (un)plugging yubikey

On Ubuntu 13.04, when I plug or unplug my yubikey, "udevadm monitor --udev" reports multiple interleaved add and remove events. Is there a way to tell linux/udev not to trigger so many spurious events? As a result of this behavior, I couldn't directly use a rolling challenge-response to verify my yubikey when deciding whether or not to unlock the screensaver. (There is another thread about making the screensaver unlock based on udev events, but the solution posted there does no authentication of the yubikey.) Using udev to trigger a ykchalresp query to the yubikey on every yubikey "add" results in rapid bursts of many queries, which seems to confuse the yubikey, or some component involved in communicating with it: the challenge-response feature stops working altogether until I turn off the udev trigger and reinsert the yubikey. I have worked around this by starting a script which attempts a ykchalresp twice a second for as long as the screensaver is locked, and unlocks it when the ykchalresp succeeds. This works, but is an ugly hack. Another way would be probably be to do the ykchalresp in a separate service with a rate-limited queue. But the best way would be to understand why udev triggers so many spurious events, and figure out how to stop it from doing so.

For instance, here is the output of udevadm from a single removal and insertion of my yubikey:

Code:
lap% !1244
udevadm monitor --udev
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
 
UDEV  [4915.052657] remove   /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/0003:1050:0010.0006/hidraw/hidraw5 (hidraw)           
UDEV  [4915.052960] remove   /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/0003:1050:0010.0006 (hid)
UDEV  [4915.061067] remove   /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/input/input13/event13 (input)
UDEV  [4915.071103] remove   /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/input/input13 (input)
UDEV  [4915.071991] remove   /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0 (usb)
UDEV  [4915.092941] remove   /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3 (usb)
UDEV  [4918.171340] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3 (usb)
UDEV  [4918.174313] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0 (usb)
UDEV  [4918.175183] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/0003:1050:0010.0007 (hid)
UDEV  [4918.176050] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/0003:1050:0010.0007/hidraw/hidraw5 (hidraw)
UDEV  [4918.177417] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/input/input14 (input)
UDEV  [4918.178818] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/input/input14/event13 (input)
UDEV  [4918.204409] remove   /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/0003:1050:0010.0007/hidraw/hidraw5 (hidraw)
UDEV  [4918.204989] remove   /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/0003:1050:0010.0007 (hid)
UDEV  [4918.210123] remove   /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/input/input14/event13 (input)
UDEV  [4918.218750] remove   /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/input/input14 (input)
UDEV  [4918.297440] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/0003:1050:0010.0008 (hid)
UDEV  [4918.298128] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/0003:1050:0010.0008/hidraw/hidraw5 (hidraw)
UDEV  [4918.301475] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/input/input15 (input)
UDEV  [4918.303005] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/input/input15/event13 (input)
UDEV  [4918.316655] remove   /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/0003:1050:0010.0008/hidraw/hidraw5 (hidraw)
UDEV  [4918.317053] remove   /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/0003:1050:0010.0008 (hid)
UDEV  [4918.317297] remove   /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/input/input15/event13 (input)
UDEV  [4918.328491] remove   /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/input/input15 (input)
UDEV  [4918.410927] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/0003:1050:0010.0009 (hid)
UDEV  [4918.411046] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/0003:1050:0010.0009/hidraw/hidraw5 (hidraw)
UDEV  [4918.412472] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/input/input16 (input)
UDEV  [4918.413134] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/input/input16/event13 (input)
UDEV  [4918.432443] remove   /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/0003:1050:0010.0009/hidraw/hidraw5 (hidraw)
UDEV  [4918.432808] remove   /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/0003:1050:0010.0009 (hid)
UDEV  [4918.436918] remove   /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/input/input16/event13 (input)
UDEV  [4918.449524] remove   /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/input/input16 (input)
UDEV  [4918.527890] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/0003:1050:0010.000A (hid)
UDEV  [4918.529229] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/0003:1050:0010.000A/hidraw/hidraw5 (hidraw)
UDEV  [4918.530323] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/input/input17 (input)
UDEV  [4918.532078] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/input/input17/event13 (input)
UDEV  [4918.540864] remove   /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/0003:1050:0010.000A/hidraw/hidraw5 (hidraw)
UDEV  [4918.541241] remove   /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/0003:1050:0010.000A (hid)
UDEV  [4918.546256] remove   /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/input/input17/event13 (input)
UDEV  [4918.557313] remove   /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/input/input17 (input)
UDEV  [4918.634341] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/0003:1050:0010.000B (hid)
UDEV  [4918.635311] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/0003:1050:0010.000B/hidraw/hidraw5 (hidraw)
UDEV  [4918.636870] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/input/input18 (input)
UDEV  [4918.638293] add      /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0/input/input18/event13 (input)

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/