Description of problem: Invoke ykman list with pcscd.service not running. Version-Release number of selected component: yubikey-manager-2.0.0-3.gite17b3de.fc29 Additional info: reporter: libreport-2.10.0 cmdline: /usr/bin/python3 /usr/bin/ykman list crash_function: __init__ exception_type: smartcard.pcsc.PCSCExceptions.EstablishContextException executable: /usr/bin/ykman interpreter: python3-3.7.2-4.fc29.x86_64 kernel: 4.20.3-200.fc29.x86_64 runlevel: N 5 type: Python3 uid: 5242 Truncated backtrace: PCSCContext.py:40:__init__:smartcard.pcsc.PCSCExceptions.EstablishContextException: 'Failure to establish context: Service not available.' Traceback (most recent call last): File "/usr/bin/ykman", line 11, in <module> load_entry_point('yubikey-manager==2.0.0', 'console_scripts', 'ykman')() File "/usr/lib/python3.7/site-packages/ykman/cli/__main__.py", line 246, in main cli(obj={}) File "/usr/lib/python3.7/site-packages/click/core.py", line 721, in __call__ return self.main(*args, **kwargs) File "/usr/lib/python3.7/site-packages/click/core.py", line 696, in main rv = self.invoke(ctx) File "/usr/lib/python3.7/site-packages/click/core.py", line 1065, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python3.7/site-packages/click/core.py", line 894, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/lib/python3.7/site-packages/click/core.py", line 534, in invoke return callback(*args, **kwargs) File "/usr/lib/python3.7/site-packages/click/decorators.py", line 17, in new_func return f(get_current_context(), *args, **kwargs) File "/usr/lib/python3.7/site-packages/ykman/cli/__main__.py", line 206, in list_keys for dev in list_devices(): File "/usr/lib/python3.7/site-packages/ykman/descriptor.py", line 152, in list_devices for d in _list_drivers(transports): File "/usr/lib/python3.7/site-packages/ykman/descriptor.py", line 138, in _list_drivers for dev in open_ccid(): File "/usr/lib/python3.7/site-packages/ykman/driver_ccid.py", line 322, in open_devices readers = _list_readers() File "/usr/lib/python3.7/site-packages/ykman/driver_ccid.py", line 312, in _list_readers return System.readers() File "/usr/lib64/python3.7/site-packages/smartcard/System.py", line 42, in readers return smartcard.reader.ReaderFactory.ReaderFactory.readers(groups) File "/usr/lib64/python3.7/site-packages/smartcard/reader/ReaderFactory.py", line 58, in readers zreaders += fm(groups) File "/usr/lib64/python3.7/site-packages/smartcard/pcsc/PCSCReader.py", line 108, in readers hcontext = PCSCContext().getContext() File "/usr/lib64/python3.7/site-packages/smartcard/pcsc/PCSCContext.py", line 53, in __init__ PCSCContext.instance = PCSCContext.__PCSCContextSingleton() File "/usr/lib64/python3.7/site-packages/smartcard/pcsc/PCSCContext.py", line 40, in __init__ raise EstablishContextException(hresult) smartcard.pcsc.PCSCExceptions.EstablishContextException: 'Failure to establish context: Service not available.' Local variables in innermost frame: self: <smartcard.pcsc.PCSCContext.PCSCContext.__PCSCContextSingleton object at 0x7f0a40b887b8> hresult: 2148532253
Created attachment 1540424 [details] File: backtrace
Created attachment 1540425 [details] File: cgroup
Created attachment 1540426 [details] File: cpuinfo
Created attachment 1540427 [details] File: environ
Created attachment 1540428 [details] File: mountinfo
Created attachment 1540429 [details] File: namespaces
Created attachment 1540430 [details] File: open_fds
Please test again with yubikey-manager 2.1.0. I just tested and cannot reproduce.
Still reproducible: $ rpm -q yubikey-manager yubikey-manager-2.1.0-2.gitb44d719.fc30.noarch $ systemctl status pcscd.service pcscd.socket | sed -e 's/sakura.greysector.net/localhost.localdomain/g' ● pcscd.service - PC/SC Smart Card Daemon Loaded: loaded (/usr/lib/systemd/system/pcscd.service; indirect; vendor preset: disabled) Active: failed (Result: exit-code) since Wed 2019-10-23 10:33:59 CEST; 1min 26s ago Docs: man:pcscd(8) Process: 1388 ExecStart=/usr/sbin/pcscd --foreground --auto-exit (code=exited, status=1/FAILURE) Main PID: 1388 (code=exited, status=1/FAILURE) Oct 18 11:02:20 localhost.localdomain systemd[1]: Started PC/SC Smart Card Daemon. Oct 23 10:33:59 localhost.localdomain systemd[1]: Stopping PC/SC Smart Card Daemon... Oct 23 10:33:59 localhost.localdomain systemd[1]: pcscd.service: Main process exited, code=exited, status=1/FAILURE Oct 23 10:33:59 localhost.localdomain systemd[1]: pcscd.service: Failed with result 'exit-code'. Oct 23 10:33:59 localhost.localdomain systemd[1]: Stopped PC/SC Smart Card Daemon. ● pcscd.socket - PC/SC Smart Card Daemon Activation Socket Loaded: loaded (/usr/lib/systemd/system/pcscd.socket; enabled; vendor preset: enabled) Active: inactive (dead) since Wed 2019-10-23 10:34:02 CEST; 1min 23s ago Listen: /var/run/pcscd/pcscd.comm (Stream) Oct 18 11:02:16 localhost.localdomain systemd[1]: Listening on PC/SC Smart Card Daemon Activation Socket. Oct 23 10:34:02 localhost.localdomain systemd[1]: pcscd.socket: Succeeded. Oct 23 10:34:02 localhost.localdomain systemd[1]: Closed PC/SC Smart Card Daemon Activation Socket. $ ykman list Traceback (most recent call last): File "/usr/bin/ykman", line 11, in <module> load_entry_point('yubikey-manager==2.1.0', 'console_scripts', 'ykman')() File "/usr/lib/python3.7/site-packages/ykman/cli/__main__.py", line 253, in main cli(obj={}) File "/usr/lib/python3.7/site-packages/click/core.py", line 763, in __call__ return self.main(*args, **kwargs) File "/usr/lib/python3.7/site-packages/click/core.py", line 716, in main rv = self.invoke(ctx) File "/usr/lib/python3.7/site-packages/click/core.py", line 1136, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python3.7/site-packages/click/core.py", line 955, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/lib/python3.7/site-packages/click/core.py", line 554, in invoke return callback(*args, **kwargs) File "/usr/lib/python3.7/site-packages/click/decorators.py", line 17, in new_func return f(get_current_context(), *args, **kwargs) File "/usr/lib/python3.7/site-packages/ykman/cli/__main__.py", line 213, in list_keys for dev in list_devices(): File "/usr/lib/python3.7/site-packages/ykman/descriptor.py", line 152, in list_devices for d in _list_drivers(transports): File "/usr/lib/python3.7/site-packages/ykman/descriptor.py", line 138, in _list_drivers for dev in open_ccid(): File "/usr/lib/python3.7/site-packages/ykman/driver_ccid.py", line 322, in open_devices readers = list_readers() File "/usr/lib/python3.7/site-packages/ykman/driver_ccid.py", line 312, in list_readers return System.readers() File "/usr/lib64/python3.7/site-packages/smartcard/System.py", line 42, in readers return smartcard.reader.ReaderFactory.ReaderFactory.readers(groups) File "/usr/lib64/python3.7/site-packages/smartcard/reader/ReaderFactory.py", line 58, in readers zreaders += fm(groups) File "/usr/lib64/python3.7/site-packages/smartcard/pcsc/PCSCReader.py", line 108, in readers hcontext = PCSCContext().getContext() File "/usr/lib64/python3.7/site-packages/smartcard/pcsc/PCSCContext.py", line 53, in __init__ PCSCContext.instance = PCSCContext.__PCSCContextSingleton() File "/usr/lib64/python3.7/site-packages/smartcard/pcsc/PCSCContext.py", line 40, in __init__ raise EstablishContextException(hresult) smartcard.pcsc.PCSCExceptions.EstablishContextException: 'Failure to establish context: Service not available.'
Bumping to F30.
rpm -qa | grep yubikey-manager python3-yubikey-manager-3.0.0-2.gitcfa1907.fc30.noarch yubikey-manager-3.0.0-2.gitcfa1907.fc30.noarch systemctl stop pcscd.service Warning: Stopping pcscd.service, but it can still be activated by: pcscd.socket ykman list YubiKey NEO [OTP+FIDO+CCID] Appears to work with v3.0.0 but unfortunately need python-fido2-0.7.0-1.fc30 and the packager is having dependency issues for F30 as soon as he upgrades I can push.
Similar problem has been detected: Stopped pcscd.socket and pcscd.service units. Ran ykman list. reporter: libreport-2.10.1 cmdline: /usr/bin/python3 /usr/bin/ykman list crash_function: __init__ exception_type: smartcard.pcsc.PCSCExceptions.EstablishContextException executable: /usr/bin/ykman interpreter: python3-3.7.4-1.fc30.x86_64 kernel: 5.3.6-200.fc30.x86_64 package: yubikey-manager-2.1.0-2.gitb44d719.fc30 reason: PCSCContext.py:40:__init__:smartcard.pcsc.PCSCExceptions.EstablishContextException: 'Failure to establish context: Service not available.' runlevel: N 5 type: Python3 uid: 5242
FEDORA-2019-966121233a has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2019-966121233a
yubikey-manager-3.0.0-6.gitcfa1907.fc31 has been pushed to the Fedora 31 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-966121233a
(In reply to Gerald Cox from comment #11) > rpm -qa | grep yubikey-manager > python3-yubikey-manager-3.0.0-2.gitcfa1907.fc30.noarch > yubikey-manager-3.0.0-2.gitcfa1907.fc30.noarch > > systemctl stop pcscd.service > Warning: Stopping pcscd.service, but it can still be activated by: > pcscd.socket As the warning says, you need to stop both pcscd.service and pcscd.socket, otherwise it gets started automatically and you cannot trigger the exception.
(In reply to Dominik 'Rathann' Mierzejewski from comment #15) > (In reply to Gerald Cox from comment #11) > > rpm -qa | grep yubikey-manager > > python3-yubikey-manager-3.0.0-2.gitcfa1907.fc30.noarch > > yubikey-manager-3.0.0-2.gitcfa1907.fc30.noarch > > > > systemctl stop pcscd.service > > Warning: Stopping pcscd.service, but it can still be activated by: > > pcscd.socket > > As the warning says, you need to stop both pcscd.service and pcscd.socket, > otherwise it gets started automatically and you cannot trigger the exception. Got it... did a search and found this: https://github.com/Yubico/yubikey-manager/issues/20 Looks like pscd is required.
Reported the issue upstream. You may wish to add additional detail there.
Response from upstream: Could you please elaborate a bit more regarding the specific issue? What is the problem and what is the expected behavior? pcscd needs to be running for CCID. That's why you get an exception when running ykman list if pcscd is stopped.
Thanks, Gerald, but there's no need to copy&paste upstream responses here. I'm Cc'd on the upstream issue and will respond there.
yubikey-manager-3.0.0-6.gitcfa1907.fc31 has been pushed to the Fedora 31 stable repository. If problems still persist, please make note of it in this bug report.
FEDORA-2019-f6c811e862 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-f6c811e862
yubikey-manager-3.0.0-6.gitcfa1907.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-f6c811e862
FEDORA-2019-e839400498 has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2019-e839400498
FEDORA-2019-494e3aa88e has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-494e3aa88e
yubikey-manager-3.0.0-6.gitcfa1907.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.
yubikey-manager-3.0.0-7.git1f22620.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-494e3aa88e
yubikey-manager-3.0.0-7.git1f22620.fc31 has been pushed to the Fedora 31 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-e839400498
yubikey-manager-3.0.0-7.git1f22620.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.
yubikey-manager-3.0.0-7.git1f22620.fc31 has been pushed to the Fedora 31 stable repository. If problems still persist, please make note of it in this bug report.