Table of Contents

, ,

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:

pcsc-driver /usr/lib/x86_64-linux-gnu/libpcsclite.so
card-timeout 5
disable-ccid

reader-port Yubico YubiKey OTP+FIDO+CCID 00 00
~$ 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
~$ 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

See also

References