Bug 1853347 - pcscd fails to detect Yubikey 5 NFC at boot
Summary: pcscd fails to detect Yubikey 5 NFC at boot
Keywords:
Status: CLOSED DUPLICATE of bug 1893131
Alias: None
Product: Fedora
Classification: Fedora
Component: pcsc-lite
Version: 35
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Bob Relyea
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-07-02 12:51 UTC by Stephen Gallagher
Modified: 2021-11-10 17:37 UTC (History)
15 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2021-11-10 17:37:29 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
pcscd debug log for issue 1853347 (145.28 KB, text/plain)
2021-11-08 12:42 UTC, KirillP
no flags Details

Description Stephen Gallagher 2020-07-02 12:51:32 UTC
Description of problem:
When I boot my Fedora 32 system, it fails to detect my Yubikey 5 NFC smart-card device. It looks like a race-condition of some sort, because if I run `systemctl restart pcscd.service` after startup, it's detected properly.

Version-Release number of selected component (if applicable):
pcsc-lite-1.9.0-1.fc32.x86_64

How reproducible:
Every time


Steps to Reproduce:
1. Reboot the system with Yubikey 5 NFC inserted into a USB port.
2. Run `systemctl status pcscd.service`
3. Run `gpg2 --card-status` (if set up as a hardware token for GPG keys)


Actual results:

"systemctl status" journal logs:
Jul 02 08:42:30 sgallaghp50.sgallagh.rht systemd[1]: Started PC/SC Smart Card Daemon.
Jul 02 08:42:30 sgallaghp50.sgallagh.rht pcscd[1393]: 00000000 ifdhandler.c:150:CreateChannelByNameOrChannel() failed
Jul 02 08:42:30 sgallaghp50.sgallagh.rht pcscd[1393]: 00000081 readerfactory.c:1105:RFInitializeReader() Open Port 0x200000 Failed (usb:1050/0407:libudev:0:/dev/bus/usb/001/003)
Jul 02 08:42:30 sgallaghp50.sgallagh.rht pcscd[1393]: 00000012 readerfactory.c:376:RFAddReader() Yubico YubiKey OTP+FIDO+CCID init failed.
Jul 02 08:42:30 sgallaghp50.sgallagh.rht pcscd[1393]: 00005952 ifdhandler.c:150:CreateChannelByNameOrChannel() failed
Jul 02 08:42:30 sgallaghp50.sgallagh.rht pcscd[1393]: 00000008 readerfactory.c:1105:RFInitializeReader() Open Port 0x200000 Failed (usb:1050/0407:libudev:1:/dev/bus/usb/001/003)
Jul 02 08:42:30 sgallaghp50.sgallagh.rht pcscd[1393]: 00000002 readerfactory.c:376:RFAddReader() Yubico YubiKey OTP+FIDO+CCID init failed.


gpg --card-status:
gpg: selecting card failed: No such device
gpg: OpenPGP card not available: No such device


Expected results:

The Yubikey should be detected and function properly as a smart-card device.


Additional info:

After login, running `systemctl restart pcscd.service` results in proper operation.

Comment 1 Stephen Gallagher 2020-10-12 13:07:29 UTC
I don't know what changed, but I haven't seen this issue in a couple months.

Comment 2 Taavi 2020-11-17 08:51:17 UTC
I seem to have stumbled on the same error.

Comment 3 Taavi 2020-11-17 08:58:28 UTC
systemd[1]: Started PC/SC Smart Card Daemon.
pcscd[38448]: 00000000 ccid_usb.c:1285:ControlUSB() control failed (1/2): -7 LIBUSB_ERROR_TIMEOUT
pcscd[38448]: 30787769 ifdhandler.c:150:CreateChannelByNameOrChannel() failed
pcscd[38448]: 00000019 readerfactory.c:1105:RFInitializeReader() Open Port 0x200001 Failed (usb:1050/0407:libudev:0:/dev/bus/usb/001/016)
pcscd[38448]: 00000004 readerfactory.c:376:RFAddReader() Yubico YubiKey OTP+FIDO+CCID init failed.
pcscd[38448]: 00002475 ifdhandler.c:150:CreateChannelByNameOrChannel() failed
pcscd[38448]: 00000015 readerfactory.c:1105:RFInitializeReader() Open Port 0x200001 Failed (usb:1050/0407:libudev:1:/dev/bus/usb/001/016)
pcscd[38448]: 00000004 readerfactory.c:376:RFAddReader() Yubico YubiKey OTP+FIDO+CCID init failed.
pcscd[38448]: 65084277 ccid_usb.c:857:WriteUSB() write failed (1/16): -4 LIBUSB_ERROR_NO_DEVICE
pcscd[38448]: 03800384 ifdhandler.c:150:CreateChannelByNameOrChannel() failed

