yubioath-flutter icon indicating copy to clipboard operation
yubioath-flutter copied to clipboard

YubiKey with given serial not found

Open PrimarchAlpharius opened this issue 4 years ago • 22 comments
trafficstars

  • Yubico Authenticator version: v5.1.0
  • Operating system and version: Ubuntu 21.04
  • YubiKey model and version: YubiKey 5 NFC 5.4.3
  • Bug description summary: Serial key not recognized when adding account

Steps to reproduce

I already own a YubiKey, same type and firmware version as the one I just received, and that one works flawlessly. The new one is recognized by the application, it shows the device type, firmware version and serial number just fine in the GUI. However, when I try to add an account for the new YubiKey, the GUI just shows an 'unknown error'.

Expected result

Adding an account should work.

Actual results

Adding an account does not work.

Other info

The info given by journalctl is

yubioath-desktop_yubioath-desktop.desktop[45763]: qml: addCredential failed: YubiKey with given serial not found

PrimarchAlpharius avatar Oct 29 '21 11:10 PrimarchAlpharius

Could you run the app with --log-level DEBUG and copy what it prints?

fdennis avatar Oct 29 '21 11:10 fdennis

Strangely enough, it's giving a different error now, but the behavior is the same. On top of that, I've noticed that if I boot into the system with the YubiKeys already connected, it has no problems. Only when they're (re)connected it seems something goes wrong.

2021-10-30T10:40:26+0200 ERROR [ykman.device.connect_to_device:208] Error listing connection of type <class 'yubikit.core.smartcard.SmartCardConnection'>
Traceback (most recent call last):
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/device.py", line 206, in connect_to_device
    devs = CONNECTION_LIST_MAPPING[connection_type]()
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/device.py", line 85, in inner
    return f()
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/device.py", line 102, in list_ccid_devices
    return _list_ccid_devices()
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/pcsc/__init__.py", line 164, in list_devices
    for reader in list_readers():
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/pcsc/__init__.py", line 152, in list_readers
    return System.readers()
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/smartcard/System.py", line 41, in readers
    return smartcard.reader.ReaderFactory.ReaderFactory.readers(groups)
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/smartcard/reader/ReaderFactory.py", line 58, in readers
    zreaders += fm(groups)
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/smartcard/pcsc/PCSCReader.py", line 109, in readers
    hcontext = PCSCContext().getContext()
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/smartcard/pcsc/PCSCContext.py", line 56, in __init__
    self.renewContext()
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/smartcard/pcsc/PCSCContext.py", line 70, in renewContext
    PCSCContext.instance = PCSCContext.__PCSCContextSingleton()
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/smartcard/pcsc/PCSCContext.py", line 40, in __init__
    raise EstablishContextException(hresult)
smartcard.pcsc.PCSCExceptions.EstablishContextException: 'Failure to establish context: Service not available.'
2021-10-30T10:40:26+0200 ERROR [yubikey.wrapped:141] Uncaught exception
Traceback (most recent call last):
  File "qrc:///py/yubikey.py", line 129, in wrapped
    return f(*args, **kwargs)
  File "qrc:///py/yubikey.py", line 818, in ccid_add_credential
    with self._open_oath() as oath_controller:
  File "qrc:///py/yubikey.py", line 206, in _open_oath
    return connect_to_device(self._current_serial, [SmartCardConnection])[0]
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/device.py", line 228, in connect_to_device
    raise ConnectionNotAvailableException(connection_types)
ykman.device.ConnectionNotAvailableException: No eligiable connections are available ([<class 'yubikit.core.smartcard.SmartCardConnection'>]).
qml: addCredential failed: No eligiable connections are available ([<class 'yubikit.core.smartcard.SmartCardConnection'>]).
2021-10-30T10:40:26+0200 ERROR [ykman.device.connect_to_device:208] Error listing connection of type <class 'yubikit.core.smartcard.SmartCardConnection'>
Traceback (most recent call last):
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/device.py", line 206, in connect_to_device
    devs = CONNECTION_LIST_MAPPING[connection_type]()
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/device.py", line 85, in inner
    return f()
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/device.py", line 102, in list_ccid_devices
    return _list_ccid_devices()
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/pcsc/__init__.py", line 164, in list_devices
    for reader in list_readers():
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/pcsc/__init__.py", line 152, in list_readers
    return System.readers()
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/smartcard/System.py", line 41, in readers
    return smartcard.reader.ReaderFactory.ReaderFactory.readers(groups)
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/smartcard/reader/ReaderFactory.py", line 58, in readers
    zreaders += fm(groups)
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/smartcard/pcsc/PCSCReader.py", line 109, in readers
    hcontext = PCSCContext().getContext()
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/smartcard/pcsc/PCSCContext.py", line 56, in __init__
    self.renewContext()
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/smartcard/pcsc/PCSCContext.py", line 70, in renewContext
    PCSCContext.instance = PCSCContext.__PCSCContextSingleton()
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/smartcard/pcsc/PCSCContext.py", line 40, in __init__
    raise EstablishContextException(hresult)
