{{tag>yubikey yubico gpg}}
====== Yubikey gpg device not being recognized ======
When you insert your yubikey and if you get an error like:
~$ gpg --card-status
gpg: selecting card failed: No such device
gpg: OpenPGP card not available: No such device
but running the same command with sudo it works, make sure you check the following:
* add this to ~/.gnupg/scdaemon.conf
pcsc-driver /usr/lib/x86_64-linux-gnu/libpcsclite.so
card-timeout 5
disable-ccid
reader-port Yubico YubiKey OTP+FIDO+CCID 00 00
* check the status of pcscd services
~$ systemctl status pcscd.service pcscd.socket
● pcscd.service - PC/SC Smart Card Daemon
Loaded: loaded (/usr/lib/systemd/system/pcscd.service; indirect; preset: enabled)
Active: active (running) since Mon 2025-08-11 13:47:00 CEST; 13min ago
TriggeredBy: ● pcscd.socket
Docs: man:pcscd(8)
Main PID: 39069 (pcscd)
Tasks: 10 (limit: 76279)
Memory: 2.0M (peak: 3.3M)
CPU: 291ms
CGroup: /system.slice/pcscd.service
└─39069 /usr/sbin/pcscd --foreground --auto-exit
Aug 11 13:47:00 antisa-t14 systemd[1]: Started pcscd.service - PC/SC Smart Card Daemon.
Aug 11 13:47:00 antisa-t14 (pcscd)[39069]: pcscd.service: Referenced but unset environment variable evaluates to an empty string: P>
● pcscd.socket - PC/SC Smart Card Daemon Activation Socket
Loaded: loaded (/usr/lib/systemd/system/pcscd.socket; enabled; preset: enabled)
Active: active (running) since Mon 2025-08-11 13:47:00 CEST; 13min ago
Triggers: ● pcscd.service
Listen: /run/pcscd/pcscd.comm (Stream)
CGroup: /system.slice/pcscd.socket
* you probable also need the polkit rule file
~$ sudo cat /etc/polkit-1/rules.d/10-pcsc-custom.rules
polkit.addRule(function(action, subject) {
if (action.id == "org.debian.pcsc-lite.access_card" &&
subject.isInGroup("root")) {
return polkit.Result.YES;
}
});
polkit.addRule(function(action, subject) {
if (action.id == "org.debian.pcsc-lite.access_pcsc" &&
subject.isInGroup("root")) {
return polkit.Result.YES;
}
});
Restart the polkit.service after adding above.
====== Tested on ======
* YubiKey 5C (5.7.4) [OTP+FIDO+CCID]
* Ubuntu 24.04
* Toshiba Laptop T14 with additional smart card reader ''Bus 003 Device 018: ID 2ce3:9563 Generic EMV Smartcard Reader''
====== See also ======
====== References ======
* https://bugs.launchpad.net/ubuntu/+source/gnupg2/+bug/2061708
* https://ludovicrousseau.blogspot.com/2019/06/gnupg-and-pcsc-conflicts.html
* https://wiki.archlinux.org/title/GnuPG#Using_a_smart_card_on_a_remote_client