Comment 4 kushaldas@gmail.com 2020-11-18 04:00:12 UTC
I am also stuck in the same problem, and the sad news is that restarting pcscd is not helping from last night.


Nov 18 09:26:13 localhost.localdomain systemd[1]: Started PC/SC Smart Card Daemon.
Nov 18 09:26:13 localhost.localdomain pcscd[23254]: 00000000 ifdhandler.c:150:CreateChannelByNameOrChannel() failed
Nov 18 09:26:13 localhost.localdomain pcscd[23254]: 00000074 readerfactory.c:1105:RFInitializeReader() Open Port 0x200000 Failed (usb:1050/0407:libudev:0:/dev/bus/usb/001/016)
Nov 18 09:26:13 localhost.localdomain pcscd[23254]: 00000003 readerfactory.c:376:RFAddReader() Yubico YubiKey OTP+FIDO+CCID init failed.
Nov 18 09:26:13 localhost.localdomain pcscd[23254]: 00005652 ifdhandler.c:150:CreateChannelByNameOrChannel() failed
Nov 18 09:26:13 localhost.localdomain pcscd[23254]: 00000014 readerfactory.c:1105:RFInitializeReader() Open Port 0x200000 Failed (usb:1050/0407:libudev:1:/dev/bus/usb/001/016)
Nov 18 09:26:13 localhost.localdomain pcscd[23254]: 00000002 readerfactory.c:376:RFAddReader() Yubico YubiKey OTP+FIDO+CCID init failed.

Comment 5 Gaël Chamoulaud 2020-11-18 13:08:24 UTC
I have the same problem since I migrated to Fedora 33. It was working like a charm in 31 and 32!

Nov 18 14:06:14 olivia.strider.local pcscd[469535]: 00000003 readerfactory.c:376:RFAddReader() Yubico YubiKey OTP+FIDO+CCID init failed.
Nov 18 14:06:17 olivia.strider.local pcscd[469535]: 02987958 ccid_usb.c:857:WriteUSB() write failed (1/31): -4 LIBUSB_ERROR_NO_DEVICE
Nov 18 14:06:17 olivia.strider.local pcscd[469535]: 00000024 ifdwrapper.c:364:IFDStatusICC() Card not transacted: 617
Nov 18 14:06:18 olivia.strider.local pcscd[469535]: 01000347 ccid_usb.c:857:WriteUSB() write failed (1/31): -4 LIBUSB_ERROR_NO_DEVICE
Nov 18 14:06:23 olivia.strider.local pcscd[469535]: 05742805 ifdhandler.c:150:CreateChannelByNameOrChannel() failed
Nov 18 14:06:23 olivia.strider.local pcscd[469535]: 00000064 readerfactory.c:1105:RFInitializeReader() Open Port 0x200000 Failed (usb:1050/0407:libudev:0:/dev/bus/usb/001/032)
Nov 18 14:06:23 olivia.strider.local pcscd[469535]: 00000004 readerfactory.c:376:RFAddReader() Yubico YubiKey OTP+FIDO+CCID init failed.
Nov 18 14:06:23 olivia.strider.local pcscd[469535]: 00031708 ifdhandler.c:150:CreateChannelByNameOrChannel() failed
Nov 18 14:06:23 olivia.strider.local pcscd[469535]: 00000010 readerfactory.c:1105:RFInitializeReader() Open Port 0x200001 Failed (usb:1050/0407:libudev:1:/dev/bus/usb/001/032)
Nov 18 14:06:23 olivia.strider.local pcscd[469535]: 00000003 readerfactory.c:376:RFAddReader() Yubico YubiKey OTP+FIDO+CCID init failed.

Comment 6 niemand 2020-11-18 22:04:22 UTC
I can confirm the issue for Fedora 33. Also, the common fix proposed in [1] does not work for me :/

