gpg: selecting card failed: No such device
Asked Answered
M

2

9

I have ubuntu 20.04 machine and installed gpg and related tools using below commad

sudo apt install gpg gnupg gnupg-pkcs11-scd

But when i run gpg --card-status, I get below error

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

Should I install anything else for this ?

Multifold answered 4/10, 2021 at 7:44 Comment(0)
S
8

It seems like pcscd.service is inactive by default, have you tried (re)starting it?

sudo service pcscd restart
Soubise answered 14/6, 2023 at 18:19 Comment(2)
in my case restarting gpg-agent didn't help and pcscd service was running. Only after restarting pcscd service I was able to read the key. I'm on Fedora 38, GPG v2.4.0, pcsc-lite v1.9.9Commorancy
Fedora 39, GPG v2.4.4, pcsc-lite v2.0.1 also requires pcscd restart after each hotplug of YubiKey.Gmur
B
8

Try forcing a restart of the gpg-agent with pkill gpg-agent

➜ gpg --card-status
gpg: selecting card failed: Service is not running
gpg: OpenPGP card not available: Service is not running

➜ pkill gpg-agent

➜ gpg --card-status
Reader ...........: Yubico YubiKey OTP FIDO CCID
...
Beatrizbeattie answered 6/12, 2021 at 20:4 Comment(1)
For me pkill gpg-agent did not work, but gpgconf --kill gpg-agent restarted the agent well and the yubikey start to work as expected.Appurtenant
S
8

It seems like pcscd.service is inactive by default, have you tried (re)starting it?

sudo service pcscd restart
Soubise answered 14/6, 2023 at 18:19 Comment(2)
in my case restarting gpg-agent didn't help and pcscd service was running. Only after restarting pcscd service I was able to read the key. I'm on Fedora 38, GPG v2.4.0, pcsc-lite v1.9.9Commorancy
Fedora 39, GPG v2.4.4, pcsc-lite v2.0.1 also requires pcscd restart after each hotplug of YubiKey.Gmur

© 2022 - 2024 — McMap. All rights reserved.