smartcard.pcsc.PCSCExceptions.EstablishContextException: 'Failure to establish context: Service not available.'
2021-10-30T10:40:26+0200 ERROR [yubikey.wrapped:141] Uncaught exception
Traceback (most recent call last):
  File "qrc:///py/yubikey.py", line 129, in wrapped
    return f(*args, **kwargs)
  File "qrc:///py/yubikey.py", line 818, in ccid_add_credential
    with self._open_oath() as oath_controller:
  File "qrc:///py/yubikey.py", line 206, in _open_oath
    return connect_to_device(self._current_serial, [SmartCardConnection])[0]
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/device.py", line 228, in connect_to_device
    raise ConnectionNotAvailableException(connection_types)
ykman.device.ConnectionNotAvailableException: No eligiable connections are available ([<class 'yubikit.core.smartcard.SmartCardConnection'>]).
qml: addCredential failed: No eligiable connections are available ([<class 'yubikit.core.smartcard.SmartCardConnection'>]).
2021-10-30T10:40:26+0200 ERROR [ykman.device.scan_devices:141] Unable to list devices for connection
Traceback (most recent call last):
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/device.py", line 139, in scan_devices
    devs = list_devs()
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/device.py", line 85, in inner
    return f()
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/device.py", line 102, in list_ccid_devices
    return _list_ccid_devices()
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/pcsc/__init__.py", line 164, in list_devices
    for reader in list_readers():
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/pcsc/__init__.py", line 152, in list_readers
    return System.readers()
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/smartcard/System.py", line 41, in readers
    return smartcard.reader.ReaderFactory.ReaderFactory.readers(groups)
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/smartcard/reader/ReaderFactory.py", line 58, in readers
    zreaders += fm(groups)
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/smartcard/pcsc/PCSCReader.py", line 109, in readers
    hcontext = PCSCContext().getContext()
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/smartcard/pcsc/PCSCContext.py", line 56, in __init__
    self.renewContext()
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/smartcard/pcsc/PCSCContext.py", line 70, in renewContext
    PCSCContext.instance = PCSCContext.__PCSCContextSingleton()
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/smartcard/pcsc/PCSCContext.py", line 40, in __init__
    raise EstablishContextException(hresult)
smartcard.pcsc.PCSCExceptions.EstablishContextException: 'Failure to establish context: Service not available.'
2021-10-30T10:40:26+0200 DEBUG [ykman.hid.linux.list_devices:108] Failed opening HID device
Traceback (most recent call last):
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/hid/linux.py", line 103, in list_devices
    with open(hidraw, "rb") as f:
PermissionError: [Errno 13] Permission denied: '/dev/hidraw0'
2021-10-30T10:40:26+0200 DEBUG [ykman.hid.linux.list_devices:108] Failed opening HID device
Traceback (most recent call last):
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/hid/linux.py", line 103, in list_devices
    with open(hidraw, "rb") as f:
PermissionError: [Errno 13] Permission denied: '/dev/hidraw11'
2021-10-30T10:40:27+0200 DEBUG [ykman.hid.linux.list_devices:108] Failed opening HID device
Traceback (most recent call last):
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/hid/linux.py", line 103, in list_devices
    with open(hidraw, "rb") as f:
PermissionError: [Errno 13] Permission denied: '/dev/hidraw10'
2021-10-30T10:40:27+0200 DEBUG [ykman.hid.linux.list_devices:108] Failed opening HID device
Traceback (most recent call last):
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/hid/linux.py", line 103, in list_devices
    with open(hidraw, "rb") as f:
PermissionError: [Errno 13] Permission denied: '/dev/hidraw9'
2021-10-30T10:40:27+0200 DEBUG [ykman.hid.linux.list_devices:108] Failed opening HID device
Traceback (most recent call last):
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/hid/linux.py", line 103, in list_devices
    with open(hidraw, "rb") as f:
PermissionError: [Errno 13] Permission denied: '/dev/hidraw8'
2021-10-30T10:40:27+0200 DEBUG [ykman.hid.linux.list_devices:108] Failed opening HID device
Traceback (most recent call last):
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/hid/linux.py", line 103, in list_devices
    with open(hidraw, "rb") as f:
PermissionError: [Errno 13] Permission denied: '/dev/hidraw7'
2021-10-30T10:40:27+0200 DEBUG [ykman.hid.linux.list_devices:108] Failed opening HID device
Traceback (most recent call last):
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/hid/linux.py", line 103, in list_devices
    with open(hidraw, "rb") as f:
