Pgp --card-status doesn't see the card

Hi,
my Nitrokey doesn’t seem to be recognized by gpg anymore.
$ gpg --card-status
gpg: selecting card failed: No such device
gpg: OpenPGP card not available: No such device

I have seen something similar in the past but killing scdaemon and stopping pcscd, re-plugging the card and starting pcscd helped. This doesn’t seem to be the case anymore. The card is still recognized by the kernel:
[ 2343.562109] usb 1-3: USB disconnect, device number 17
[ 2383.777707] usb 1-3: new full-speed USB device number 18 using xhci_hcd
[ 2383.929078] usb 1-3: New USB device found, idVendor=20a0, idProduct=4211, bcdDevice= 2.00
[ 2383.929083] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2383.929085] usb 1-3: Product: Nitrokey Start
[ 2383.929086] usb 1-3: Manufacturer: Nitrokey
[ 2383.929088] usb 1-3: SerialNumber: FSIJ-1.2.6-67143952

scdaemon log says this:
2021-10-12 17:01:01 scdaemon[11872] listening on socket ‘/run/user/1000/gnupg/S.scdaemon’
2021-10-12 17:01:01 scdaemon[11872] handler for fd -1 started
2021-10-12 17:01:01 scdaemon[11872] DBG: chan_7 → OK GNU Privacy Guard’s Smartcard server ready
2021-10-12 17:01:01 scdaemon[11872] DBG: chan_7 ← GETINFO socket_name
2021-10-12 17:01:01 scdaemon[11872] DBG: chan_7 → D /run/user/1000/gnupg/S.scdaemon
2021-10-12 17:01:01 scdaemon[11872] DBG: chan_7 → OK
2021-10-12 17:01:01 scdaemon[11872] DBG: chan_7 ← OPTION event-signal=12
2021-10-12 17:01:01 scdaemon[11872] DBG: chan_7 → OK
2021-10-12 17:01:01 scdaemon[11872] DBG: chan_7 ← GETINFO version
2021-10-12 17:01:01 scdaemon[11872] DBG: chan_7 → D 2.2.27
2021-10-12 17:01:01 scdaemon[11872] DBG: chan_7 → OK
2021-10-12 17:01:01 scdaemon[11872] DBG: chan_7 ← SERIALNO
2021-10-12 17:01:01 scdaemon[11872] DBG: enter: apdu_open_reader: portstr=(null)
2021-10-12 17:01:01 scdaemon[11872] detected reader ‘Alcor Micro AU9560 00 00’
2021-10-12 17:01:01 scdaemon[11872] detected reader ‘Nitrokey Nitrokey Start (FSIJ-1.2.6-67143952) 01 00’
2021-10-12 17:01:01 scdaemon[11872] reader slot 0: not connected
2021-10-12 17:01:01 scdaemon[11872] DBG: leave: apdu_open_reader => slot=0 [pc/sc]
2021-10-12 17:01:01 scdaemon[11872] DBG: enter: apdu_connect: slot=0
2021-10-12 17:01:01 scdaemon[11872] reader slot 0: not connected
2021-10-12 17:01:01 scdaemon[11872] DBG: leave: apdu_connect => sw=0x10008
2021-10-12 17:01:01 scdaemon[11872] DBG: enter: apdu_close_reader: slot=0
2021-10-12 17:01:01 scdaemon[11872] DBG: enter: apdu_disconnect: slot=0
2021-10-12 17:01:01 scdaemon[11872] DBG: leave: apdu_disconnect => sw=0x0
2021-10-12 17:01:01 scdaemon[11872] DBG: leave: apdu_close_reader => 0x0 (close_reader)
2021-10-12 17:01:01 scdaemon[11872] DBG: chan_7 → ERR 100696144 No such device
2021-10-12 17:01:01 scdaemon[11872] DBG: chan_7 ← RESTART
2021-10-12 17:01:01 scdaemon[11872] DBG: chan_7 → OK

I have seen a similar report Is my nitrokey a brick now? but this one turned out to be a dead HW.

Any hints on how to debug this further?

gpg --card-status
gpg: selecting card failed: No such device
gpg: OpenPGP card not available: No such device .
same happen with my devices . anyone who can guide how to resolve that issue.

I’ve had that too. What helped here was to run scdaemon with the --disable-ccid option, which can be done by adding

disable-ccid

to ~/.gnupg/scdaemon.conf
Once done, it is important to kill all running scdaemon processes (or reboot) before trying again.

1 Like

does not work the disable-ccid command

First of all, we have to rule out whether the Nitrokey works or not.

  1. What kind of Nitrokey are you using? Which firmware?
  2. What operating system do you have?

E.g.

root@debian:~# cat /etc/debian_version
12.5
  1. If you’re on Linux…
    3.1 what shows up in the dmesg when you plug in the device?
root@debian:~# dmesg
[  897.324039] usb 2-2: new full-speed USB device number 3 using ohci-pci
[  897.878439] usb 2-2: New USB device found, idVendor=20a0, idProduct=42b2, bcdDevice= 1.07
[  897.878446] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  897.878448] usb 2-2: Product: Nitrokey 3
[  897.878450] usb 2-2: Manufacturer: Nitrokey
[  897.910830] hid-generic 0003:20A0:42B2.0002: hiddev0,hidraw1: USB HID v1.11 Device [Nitrokey Nitrokey 3] on usb-0000:00:06.0-2/input1

3.2 Did you set up the Nitrokey udev rules and check if nitropy recognizes the device?

apt install -y python3 python3-venv
python3 -m venv venv
source venv/bin/activate
pip install pipx
pipx install pynitrokey
pipx ensurepath
bash
export ALLOW_ROOT=1
nitropy nk3 list
Command line tool to interact with Nitrokey devices 0.4.47
:: 'Nitrokey 3' keys
/dev/hidraw1: Nitrokey 3 3Bxxxxxxxxxxxxxxxxxxxxx72

3.3 Does it work as root user to rule out permission issues?
4. Anything different since your Nitrokey last worked?
5. The case and the USB connector are in good shape?
6. Did you check another USB port without extension cable and USB hub?
7. Does the issue persist on latest Debian booted from Live DVD?
8. Does the issue persist on another computer?

Then the specific configuration for gnupg can be sorted out.

1 Like