Nov 18 23:00:47 fedora33 pcscd[3958]: 17465950 ccid_usb.c:1420:InterruptStop() libusb_cancel_transfer failed: LIBUSB_ERROR_NO_DEVICE
Nov 18 23:00:48 fedora33 pcscd[3958]: 00400597 ccid_usb.c:857:WriteUSB() write failed (6/7): -4 LIBUSB_ERROR_NO_DEVICE
Nov 18 23:00:51 fedora33 pcscd[3958]: 03056390 ifdhandler.c:150:CreateChannelByNameOrChannel() failed
Nov 18 23:00:51 fedora33 pcscd[3958]: 00000026 readerfactory.c:1105:RFInitializeReader() Open Port 0x200001 Failed (usb:1050/0407:libudev:0:/dev/bus/usb/006/008)
Nov 18 23:00:51 fedora33 pcscd[3958]: 00000006 readerfactory.c:376:RFAddReader() Yubico YubiKey OTP+FIDO+CCID init failed.
Nov 18 23:00:51 fedora33 pcscd[3958]: 00037002 ifdhandler.c:150:CreateChannelByNameOrChannel() failed
Nov 18 23:00:51 fedora33 pcscd[3958]: 00000026 readerfactory.c:1105:RFInitializeReader() Open Port 0x200002 Failed (usb:1050/0407:libudev:1:/dev/bus/usb/006/008)
Nov 18 23:00:51 fedora33 pcscd[3958]: 00000006 readerfactory.c:376:RFAddReader() Yubico YubiKey OTP+FIDO+CCID init failed.

[1] https://ludovicrousseau.blogspot.com/2019/06/gnupg-and-pcsc-conflicts.html

Comment 7 Taavi 2020-11-19 08:05:04 UTC
Upstream says that there are regressions in 2.2.23: https://dev.gnupg.org/T5143

Comment 8 Taavi 2020-11-19 08:06:27 UTC
Regressions in gpg 2.2.23*

It's possible the two aren't wholly unrelated