PermissionError: [Errno 13] Permission denied: '/dev/hidraw4'
2021-10-30T10:40:27+0200 DEBUG [fido2.hid.linux.list_descriptors:72] Found CTAP device: /dev/hidraw1
2021-10-30T10:40:27+0200 DEBUG [fido2.hid.linux.list_descriptors:76] Skip device: [Errno 13] Permission denied: '/dev/hidraw0'
2021-10-30T10:40:27+0200 DEBUG [fido2.hid.linux.list_descriptors:76] Skip device: [Errno 13] Permission denied: '/dev/hidraw11'
2021-10-30T10:40:27+0200 DEBUG [fido2.hid.linux.list_descriptors:76] Skip device: [Errno 13] Permission denied: '/dev/hidraw10'
2021-10-30T10:40:27+0200 DEBUG [fido2.hid.linux.list_descriptors:76] Skip device: [Errno 13] Permission denied: '/dev/hidraw9'
2021-10-30T10:40:27+0200 DEBUG [fido2.hid.linux.list_descriptors:76] Skip device: [Errno 13] Permission denied: '/dev/hidraw8'
2021-10-30T10:40:27+0200 DEBUG [fido2.hid.linux.list_descriptors:76] Skip device: [Errno 13] Permission denied: '/dev/hidraw7'
2021-10-30T10:40:27+0200 DEBUG [fido2.hid.linux.list_descriptors:76] Skip device: [Errno 13] Permission denied: '/dev/hidraw4'
2021-10-30T10:40:27+0200 ERROR [ykman.device.scan_devices:141] Unable to list devices for connection
Traceback (most recent call last):
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/device.py", line 139, in scan_devices
    devs = list_devs()
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/device.py", line 85, in inner
    return f()
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/device.py", line 102, in list_ccid_devices
    return _list_ccid_devices()
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/pcsc/__init__.py", line 164, in list_devices
    for reader in list_readers():
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/pcsc/__init__.py", line 152, in list_readers
    return System.readers()
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/smartcard/System.py", line 41, in readers
    return smartcard.reader.ReaderFactory.ReaderFactory.readers(groups)
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/smartcard/reader/ReaderFactory.py", line 58, in readers
    zreaders += fm(groups)
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/smartcard/pcsc/PCSCReader.py", line 109, in readers
    hcontext = PCSCContext().getContext()
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/smartcard/pcsc/PCSCContext.py", line 56, in __init__
    self.renewContext()
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/smartcard/pcsc/PCSCContext.py", line 70, in renewContext
    PCSCContext.instance = PCSCContext.__PCSCContextSingleton()
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/smartcard/pcsc/PCSCContext.py", line 40, in __init__
    raise EstablishContextException(hresult)
smartcard.pcsc.PCSCExceptions.EstablishContextException: 'Failure to establish context: Service not available.'
2021-10-30T10:40:28+0200 DEBUG [ykman.hid.linux.list_devices:108] Failed opening HID device
Traceback (most recent call last):
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/hid/linux.py", line 103, in list_devices
    with open(hidraw, "rb") as f:
PermissionError: [Errno 13] Permission denied: '/dev/hidraw0'
2021-10-30T10:40:28+0200 DEBUG [ykman.hid.linux.list_devices:108] Failed opening HID device
Traceback (most recent call last):
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/hid/linux.py", line 103, in list_devices
    with open(hidraw, "rb") as f:
PermissionError: [Errno 13] Permission denied: '/dev/hidraw11'
2021-10-30T10:40:28+0200 DEBUG [ykman.hid.linux.list_devices:108] Failed opening HID device
Traceback (most recent call last):
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/hid/linux.py", line 103, in list_devices
    with open(hidraw, "rb") as f:
PermissionError: [Errno 13] Permission denied: '/dev/hidraw10'
2021-10-30T10:40:28+0200 DEBUG [ykman.hid.linux.list_devices:108] Failed opening HID device
Traceback (most recent call last):
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/hid/linux.py", line 103, in list_devices
    with open(hidraw, "rb") as f:
PermissionError: [Errno 13] Permission denied: '/dev/hidraw9'
2021-10-30T10:40:28+0200 DEBUG [ykman.hid.linux.list_devices:108] Failed opening HID device
Traceback (most recent call last):
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/hid/linux.py", line 103, in list_devices
    with open(hidraw, "rb") as f:
PermissionError: [Errno 13] Permission denied: '/dev/hidraw8'
2021-10-30T10:40:28+0200 DEBUG [ykman.hid.linux.list_devices:108] Failed opening HID device
Traceback (most recent call last):
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/hid/linux.py", line 103, in list_devices
    with open(hidraw, "rb") as f:
PermissionError: [Errno 13] Permission denied: '/dev/hidraw7'
2021-10-30T10:40:28+0200 DEBUG [ykman.hid.linux.list_devices:108] Failed opening HID device
Traceback (most recent call last):
  File "/snap/yubioath-desktop/13/usr/lib/python3.8/site-packages/ykman/hid/linux.py", line 103, in list_devices
    with open(hidraw, "rb") as f:
PermissionError: [Errno 13] Permission denied: '/dev/hidraw4'
2021-10-30T10:40:28+0200 DEBUG [fido2.hid.linux.list_descriptors:72] Found CTAP device: /dev/hidraw1
2021-10-30T10:40:28+0200 DEBUG [fido2.hid.linux.list_descriptors:76] Skip device: [Errno 13] Permission denied: '/dev/hidraw0'
2021-10-30T10:40:28+0200 DEBUG [fido2.hid.linux.list_descriptors:76] Skip device: [Errno 13] Permission denied: '/dev/hidraw11'
2021-10-30T10:40:28+0200 DEBUG [fido2.hid.linux.list_descriptors:76] Skip device: [Errno 13] Permission denied: '/dev/hidraw10'
2021-10-30T10:40:28+0200 DEBUG [fido2.hid.linux.list_descriptors:76] Skip device: [Errno 13] Permission denied: '/dev/hidraw9'
2021-10-30T10:40:28+0200 DEBUG [fido2.hid.linux.list_descriptors:76] Skip device: [Errno 13] Permission denied: '/dev/hidraw8'
2021-10-30T10:40:28+0200 DEBUG [fido2.hid.linux.list_descriptors:76] Skip device: [Errno 13] Permission denied: '/dev/hidraw7'
2021-10-30T10:40:28+0200 DEBUG [fido2.hid.linux.list_descriptors:76] Skip device: [Errno 13] Permission denied: '/dev/hidraw4'
2021-10-30T10:40:28+0200 ERROR [ykman.device.scan_devices:141] Unable to list devices for connection

