Nk3 uprade fails with usbguard enabled (solved)

Observation:

I run my systems with usbguard as USB device firewall.
with default block all. which complicates things.
only stopping usbguard for a short wile doesn’t suffice.

In that case even when a device is allowed in both in nk3 ACM mode as well as in bootloader mode
the software fails as it is slightly too fast in opening the hidrawX device.

Even then there is an error:

Command line tool to interact with Nitrokey devices 0.6.0
Do you want to download the firmware version v1.7.2? [Y/n]: y
Download v1.7.2: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1.02M/1.02M [00:00<00:00, 2.42MB/s]
Current firmware version:  [unknown]
Updated firmware version:  v1.7.2

Please do not remove the Nitrokey 3 or insert any other Nitrokey 3 devices during the update. Doing so may damage the Nitrokey 3.
Do you want to perform the firmware update now? [y/N]: y
Perform firmware update: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 515k/515k [00:05<00:00, 86.6kB/s]
Finalize upgrade:  98%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Š  | 98/100 [00:30<00:00,  3.22%/s]
Critical error:
No NK3 device found

--------------------------------------------------------------------------------
Critical error occurred, exiting now
Unexpected? Is this a bug? Would you like to get support/help?
- You can report issues at: https://support.nitrokey.com/
- Writing an e-mail to support@nitrokey.com is also possible
- Please attach the log: '/tmp/nitropy.log.v_00h44d' with any support/help request!
- Please check if you have udev rules installed: https://docs.nitrokey.com/nitrokey3/linux/firmware-update.html#troubleshooting
566        INFO pynitrokey.cli Timestamp: 2024-10-15 22:43:22.132939
566        INFO pynitrokey.cli OS: uname_result(system='Linux', node='laptop-7', release='6.6.52-gentoo-x86_64', version='#1 SMP PREEMPT_DYNAMIC Sun Oct 13 12:10:56 CEST 2024', machine='x86_64')
567        INFO pynitrokey.cli Python version: 3.12.6
567        INFO pynitrokey.cli Cli arguments: ['nk3', 'update']
570        INFO pynitrokey.cli pynitrokey version: 0.6.0
572        INFO pynitrokey.cli cryptography version: 43.0.1
574        INFO pynitrokey.cli ecdsa version: 0.19.0
576        INFO pynitrokey.cli fido2 version: 1.1.3
577        INFO pynitrokey.cli pyusb version: 1.2.1
603        INFO nitrokey.trussed._bootloader.lpc55_upload.mboot.mcuboot Connect: identifier='usb', device=USB COMPOSITE DEVICE (0x20A0, 0x42DD)path=b'/dev/hidraw2'
603       DEBUG nitrokey.trussed._bootloader.lpc55_upload.utils.interfaces.device.usb_device Opening the Interface: USB COMPOSITE DEVICE (0x20A0, 0x42DD)path=b'/dev/hidraw2'
603        INFO nitrokey.nk3.updates Firmware version before update: 
606       DEBUG urllib3.connectionpool Starting new HTTPS connection (1): api.github.com:443
793       DEBUG urllib3.connectionpool https://api.github.com:443 "GET /repos/Nitrokey/nitrokey-3-firmware/releases/latest HTTP/1.1" 200 1977
794        INFO nitrokey.nk3.updates Latest firmware version: v1.7.2
794        INFO nitrokey.nk3.updates Current firmware version: None
794        INFO nitrokey.nk3.updates Updated firmware version: v1.7.2
2325       INFO nitrokey.nk3.updates Trying to download firmware update from URL: https://github.com/Nitrokey/nitrokey-3-firmware/releases/download/v1.7.2/firmware-nk3-v1.7.2.zip
2327      DEBUG urllib3.connectionpool Starting new HTTPS connection (1): github.com:443
2541      DEBUG urllib3.connectionpool https://github.com:443 "GET /Nitrokey/nitrokey-3-firmware/releases/download/v1.7.2/firmware-nk3-v1.7.2.zip HTTP/1.1" 302 0
2542      DEBUG urllib3.connectionpool Starting new HTTPS connection (1): objects.githubusercontent.com:443
2915      DEBUG urllib3.connectionpool https://objects.githubusercontent.com:443 "GET /github-production-release-asset-2e65be/366410832/1ac1c61d-8a27-47ad-bb07-b220bde51882?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=releaseassetproduction%2F20241015%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20241015T204324Z&X-Amz-Expires=300&X-Amz-Signature=464430e16ebb52b99470b1f1c8165e7cebd46283ed341455fd8465c3c2b55f9f&X-Amz-SignedHeaders=host&response-content-disposition=attachment%3B%20filename%3Dfirmware-nk3-v1.7.2.zip&response-content-type=application%2Foctet-stream HTTP/1.1" 200 1019935
3349      DEBUG       root print: Current firmware version:  [unknown]
3349      DEBUG       root print: Updated firmware version:  v1.7.2
3349      DEBUG       root print: Please do not remove the Nitrokey 3 or insert any other Nitrokey 3 devices during the update. Doing so may damage the Nitrokey 3.
8869      DEBUG nitrokey.nk3.updates Starting firmware update
8869       INFO nitrokey.trussed._bootloader.lpc55_upload.mboot.mcuboot CMD: ReceiveSBfile(data_length=514928)
8869       INFO nitrokey.trussed._bootloader.lpc55_upload.mboot.mcuboot CMD: GetProperty(MaxPacketSize, index=0)
8869      DEBUG nitrokey.trussed._bootloader.lpc55_upload.mboot.mcuboot TX-PACKET: Tag=GetProperty, Flags=0x00, P[0]=0x0000000B, P[1]=0x00000000
8869      DEBUG nitrokey.trussed._bootloader.lpc55_upload.mboot.protocol.bulk_protocol OUT[16]: 01, 00, 0C, 00, 07, 00, 00, 02, 0B, 00, 00, 00, 00, 00, 00, 00
8874      DEBUG nitrokey.trussed._bootloader.lpc55_upload.mboot.protocol.bulk_protocol IN [60]: 03, 00, 0C, 00, A7, 00, 00, 02, 00, 00, 00, 00, 38, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
8874      DEBUG nitrokey.trussed._bootloader.lpc55_upload.mboot.mcuboot RX-PACKET: Tag=GetPropertyResponse, Status=Success, v0=0x00000038
8874       INFO nitrokey.trussed._bootloader.lpc55_upload.mboot.mcuboot CMD: Status: 0 (0x0) Success.
8874       INFO nitrokey.trussed._bootloader.lpc55_upload.mboot.mcuboot CMD: Max Packet Size = 56
8882      DEBUG nitrokey.trussed._bootloader.lpc55_upload.mboot.mcuboot TX-PACKET: Tag=ReceiveSBFile, Flags=0x01, P[0]=0x0007DB70
8882      DEBUG nitrokey.trussed._bootloader.lpc55_upload.mboot.protocol.bulk_protocol OUT[12]: 01, 00, 08, 00, 08, 01, 00, 01, 70, DB, 07, 00
8883      DEBUG nitrokey.trussed._bootloader.lpc55_upload.mboot.protocol.bulk_protocol IN [60]: 03, 00, 0C, 00, A0, 00, 00, 02, 00, 00, 00, 00, 08, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
8883      DEBUG nitrokey.trussed._bootloader.lpc55_upload.mboot.mcuboot RX-PACKET: Tag=GenericResponse, Status=Success, Cmd=ReceiveSBFile
8883       INFO nitrokey.trussed._bootloader.lpc55_upload.mboot.mcuboot CMD: Status: 0 (0x0) Success.
8885      DEBUG nitrokey.trussed._bootloader.lpc55_upload.mboot.protocol.bulk_protocol OUT[60]: 02, 00, 38, 00, BE, 3F, 91, 32, F3, 56, AC, AA, 66, 5F, 86, E5, 63, 57, 95, 72, BA, 47, C8, 2C, 53, 54, 4D, 50, 02, 01, 08, 00, B7, 7D, 00, 00, E4, 00, 00, 00, 00, 00, 00, 00, D0, 00, 00, 00, 06, 00, 08, 00, 05, 00, 01, 00, 73, 67, 74, 6C
8887      DEBUG nitrokey.trussed._bootloader.lpc55_upload.mboot.protocol.bulk_protocol OUT[60]: 02, 00, 38, 00, 80, 2D, 6F, 23, AA, BD, 02, 00, 00, 01, 00, 00, 00, 07, 00, 00, 00, 02, 00, 00, 00, 01, 00, 00, 00, 07, 00, 00, 00, 02, 00, 00, 01, 00, 00, 00, FC, 3B, E2, 0D, 62, E4, D2, D0, 57, 2D, 6B, 41, B0, 9E, A4, 09, DA, 01, 16, 95
8890      DEBUG nitrokey.trussed._bootloader.lpc55_upload.mboot.protocol.bulk_protocol OUT[60]: 02, 00, 38, 00, 8F, C0, 3F, 50, 0D, EA, BC, 7D, A3, 76, 2E, B5, B3, F2, 46, EF, 19, F4, 27, F2, 4D, 84, 94, 07, 14, 8B, E2, 37, 55, 12, 40, 7F, D9, 09, E3, 29, 10, EC, 74, 19, 3E, 45, 90, 4B, A0, 91, FA, E9, 82, BD, E9, 40, FC, 19, 9D, 6D
8891      DEBUG nitrokey.trussed._bootloader.lpc55_upload.mboot.protocol.bulk_protocol OUT[60]: 02, 00, 38, 00, 4F, EA, 75, 3B, 1B, 76, 2B, E7, 2E, C3, 4A, 98, 65, C2, 2A, 46, E6, 3F, E2, 71, C6, AC, 49, 69, 8F, E0, 86, C8, 65, 58, BD, 40, 00, 00, 00, 00, 00, 00, 00, 00, 63, 65, 72, 74, 01, 00, 00, 00, 20, 00, 00, 00, 00, 00


