yubikey-agent icon indicating copy to clipboard operation
yubikey-agent copied to clipboard

Failed to connect to the YubiKey

Open emtunc opened this issue 4 years ago • 3 comments

Successfully installed via brew. Services start successfully.

Tried re-plugging the Yubikey and restarting the machine.

Big Sur - 11.5.1

Failed to connect to the YubiKey: connecting to smart card: the smart card cannot be accessed because of other connections outstanding

Is there anything I can try to help troubleshoot?

emtunc avatar Aug 12 '21 00:08 emtunc

I seem to be having this same issue on 10.14.6, and I've used yubikey-agent on this machine for a while.

adamwolf avatar Aug 17 '21 18:08 adamwolf

I see the same thing on Linux after a suspend+resume.

Sep 30 17:46:53 gear yubikey-agent[1582313]: 2021/09/30 17:46:53 Reconnecting to the YubiKey...
Sep 30 17:46:53 gear yubikey-agent[1582313]: 2021/09/30 17:46:53 agent 11: could not reach YubiKey: selecting piv applet: command failed: transmitting request: an attempt was made to end a non-existent transaction
Sep 30 17:46:59 gear yubikey-agent[1582313]: 2021/09/30 17:46:59 Reconnecting to the YubiKey...
Sep 30 17:46:59 gear yubikey-agent[1582313]: 2021/09/30 17:46:59 agent 11: could not reach YubiKey: connecting to smart card: the smart card cannot be accessed because of other connections outstanding

lsof says that it's yubikey-agent itself that's interfering with it, as it's the only process with a connection to pcscd:

# lsof +E /run/pcscd/pcscd.comm
COMMAND       PID USER   FD   TYPE             DEVICE SIZE/OFF    NODE NAME
systemd         1 root  407u  unix 0xffff92d818ad1400      0t0   15896 /run/pcscd/pcscd.comm type=STREAM (LISTEN)
pcscd     1051350 root    3u  unix 0xffff92d818ad1400      0t0   15896 /run/pcscd/pcscd.comm type=STREAM (LISTEN)
pcscd     1051350 root   12u  unix 0xffff92e0878e5800      0t0 2722266 /run/pcscd/pcscd.comm type=STREAM ->INO=2719629 1582313,yubikey-a,8u (CONNECTED)
yubikey-a 1582313   tv    8u  unix 0xffff92e0878e1400      0t0 2719629 type=STREAM ->INO=2722266 1051350,pcscd,12u (CONNECTED)

For me, systemctl --user restart yubikey-agent gets it functioning immediately.

tv42 avatar Sep 30 '21 23:09 tv42