PrimarchAlpharius avatar Oct 30 '21 08:10 PrimarchAlpharius

Is PCSCD running?

fdennis avatar Nov 01 '21 08:11 fdennis

I have the exact same behaviour on Manjaro (i3). PCSCD is running. The Yubikey itself is shown in the app, but it says I do not have any accounts. When I run it as root, the permission denied log disappears, but my accounts are still not shown.

bensta avatar Nov 29 '21 11:11 bensta

@bensta Do you have access to multiple YubiKeys? If yes, it would be interesting to know if the same issue appears with all of them. In any case, have you tried version 5.0.5 of the authenticator to see if that has the same issue or not?

fdennis avatar Nov 29 '21 11:11 fdennis

Yes, I do have two Keys, both are the same model though (YubiKey 5 NFC). Same behaviour with both. I tried with v5.0.5, with/without sudo. The behaviour is slightly different with each:

v5.1.0

Logs with sudo:

[... a bunch of logs, incl.  SEND and RECV logs...]
ValueError: YubiKey with given serial not found
[... a bunch of logs, incl.  SEND and RECV logs...]

fido2.hid.linux.list_descriptors:72] Found CTAP device: /dev/hidraw4
fido2.hid.linux.list_descriptors:72] Found CTAP device: /dev/hidraw4
fido2.hid.linux.list_descriptors:72] Found CTAP device: /dev/hidraw4
.... 
[last line repeats every second or so]

Logs without sudo:

PermissionError: [Errno 13] Permission denied: '/dev/hidraw0'
2021-11-30T09:50:36+0100 DEBUG [fido2.hid.linux.list_descriptors:72] Found CTAP device: /dev/hidraw4
2021-11-30T09:50:36+0100 DEBUG [fido2.hid.linux.list_descriptors:76] Skip device: [Errno 13] Permission denied: '/dev/hidraw3'
2021-11-30T09:50:36+0100 DEBUG [fido2.hid.linux.list_descriptors:76] Skip device: [Errno 13] Permission denied: '/dev/hidraw11'
2021-11-30T09:50:36+0100 DEBUG [fido2.hid.linux.list_descriptors:76] Skip device: [Errno 13] Permission denied: '/dev/hidraw10'
2021-11-30T09:50:36+0100 DEBUG [fido2.hid.linux.list_descriptors:76] Skip device: [Errno 13] Permission denied: '/dev/hidraw9'
2021-11-30T09:50:36+0100 DEBUG [fido2.hid.linux.list_descriptors:76] Skip device: [Errno 13] Permission denied: '/dev/hidraw8'
2021-11-30T09:50:36+0100 DEBUG [fido2.hid.linux.list_descriptors:76] Skip device: [Errno 13] Permission denied: '/dev/hidraw7'
2021-11-30T09:50:36+0100 DEBUG [fido2.hid.linux.list_descriptors:76] Skip device: [Errno 13] Permission denied: '/dev/hidraw6'
2021-11-30T09:50:36+0100 DEBUG [fido2.hid.linux.list_descriptors:76] Skip device: [Errno 13] Permission denied: '/dev/hidraw5'
2021-11-30T09:50:36+0100 DEBUG [fido2.hid.linux.list_descriptors:76] Skip device: [Errno 13] Permission denied: '/dev/hidraw2'
2021-11-30T09:50:36+0100 DEBUG [fido2.hid.linux.list_descriptors:76] Skip device: [Errno 13] Permission denied: '/dev/hidraw1'
2021-11-30T09:50:36+0100 DEBUG [fido2.hid.linux.list_descriptors:76] Skip device: [Errno 13] Permission denied: '/dev/hidraw0'
[logs repeaded continuously]

UI behaviour

Key is recognized and shown in the UI UI shows "No accounts" (I do have accounts on the key which i can access using the mobile app)

This is the same with and without sudo

v5.0.5

Logs without sudo:

2021-11-30T10:03:55+0100 INFO [ykman.logging_setup.setup:74] Initialized logging for level: DEBUG
2021-11-30T10:03:55+0100 INFO [ykman.logging_setup.setup:75] Running ykman version: 4.0.2
2021-11-30T10:03:55+0100 DEBUG [ykman.logging_setup.log_sys_info:47] Python: 3.8.7 (default, Apr 14 2021, 15:21:15) 
[GCC 5.4.0 20160609]
2021-11-30T10:03:55+0100 DEBUG [ykman.logging_setup.log_sys_info:48] Platform: linux
2021-11-30T10:03:55+0100 DEBUG [ykman.logging_setup.log_sys_info:54] Running as admin: False
2021-11-30T10:03:55+0100 DEBUG [ykman.device.read_info:401] Read info: DeviceInfo(config=DeviceConfig(enabled_capabilities={<TRANSPORT.USB: 'usb'>: <CAPABILITY.FIDO2|OATH|PIV|OPENPGP|4|U2F|OTP: 575>, <TRANSPORT.NFC: 'nfc'>: <CAPABILITY.FIDO2|OATH|PIV|OPENPGP|4|U2F|OTP: 575>}, auto_eject_timeout=0, challenge_response_timeout=15, device_flags=<DEVICE_FLAG.0: 0>), serial=***redacted***, version=Version(major=5, minor=2, patch=7), form_factor=<FORM_FACTOR.USB_A_KEYCHAIN: 1>, supported_capabilities={<TRANSPORT.USB: 'usb'>: <CAPABILITY.FIDO2|OATH|PIV|OPENPGP|4|U2F|OTP: 575>, <TRANSPORT.NFC: 'nfc'>: <CAPABILITY.FIDO2|OATH|PIV|OPENPGP|4|U2F|OTP: 575>}, is_locked=False, is_fips=False)
2021-11-30T10:03:55+0100 ERROR [yubikey.wrapped:156] Uncaught exception
Traceback (most recent call last):
  File "qrc:///py/yubikey.py", line 139, in wrapped
    return f(*args, **kwargs)
  File "qrc:///py/yubikey.py", line 354, in refresh_devices
    self._devices = self._get_devices(otp_mode)
  File "qrc:///py/yubikey.py", line 281, in _get_devices
    with connect_to_device(info.serial, [SmartCardConnection])[
  File "/tmp/.mount_yubioa3S4Oz8/usr/lib/python3.8/site-packages/ykman/device.py", line 196, in connect_to_device
    raise ValueError("YubiKey with given serial not found")
ValueError: YubiKey with given serial not found
qml: refreshing devices failed: YubiKey with given serial not found

Logs with sudo

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>@.host --user to connect to bus of other user)
Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>@.host --user to connect to bus of other user)
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
2021-11-30T10:04:41+0100 INFO [ykman.logging_setup.setup:74] Initialized logging for level: DEBUG
2021-11-30T10:04:41+0100 INFO [ykman.logging_setup.setup:75] Running ykman version: 4.0.2
2021-11-30T10:04:41+0100 DEBUG [ykman.logging_setup.log_sys_info:47] Python: 3.8.7 (default, Apr 14 2021, 15:21:15) 
[GCC 5.4.0 20160609]
2021-11-30T10:04:41+0100 DEBUG [ykman.logging_setup.log_sys_info:48] Platform: linux
2021-11-30T10:04:41+0100 DEBUG [ykman.logging_setup.log_sys_info:54] Running as admin: True
2021-11-30T10:04:41+0100 DEBUG [yubikit.core.otp.send_and_receive:160] SEND: ***redacted***
2021-11-30T10:04:42+0100 DEBUG [yubikit.core.otp.send_and_receive:164] RECV: ***redacted***
2021-11-30T10:04:42+0100 DEBUG [ykman.device.read_info:401] Read info: DeviceInfo(config=DeviceConfig(enabled_capabilities={<TRANSPORT.USB: 'usb'>: <CAPABILITY.FIDO2|OATH|PIV|OPENPGP|4|U2F|OTP: 575>, <TRANSPORT.NFC: 'nfc'>: <CAPABILITY.FIDO2|OATH|PIV|OPENPGP|4|U2F|OTP: 575>}, auto_eject_timeout=0, challenge_response_timeout=15, device_flags=<DEVICE_FLAG.0: 0>), serial=***redacted***, version=Version(major=5, minor=2, patch=7), form_factor=<FORM_FACTOR.USB_A_KEYCHAIN: 1>, supported_capabilities={<TRANSPORT.USB: 'usb'>: <CAPABILITY.FIDO2|OATH|PIV|OPENPGP|4|U2F|OTP: 575>, <TRANSPORT.NFC: 'nfc'>: <CAPABILITY.FIDO2|OATH|PIV|OPENPGP|4|U2F|OTP: 575>}, is_locked=False, is_fips=False)
2021-11-30T10:04:42+0100 ERROR [yubikey.wrapped:156] Uncaught exception
Traceback (most recent call last):
  File "qrc:///py/yubikey.py", line 139, in wrapped
    return f(*args, **kwargs)
  File "qrc:///py/yubikey.py", line 354, in refresh_devices
    self._devices = self._get_devices(otp_mode)
  File "qrc:///py/yubikey.py", line 281, in _get_devices
    with connect_to_device(info.serial, [SmartCardConnection])[
  File "/tmp/.mount_yubioaYStbbR/usr/lib/python3.8/site-packages/ykman/device.py", line 196, in connect_to_device
    raise ValueError("YubiKey with given serial not found")
ValueError: YubiKey with given serial not found
qml: refreshing devices failed: YubiKey with given serial not found

UI behaviour

"Insert your YubiKey"

This is the same with and without sudo

bensta avatar Nov 30 '21 09:11 bensta

@bensta Do you get the line smartcard.pcsc.PCSCExceptions.EstablishContextException: Failure to establish context: Service not available. in your logs, as @PrimarchAlpharius got? Further, are you running the snap or the appimage?

fdennis avatar Nov 30 '21 09:11 fdennis

I am using the appimage. No, I do not get this line in the log, neither in 5.1.0 nor in 5.0.5 I tried with disabled pcscd aswell.

  • if pcscd is disabled on yubi start, it gets enabled when i start yubi.
  • the behaviour is the same if pcscd is enabled or disabled yubi start

bensta avatar Nov 30 '21 10:11 bensta

sudo ./yubioath-desktop-5.1.0-linux.AppImage --log-level DEBUG

2022-01-28T16:47:41+0200 ERROR [yubikey.wrapped:141] Uncaught exception
Traceback (most recent call last):
  File "qrc:///py/yubikey.py", line 129, in wrapped
    return f(*args, **kwargs)
  File "qrc:///py/yubikey.py", line 785, in ccid_calculate_all
    with self._open_oath() as oath_controller:
  File "qrc:///py/yubikey.py", line 206, in _open_oath
    return connect_to_device(self._current_serial, [SmartCardConnection])[0]
  File "/tmp/.mount_yubioajWQsvL/usr/lib/python3.8/site-packages/ykman/device.py", line 248, in connect_to_device
    raise ValueError("YubiKey with given serial not found")
ValueError: YubiKey with given serial not found
qml: calculateAll failed: YubiKey with given serial not found

zeridon avatar Jan 28 '22 14:01 zeridon

make sure you have libccid installed. Then restart pcscd and should be good.

On the other hand i recommend using the packaged tools as those appimages.

zeridon avatar Feb 04 '22 09:02 zeridon

make sure you have libccid installed. Then restart pcscd and should be good.

On the other hand i recommend using the packaged tools as those appimages.

For those that use openSUSE the package is pcsc-ccid (maybe its for every RPM based Distro)

hoferbeck avatar Feb 06 '22 16:02 hoferbeck

I have the same issue, except it only happens sometimes. Unplugging and replugging the yubikey resolves the issue, but i would like to find the cause of this instead of a workaround.

phisch@laptop ~ master* ❯ yubioath-desktop --log-level DEBUG
Got library name:  "/usr/lib/qt/qml/io/thp/pyotherside/libpyothersideplugin.so"
2022-02-23T08:34:29+0100 INFO [ykman.logging_setup.setup:76] Initialized logging for level: DEBUG
2022-02-23T08:34:29+0100 INFO [ykman.logging_setup.setup:77] Running ykman version: 4.0.8
2022-02-23T08:34:29+0100 DEBUG [ykman.logging_setup.log_sys_info:48] Python: 3.10.2 (main, Jan 15 2022, 19:56:27) [GCC 11.1.0]
2022-02-23T08:34:29+0100 DEBUG [ykman.logging_setup.log_sys_info:49] Platform: linux
2022-02-23T08:34:29+0100 DEBUG [ykman.logging_setup.log_sys_info:50] Arch: x86_64
2022-02-23T08:34:29+0100 DEBUG [ykman.logging_setup.log_sys_info:56] Running as admin: False
2022-02-23T08:34:29+0100 DEBUG [fido2.hid.linux.list_descriptors:89] Found CTAP device: /dev/hidraw0
2022-02-23T08:34:29+0100 DEBUG [fido2.hid.linux.list_descriptors:89] Found CTAP device: /dev/hidraw0
2022-02-23T08:34:29+0100 DEBUG [fido2.hid.call:166] SEND: ***
2022-02-23T08:34:29+0100 DEBUG [fido2.hid.call:186] RECV: ***
2022-02-23T08:34:29+0100 DEBUG [fido2.hid.call:166] SEND: ***
2022-02-23T08:34:29+0100 DEBUG [fido2.hid.call:186] RECV: ***
2022-02-23T08:34:29+0100 DEBUG [ykman.device.read_info:453] Read info: DeviceInfo(config=DeviceConfig(enabled_capabilities={<TRANSPORT.USB: 'usb'>: <CAPABILITY.FIDO2|OATH|OPENPGP|U2F: 554>}, auto_eject_timeout=0, challenge_response_timeout=15, device_flags=<DEVICE_FLAG.0: 0>), serial=***, version=Version(major=5, minor=1, patch=2), form_factor=<FORM_FACTOR.USB_A_NANO: 2>, supported_capabilities={<TRANSPORT.USB: 'usb'>: <CAPABILITY.FIDO2|OATH|PIV|OPENPGP|4|U2F|OTP: 575>}, is_locked=False, is_fips=False, is_sky=False)
2022-02-23T08:34:29+0100 DEBUG [fido2.hid.linux.list_descriptors:89] Found CTAP device: /dev/hidraw0
2022-02-23T08:34:29+0100 DEBUG [fido2.hid.call:166] SEND: ***
2022-02-23T08:34:29+0100 DEBUG [fido2.hid.call:186] RECV: ***
2022-02-23T08:34:29+0100 DEBUG [fido2.hid.call:166] SEND: ***
2022-02-23T08:34:29+0100 DEBUG [fido2.hid.call:186] RECV: ***
2022-02-23T08:34:29+0100 DEBUG [ykman.device.read_info:453] Read info: DeviceInfo(config=DeviceConfig(enabled_capabilities={<TRANSPORT.USB: 'usb'>: <CAPABILITY.FIDO2|OATH|OPENPGP|U2F: 554>}, auto_eject_timeout=0, challenge_response_timeout=15, device_flags=<DEVICE_FLAG.0: 0>), serial=***, version=Version(major=5, minor=1, patch=2), form_factor=<FORM_FACTOR.USB_A_NANO: 2>, supported_capabilities={<TRANSPORT.USB: 'usb'>: <CAPABILITY.FIDO2|OATH|PIV|OPENPGP|4|U2F|OTP: 575>}, is_locked=False, is_fips=False, is_sky=False)
2022-02-23T08:34:29+0100 DEBUG [fido2.hid.call:166] SEND: ***
2022-02-23T08:34:29+0100 DEBUG [fido2.hid.call:186] RECV: ***
2022-02-23T08:34:29+0100 DEBUG [fido2.hid.call:186] RECV: ***
2022-02-23T08:34:29+0100 ERROR [yubikey.wrapped:141] Uncaught exception
Traceback (most recent call last):
  File "qrc:///py/yubikey.py", line 129, in wrapped
    return f(*args, **kwargs)
  File "qrc:///py/yubikey.py", line 785, in ccid_calculate_all
    with self._open_oath() as oath_controller:
  File "qrc:///py/yubikey.py", line 206, in _open_oath
    return connect_to_device(self._current_serial, [SmartCardConnection])[0]
  File "/usr/lib/python3.10/site-packages/ykman/device.py", line 248, in connect_to_device
    raise ValueError("YubiKey with given serial not found")
ValueError: YubiKey with given serial not found
qml: calculateAll failed: YubiKey with given serial not found
2022-02-23T08:34:29+0100 DEBUG [fido2.hid.linux.list_descriptors:89] Found CTAP device: /dev/hidraw0
2022-02-23T08:34:29+0100 DEBUG [fido2.hid.linux.list_descriptors:89] Found CTAP device: /dev/hidraw0
2022-02-23T08:34:30+0100 DEBUG [fido2.hid.call:166] SEND: ***
2022-02-23T08:34:30+0100 DEBUG [fido2.hid.call:186] RECV: ***
2022-02-23T08:34:30+0100 DEBUG [fido2.hid.call:166] SEND: ***
2022-02-23T08:34:30+0100 DEBUG [fido2.hid.call:186] RECV: ***
2022-02-23T08:34:30+0100 DEBUG [ykman.device.read_info:453] Read info: DeviceInfo(config=DeviceConfig(enabled_capabilities={<TRANSPORT.USB: 'usb'>: <CAPABILITY.FIDO2|OATH|OPENPGP|U2F: 554>}, auto_eject_timeout=0, challenge_response_timeout=15, device_flags=<DEVICE_FLAG.0: 0>), serial=***, version=Version(major=5, minor=1, patch=2), form_factor=<FORM_FACTOR.USB_A_NANO: 2>, supported_capabilities={<TRANSPORT.USB: 'usb'>: <CAPABILITY.FIDO2|OATH|PIV|OPENPGP|4|U2F|OTP: 575>}, is_locked=False, is_fips=False, is_sky=False)
2022-02-23T08:34:30+0100 DEBUG [fido2.hid.linux.list_descriptors:89] Found CTAP device: /dev/hidraw0
2022-02-23T08:34:30+0100 DEBUG [fido2.hid.call:166] SEND: ***
2022-02-23T08:34:30+0100 DEBUG [fido2.hid.call:186] RECV: ***
2022-02-23T08:34:30+0100 DEBUG [fido2.hid.call:166] SEND: ***
2022-02-23T08:34:30+0100 DEBUG [fido2.hid.call:186] RECV: ***
2022-02-23T08:34:30+0100 DEBUG [ykman.device.read_info:453] Read info: DeviceInfo(config=DeviceConfig(enabled_capabilities={<TRANSPORT.USB: 'usb'>: <CAPABILITY.FIDO2|OATH|OPENPGP|U2F: 554>}, auto_eject_timeout=0, challenge_response_timeout=15, device_flags=<DEVICE_FLAG.0: 0>), serial=***, version=Version(major=5, minor=1, patch=2), form_factor=<FORM_FACTOR.USB_A_NANO: 2>, supported_capabilities={<TRANSPORT.USB: 'usb'>: <CAPABILITY.FIDO2|OATH|PIV|OPENPGP|4|U2F|OTP: 575>}, is_locked=False, is_fips=False, is_sky=False)
2022-02-23T08:34:30+0100 DEBUG [fido2.hid.call:166] SEND: ***
2022-02-23T08:34:30+0100 DEBUG [fido2.hid.call:186] RECV: ***
2022-02-23T08:34:30+0100 DEBUG [fido2.hid.call:186] RECV: ***
2022-02-23T08:34:30+0100 DEBUG [fido2.hid.linux.list_descriptors:89] Found CTAP device: /dev/hidraw0
2022-02-23T08:34:31+0100 DEBUG [fido2.hid.linux.list_descriptors:89] Found CTAP device: /dev/hidraw0
2022-02-23T08:34:32+0100 DEBUG [fido2.hid.linux.list_descriptors:89] Found CTAP device: /dev/hidraw0
^CExiting due to signal 2

phisch avatar Feb 23 '22 07:02 phisch

I still have this problem. libccid is installed. 20.04. What steps can I do to debug this?

dheera avatar Mar 09 '22 16:03 dheera

I have the same issue. In my case it was enough to start pcscd

bialasjaroslaw avatar Mar 19 '22 15:03 bialasjaroslaw

I still have the same issue, starting PCSCD does not help. Unknown Error.

Classic298 avatar Apr 03 '22 12:04 Classic298

Would be good to know if there are any plans on fixing this, as trying to pull out a fully plugged in YubiKey Nano, and then re-plugging it just to get the authenticator to work again is really tedious, and often not even possible with only your fingernails.

phisch avatar Apr 03 '22 13:04 phisch

Thanks for reporting back and letting us know this is still problematic. Unfortunately many different reasons can be behind this behavior. Usually, it is pcscd related, but all OSes are different and handle devices differently. We are working on a major rework of the yubioath-desktop that we have planned to release later this year. In this we are using new technologies where we already see better stability. Sadly I cannot give more information at this moment.

fdennis avatar Apr 04 '22 08:04 fdennis

Sometimes I use the Ubuntu app store version (which I don't know what the hell package manager it uses), sometimes I use the appimage version, each time it is random, one will work and the other will not work.

Have both versions on your system and try both.

dheera avatar Apr 12 '22 18:04 dheera

Changing the USB port may solve the problem. I had the same problem before and accidentally fixed it by changing a USB port.

before:

$ lsusb -t
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/7p, 12M
        |__ Port 1: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 6: Dev 4, If 1, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 6: Dev 4, If 0, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 4: Dev 7, If 1, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 4: Dev 7, If 2, Class=Chip/SmartCard, Driver=usbfs, 12M

after:

$ lsusb -t
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/14p, 480M
    |__ Port 10: Dev 2, If 0, Class=Vendor Specific Class, Driver=, 12M
    |__ Port 11: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 12: Dev 5, If 0, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 12: Dev 5, If 1, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 12: Dev 5, If 2, Class=Chip/SmartCard, Driver=usbfs, 12M

My montherboard, I believe, uses an internal USB hub to extend ports, and the YubiKey may not work on that.

nyanshell avatar Apr 27 '22 07:04 nyanshell

Changing the USB port may solve the problem. I had the same problem before and accidentally fixed it by changing a USB port.

before:

$ lsusb -t
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/7p, 12M
        |__ Port 1: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 6: Dev 4, If 1, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 6: Dev 4, If 0, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 4: Dev 7, If 1, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 4: Dev 7, If 2, Class=Chip/SmartCard, Driver=usbfs, 12M

after:

$ lsusb -t
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/14p, 480M
    |__ Port 10: Dev 2, If 0, Class=Vendor Specific Class, Driver=, 12M
    |__ Port 11: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 12: Dev 5, If 0, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 12: Dev 5, If 1, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 12: Dev 5, If 2, Class=Chip/SmartCard, Driver=usbfs, 12M

My montherboard, I believe, uses an internal USB hub to extend ports, and the YubiKey may not work on that.

nyanshell avatar Apr 27 '22 07:04 nyanshell

@fdennis are there any news regarding the rework? Would be cool if you could internally discuss giving out some more information about it.

phisch avatar Sep 12 '22 15:09 phisch

@phisch Sorry, we should have posted this here! https://www.yubico.com/blog/introducing-yubico-authenticator-6-for-desktop/

dainnilsson avatar Sep 12 '22 15:09 dainnilsson

Encountered this bug on Arch Linux with Yubico Authenticator v5.1.0.

2022-11-11T12:24:28+0100 ERROR [yubikey.wrapped:141] Uncaught exception
Traceback (most recent call last):
  File "qrc:///py/yubikey.py", line 129, in wrapped
    return f(*args, **kwargs)
  File "qrc:///py/yubikey.py", line 818, in ccid_add_credential
    with self._open_oath() as oath_controller:
  File "qrc:///py/yubikey.py", line 206, in _open_oath
    return connect_to_device(self._current_serial, [SmartCardConnection])[0]
  File "/usr/lib/python3.10/site-packages/ykman/device.py", line 248, in connect_to_device
    raise ValueError("YubiKey with given serial not found")
ValueError: YubiKey with given serial not found
qml: addCredential failed: YubiKey with given serial not found

I have 2x YubiKey 5C NFC with the same firmware version 5.4.3. It works at first when I connect only one. When I connect the second one instead, I can not add accounts anymore because of the error above. If I then connect again the first YubiKey, it also does not work anymore (same error).

Restarting pcscd makes no difference. Connecting to a different USB port also makes no difference.

Then I tried Yubico Authenticator 6.0.0-beta 1 which gives me this error:

12:35:06.339 [helper.helper.device] WARNING: Unable to connect via <class 'yubikit.core.smartcard.SmartCardConnection'>
Traceback (most recent call last):
  File "helper/device.py", line 293, in get_data
  File "ykman/device.py", line 257, in open_connection
  File "ykman/device.py", line 231, in connect
  File "ykman/device.py", line 231, in connect
  File "ykman/device.py", line 231, in connect
  [Previous line repeated 2 more times]
  File "ykman/device.py", line 233, in connect
ValueError: Failed to connect to the device
12:35:06.371 [desktop.devices] INFO: USB state updated, unaccounted for: {}
12:35:06.385 [helper.helper.device] WARNING: Error opening connection
Traceback (most recent call last):
  File "helper/device.py", line 302, in ccid
  File "helper/device.py", line 286, in _create_connection
  File "ykman/device.py", line 257, in open_connection
  File "ykman/device.py", line 233, in connect
ValueError: Failed to connect to the device

Anything else I can do to help debug the problem?

laemm-line avatar Nov 11 '22 11:11 laemm-line

Yubico Authenticator 6.0 has now been released and uses a new codebase. As such, this issue has been marked with the legacy label, and will be automatically closed in 7 days. If this issue is still relevant to Yubico Authenticator 6, please comment on the issue saying so, and it will be kept open (or be re-opened). Sorry for the inconvenience!

dainnilsson avatar Nov 16 '22 10:11 dainnilsson