...... SNIP a lot of data
14832     DEBUG nitrokey.trussed._bootloader.lpc55_upload.mboot.protocol.bulk_protocol OUT[60]: 02, 00, 38, 00, 83, 48, 86, A0, 99, C8, 52, 77, 93, CC, 21, AB, A8, D2, 9A, 7A, 14, 2E, F5, F2, 6B, F9, DA, A2, 04, 71, AB, F2, 35, EF, 4E, DC, 20, F8, 6A, 60, 05, 71, 85, 5C, CA, 24, 26, 43, 2B, B3, 26, 72, E3, B1, A3, EF, FE, 14, E2, 35
14832     DEBUG nitrokey.trussed._bootloader.lpc55_upload.mboot.protocol.bulk_protocol OUT[12]: 02, 00, 08, 00, 2B, 18, 51, 56, 8C, 58, E4, D5
14835     DEBUG nitrokey.trussed._bootloader.lpc55_upload.mboot.protocol.bulk_protocol IN [60]: 03, 00, 0C, 00, A0, 00, 00, 02, 00, 00, 00, 00, 08, 00, 00, 00, A8, D2, 9A, 7A, 14, 2E, F5, F2, 6B, F9, DA, A2, 04, 71, AB, F2, 35, EF, 4E, DC, 20, F8, 6A, 60, 05, 71, 85, 5C, CA, 24, 26, 43, 2B, B3, 26, 72, E3, B1, A3, EF, FE, 14, E2, 35
14835     DEBUG nitrokey.trussed._bootloader.lpc55_upload.mboot.mcuboot RX-PACKET: Tag=GenericResponse, Status=Success, Cmd=ReceiveSBFile
14835      INFO nitrokey.trussed._bootloader.lpc55_upload.mboot.mcuboot CMD: Successfully Send 514928 out of 514928 Bytes
14835     DEBUG nitrokey.trussed._bootloader.lpc55 Firmware update finished with status 0 (0x0) Success.
14835      INFO nitrokey.trussed._bootloader.lpc55_upload.mboot.mcuboot CMD: Reset MCU
14835     DEBUG nitrokey.trussed._bootloader.lpc55_upload.mboot.mcuboot TX-PACKET: Tag=Reset, Flags=0x00
14835     DEBUG nitrokey.trussed._bootloader.lpc55_upload.mboot.protocol.bulk_protocol OUT[8]: 01, 00, 04, 00, 0B, 00, 00, 00
14836     DEBUG nitrokey.trussed._bootloader.lpc55_upload.mboot.protocol.bulk_protocol IN [60]: 03, 00, 0C, 00, A0, 00, 00, 02, 00, 00, 00, 00, 0B, 00, 00, 00, A8, D2, 9A, 7A, 14, 2E, F5, F2, 6B, F9, DA, A2, 04, 71, AB, F2, 35, EF, 4E, DC, 20, F8, 6A, 60, 05, 71, 85, 5C, CA, 24, 26, 43, 2B, B3, 26, 72, E3, B1, A3, EF, FE, 14, E2, 35
14836     DEBUG nitrokey.trussed._bootloader.lpc55_upload.mboot.mcuboot RX-PACKET: Tag=GenericResponse, Status=Success, Cmd=Reset
14837      INFO nitrokey.trussed._bootloader.lpc55_upload.mboot.mcuboot CMD: Status: 0 (0x0) Success.
14837      INFO nitrokey.trussed._bootloader.lpc55_upload.mboot.mcuboot Closing: identifier='usb', device=USB COMPOSITE DEVICE (0x20A0, 0x42DD)path=b'/dev/hidraw2'
14837     DEBUG nitrokey.trussed._bootloader.lpc55_upload.utils.interfaces.device.usb_device Closing the Interface: USB COMPOSITE DEVICE (0x20A0, 0x42DD)path=b'/dev/hidraw2'
14837     DEBUG nitrokey.nk3.updates Firmware update finished successfully
14837     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 1 of 60)
14851     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
15351     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 2 of 60)
15361     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
15861     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 3 of 60)
15872     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
16372     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 4 of 60)
16382     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
16882     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 5 of 60)
16892     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
17393     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 6 of 60)
17402     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
17902     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 7 of 60)
17931     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
18431     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 8 of 60)
18456     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
18956     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 9 of 60)
18972     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
19472     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 10 of 60)
19489     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
19989     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 11 of 60)
19999     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
20499     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 12 of 60)
20509     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
21009     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 13 of 60)
21020     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
21520     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 14 of 60)
21537     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
22037     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 15 of 60)
22053     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
22553     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 16 of 60)
22564     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
23065     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 17 of 60)
23078     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
23578     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 18 of 60)
23588     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
24088     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 19 of 60)
24098     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
24598     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 20 of 60)
24621     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
25121     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 21 of 60)
25137     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
25637     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 22 of 60)
25654     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
26154     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 23 of 60)
26164     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
26664     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 24 of 60)
26674     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
27174     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 25 of 60)
27184     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
27684     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 26 of 60)
27699     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
28199     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 27 of 60)
28209     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
28709     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 28 of 60)
28719     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
29219     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 29 of 60)
29229     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
29730     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 30 of 60)
29745     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
30245     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 31 of 60)
30261     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
30761     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 32 of 60)
30778     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
31278     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 33 of 60)
31294     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
31794     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 34 of 60)
31811     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
32311     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 35 of 60)
32320     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
32821     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 36 of 60)
32831     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
33331     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 37 of 60)
33342     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
33843     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 38 of 60)
33853     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
34353     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 39 of 60)
34363     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
34863     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 40 of 60)
34873     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
35373     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 41 of 60)
35383     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
35883     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 42 of 60)
35896     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
36396     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 43 of 60)
36406     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
36906     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 44 of 60)
36917     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
37418     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 45 of 60)
37431     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
37931     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 46 of 60)
37941     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
38441     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 47 of 60)
38460     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
38962     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 48 of 60)
39013     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
39513     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 49 of 60)
39545     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
40047     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 50 of 60)
40075     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
40578     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 51 of 60)
40637     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
41137     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 52 of 60)
41147     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
41648     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 53 of 60)
41673     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
42173     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 54 of 60)
42195     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
42695     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 55 of 60)
42706     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
43206     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 56 of 60)
43222     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
43722     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 57 of 60)
43733     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
44234     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 58 of 60)
44254     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
44755     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 59 of 60)
44770     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
45270     DEBUG pynitrokey.cli.trussed Searching NK3 device (try 60 of 60)
45286     DEBUG pynitrokey.cli.trussed No NK3 device found, continuing
45287      INFO nitrokey.trussed._bootloader.lpc55_upload.mboot.mcuboot Closing: identifier='usb', device=USB COMPOSITE DEVICE (0x20A0, 0x42DD)path=b'/dev/hidraw2'
45287     DEBUG nitrokey.trussed._bootloader.lpc55_upload.utils.interfaces.device.usb_device Closing the Interface: USB COMPOSITE DEVICE (0x20A0, 0x42DD)path=b'/dev/hidraw2'
45287     DEBUG       root print: Critical error:
45287     DEBUG       root print: No NK3 device found
45287     DEBUG       root listing all connected devices:
45288     DEBUG       root :: 'Nitrokey FIDO2' keys
45288     DEBUG       root :: 'Nitrokey Start' keys:
45318     DEBUG       root :: 'NK3' keys
45328     DEBUG       root :: 'NKPK' keys
45343     DEBUG       root print: --------------------------------------------------------------------------------
45343     DEBUG       root print: Critical error occurred, exiting now
45343     DEBUG       root print: Unexpected? Is this a bug? Would you like to get support/help?
45343     DEBUG       root print: - You can report issues at: https://support.nitrokey.com/
45343     DEBUG       root print: - Writing an e-mail to support@nitrokey.com is also possible
45343     DEBUG       root print: - Please attach the log: '/tmp/nitropy.log.v_00h44d' with any support/help request!
45344     DEBUG       root print: - Please check if you have udev rules installed: https://docs.nitrokey.com/nitrokey3/linux/firmware-update.html#troubleshooting

