SCardEstablishContext: Service not available

GPG card wasn’t detected even though nitrokey was available?

running pscs_scan gave SCardEstablishContext: Service not available.

also pcsc_establish_context failed: no service (0x8010001d)

running gpg --card-status couldn’t detect card neither.

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

Running systemctl restart --user gpg-agent.service && gpgconf --reload scdaemon didn’t help.

But the device can be listed with lsusb.

Could it be some process repeatedly trying to use gpg? I’m not sure where else to look for errors.

My udev setup follows the guide: 41-nitrokey.rules

UPDATE: It’s working again now after rebooting it 4 times. Really strange and happened twice today. Would be really curious to find you how to diagnose this.

nitropy version

0.4.39

Current firmware version: v1.5.0
Nitrokey Pro 3A NFC and Nitrokey Pro 3A Mini

EndeavourOS (Arch)

I don’t know how your OS is configuring gpg and scdaemon, but you have to check if it is compiled with CCID support and needs direct access to the hardware via USB or does it need to use pcscd.

If pcscd is installed, there should be automated pcscd activation rule in systemd (socket activation).

To make GPG work with pcscd, you might need disable-ccid in your $HOME/.gnupg/gpg-agent.conf

More about this:

You might need to talk to your distribution maintainers if there are problems.

1 Like

Thank you for confirming, I think you are right that this is a system related issue and not Nitrokey. Since posting this 2 weeks ago this happened again only once, after kernel update, however this time reboot solved the issue.

Btrfs system snapshots come in very handy as well.

1 Like