Comment 9 Gaël Chamoulaud 2020-11-19 08:12:01 UTC
(In reply to niemand from comment #6)
> I can confirm the issue for Fedora 33. Also, the common fix proposed in [1]
> does not work for me :/
> 
> Nov 18 23:00:47 fedora33 pcscd[3958]: 17465950
> ccid_usb.c:1420:InterruptStop() libusb_cancel_transfer failed:
> LIBUSB_ERROR_NO_DEVICE
> Nov 18 23:00:48 fedora33 pcscd[3958]: 00400597 ccid_usb.c:857:WriteUSB()
> write failed (6/7): -4 LIBUSB_ERROR_NO_DEVICE
> Nov 18 23:00:51 fedora33 pcscd[3958]: 03056390
> ifdhandler.c:150:CreateChannelByNameOrChannel() failed
> Nov 18 23:00:51 fedora33 pcscd[3958]: 00000026
> readerfactory.c:1105:RFInitializeReader() Open Port 0x200001 Failed
> (usb:1050/0407:libudev:0:/dev/bus/usb/006/008)
> Nov 18 23:00:51 fedora33 pcscd[3958]: 00000006
> readerfactory.c:376:RFAddReader() Yubico YubiKey OTP+FIDO+CCID init failed.
> Nov 18 23:00:51 fedora33 pcscd[3958]: 00037002
> ifdhandler.c:150:CreateChannelByNameOrChannel() failed
> Nov 18 23:00:51 fedora33 pcscd[3958]: 00000026
> readerfactory.c:1105:RFInitializeReader() Open Port 0x200002 Failed
> (usb:1050/0407:libudev:1:/dev/bus/usb/006/008)
> Nov 18 23:00:51 fedora33 pcscd[3958]: 00000006
> readerfactory.c:376:RFAddReader() Yubico YubiKey OTP+FIDO+CCID init failed.
> 
> [1]
> https://ludovicrousseau.blogspot.com/2019/06/gnupg-and-pcsc-conflicts.html

Yes using disable-ccid in scdaemon.conf doesn't work at all. Only restarting the pcscd.socket works!

Comment 10 Taavi 2020-11-19 09:35:04 UTC
I installed gnupg 2.2.24 and it seems to work a bit better, it would be nice if that update is released to everyone ASAP.

Comment 11 niemand 2020-11-24 13:30:26 UTC
(In reply to Taavi from comment #10)
> I installed gnupg 2.2.24 and it seems to work a bit better, it would be nice
> if that update is released to everyone ASAP.

The update to gnupg 2.2.24 just landed on my machine (Fedora 33) and now the key is recognized as expected.

Comment 12 Hamid Noroozi 2020-12-15 15:50:00 UTC
I still have the issue with gnupg 2.2.25 and pcsc-lite 1.9.0. on Fedora 33.

# gpg2 --card-status
gpg: selecting card failed: No such device
gpg: OpenPGP card not available: No such device

logs:
dec 15 16:45:56 xxx pcscd[2375]: 10517237 ifdhandler.c:150:CreateChannelByNameOrChannel() failed
dec 15 16:45:56 xxx pcscd[2375]: 00000394 readerfactory.c:1105:RFInitializeReader() Open Port 0x200000 Failed (usb:1050/0407:libudev:0:/dev/bus/usb/001/010)
dec 15 16:45:56 xxx pcscd[2375]: 00000007 readerfactory.c:376:RFAddReader() Yubico YubiKey OTP+FIDO+CCID init failed.
dec 15 16:45:56 xxx pcscd[2375]: 00006166 ifdhandler.c:150:CreateChannelByNameOrChannel() failed
dec 15 16:45:56 xxx pcscd[2375]: 00000012 readerfactory.c:1105:RFInitializeReader() Open Port 0x200000 Failed (usb:1050/0407:libudev:1:/dev/bus/usb/001/010)
dec 15 16:45:56 xxx pcscd[2375]: 00000002 readerfactory.c:376:RFAddReader() Yubico YubiKey OTP+FIDO+CCID init failed.

Comment 13 christian.naumer 2021-01-16 21:14:07 UTC
I also have this problem not only with pnupg but also with Thunderbird or the yubikey authenticator. All those applications hang sometimes and only a restart of pcscd helps for a while. I see the same errors as in the posts above.

Comment 14 Ivan Tomica 2021-01-25 17:18:03 UTC
It would appear this issue is also discussed in https://bugzilla.redhat.com/show_bug.cgi?id=1893131 , so perhaps those two can/should be merged together?

Comment 15 Ivan Tomica 2021-01-25 17:38:30 UTC
Continuing discussion, I have had the same issue ever since I've updated to the Fedora 33 (from 32). The issue was that my Yubikey wasn't recognized as GPG smartcard without opensc package, so I had to:

sudo dnf install opensc

And then configure my GNUPG

cat <<EOF > ~/.gnupg/scdaemon.conf
pcsc-driver /usr/lib64/libpcsclite.so.1
card-timeout 5
disable-ccid
EOF

In addition to that I also have following in my /etc/opensc.conf

card_attr SERIAL:NUMBER:... {
	name = "YubiKey 5 NFC"
	driver = "openpgp"
}

Where SERIAL:NUMBER... part is the output of

pcsc_scan
00 00 00 00 00 00 00 00 00...

Disabling and removing packages related to opensc/pcsc-lite results in Yubikey not being visible at all. This is the only way I've found it works for me, but as others mentioned, I have to restart openscd.service after each reboot...

Comment 16 Ben Cotton 2021-11-04 16:01:29 UTC
This message is a reminder that Fedora 33 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 33 on 2021-11-30.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '33'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 33 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 17 KirillP 2021-11-08 12:34:48 UTC
Fedora 35 Workstation has the same issue.

Comment 18 KirillP 2021-11-08 12:42:01 UTC
Created attachment 1840702 [details]
pcscd debug log for issue 1853347

Full pcscd debug log for issue 1853347 (Fedora 35 WS)

Comment 19 Jakub Jelen 2021-11-08 15:52:49 UTC
(In reply to KirillP from comment #17)
> Fedora 35 Workstation has the same issue.

Can you described your "same issue"? This bug already discussed several different issues over the span of one and half year.

The Fedora 35 got recently update of gnupg2 which should avoid similar issues.

Comment 20 KirillP 2021-11-08 16:11:06 UTC
1) Install the new Fedora 35 Workstation.
2) Install updates.
3) Boot up the computer with the connected Yubikey.
4) When trying to access gpg --card-status says No such device.

If you pull out the Yubikey and insert it back. Nothing changes.
If you restart the pcscd service. It works fine.

Comment 21 Jakub Jelen 2021-11-09 08:15:01 UTC
Does it work for you with pcsc-shared option in the ~/.gnupg/scdaemon.conf ?

Comment 22 KirillP 2021-11-09 12:34:22 UTC
When adding pcsc-shared to ~/.gnupg/scdaemon.conf. gpg --card-status is working. Thank you.

But SSH doesn't see the key on Yubikey.
I'm experimenting and trying to figure out why.
In other distributions that I have used before. Such problems have never happened.

Comment 23 Bob Relyea 2021-11-10 17:37:29 UTC

*** This bug has been marked as a duplicate of bug 1893131 ***


Note You need to log in before you can comment on or make changes to this bug.