somehow: the kernel disallows the device after update even if usbguard is stopped. (changed hash probably)
after enabling the usbguard with device allowed the key can be tested

$ .local/bin/nitropy nk3 test
Command line tool to interact with Nitrokey devices 0.6.0
Found 1 NK3 device(s):
- Nitrokey 3 at /dev/hidraw1

Running tests for Nitrokey 3 at /dev/hidraw1

[1/5]   uuid            UUID query                      SUCCESS         F9686132E66A065AB4A15C790DFAA578
[2/5]   version         Firmware version query          SUCCESS         v1.7.2
[3/5]   status          Device status                   SUCCESS         Status(init_status=<InitStatus: 0>, ifs_blocks=44, efs_blocks=465, variant=<Variant.LPC55: 1>)
Running SE050 test: |                                                                                                                                              
[4/5]   se050           SE050                           SUCCESS         SE050 firmware version: 3.1.1 - 1.11, (persistent: (31432,), transient_deselect: (607,), transient_reset: (592,))
Please press the touch button on the device ...
Please press the touch button on the device ...
[5/5]   fido2           FIDO2                           SUCCESS  

5 tests, 5 successful, 0 skipped, 0 failed

Summary: 1 device(s) tested, 1 successful, 0 failed

dmesg output of an insertion:

[207095.809027] usb 1-9: USB disconnect, device number 24
[207098.991505] usb 1-9: new full-speed USB device number 25 using xhci_hcd
[207099.133548] usb 1-9: New USB device found, idVendor=20a0, idProduct=42b2, bcdDevice= 1.07
[207099.133554] usb 1-9: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[207099.133556] usb 1-9: Product: Nitrokey 3
[207099.133558] usb 1-9: Manufacturer: Nitrokey
[207099.133837] usb 1-9: Device is not authorized for usage
[207099.140266] hid-generic 0003:20A0:42B2.0012: hiddev96,hidraw1: USB HID v1.11 Device [Nitrokey Nitrokey 3] on usb-0000:00:14.0-9/input1
[207099.140353] usb 1-9: authorized to connect
1 Like

Hmm, I’ve recently done a firmware upgrade on my NK3A from a QubesOS. Since I was doing the update from a DispVM, it disconnected the USB device from that VM during the key reboot, and thus, the installer failed with pretty much the same error message as yours. I’ve spoken to some people on Matrix about this, and they said that apparently the flash was successful. I’ve tested the device afterwards, and the tests passed as well. There was an error about internal flash or something, but upon replugging the device the status showed an OK message.

I was following this guide, which doesn’t mention anything about this particular error.
https://docs.nitrokey.com/nitrokey3/linux/firmware-update-qubes

@Jan, I pinged you on matrix about this, perhaps the firmware update pages should mention that usbguard or qubes might interfere with the nitropy installer.

Funny enough, I’ve done the same thing recently and had the same thing happen.

I realized what was happening and reconnected the NK3 back to the qube running app 2 (I wasn’t able to get nitropy working until later because of a dependency issue, even though I used Debian 12).

It took a few tries for me to realize what was going on with the update. I have to wonder if what came next was because it took a few tries for me to reconnect so it could happen.

I couldn’t resign my nitropad. The HOTP setup came back with an error.

The HEADS and gpg factory resets did nothing for the issue, though gpg was the tool that wasn’t working for this problem.

I finally managed to get nitropy working, after several days of figuring out why i couldn’t install it. Nitropy nk3 test came back with a fido2 error. So theoretically gpg was working fine.

I did a full factory reset and everything seems to be working now.

I have to wonder if it disconnecting a few times before I finished the update caused all of that.

No idea why gpg wasn’t working when fido2 had the error.

In the logging output it mentions the flash was successful.

14837 INFO nitrokey.trussed._bootloader.lpc55_upload.mboot.mcuboot Closing: identifier=β€˜usb’, device=USB COMPOSITE DEVICE (0x20A0, 0x42DD)path=b’/dev/hidraw2’
14837 DEBUG nitrokey.trussed._bootloader.lpc55_upload.utils.interfaces.device.usb_device Closing the Interface: USB COMPOSITE DEVICE (0x20A0, 0x42DD)path=b’/dev/hidraw2’
14837 DEBUG nitrokey.nk3.updates Firmware update finished successfully

So when the update process completed it was safe to remove the key.