Nitrokey / nitrokey-app2

Graphical application to manage and use Nitrokey 3 devices
https://www.nitrokey.com/products/nitrokeys
Apache License 2.0
79 stars 12 forks source link

No error message if insufficient rights to update firmware #73

Open Serafean opened 1 year ago

Serafean commented 1 year ago

Fails to update firmware, app message:

Exception ignored in: <generator object Updater._get_bootloader at 0x7f7a569b29e0>
Traceback (most recent call last):
  File "/home/martin/projects/nitrokey-app2/venv/lib/python3.11/site-packages/nitrokeyapp/pynitrokey_for_gui.py", line 223, in nk3_update
    info_frame.set_text("Failed to update Nitrokey 3.")
RuntimeError: generator ignored GeneratorExit

Right after touching the nitrokey to start the update, it reconnects to the computer with a different idProduct.

[ 5238.198952] usb 1-6: new full-speed USB device number 15 using xhci_hcd
[ 5238.368019] usb 1-6: New USB device found, idVendor=20a0, idProduct=42b2, bcdDevice= 1.02
[ 5238.368025] usb 1-6: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 5238.368028] usb 1-6: Product: Nitrokey 3
[ 5238.368030] usb 1-6: Manufacturer: Nitrokey
[ 5238.505140] hid-generic 0003:20A0:42B2.000E: hiddev100,hidraw9: USB HID v1.11 Device [Nitrokey Nitrokey 3] on usb-0000:05:00.1-6/input1
[ 5238.508052] cdc_acm 1-6:1.2: ttyACM0: USB ACM device
[ 5358.775169] usb 1-6: USB disconnect, device number 15
[ 5359.037111] usb 1-6: new high-speed USB device number 16 using xhci_hcd
[ 5359.178500] usb 1-6: New USB device found, idVendor=20a0, idProduct=42dd, bcdDevice= 3.00
[ 5359.178507] usb 1-6: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 5359.178510] usb 1-6: Product: USB COMPOSITE DEVICE
[ 5359.178511] usb 1-6: Manufacturer: NXP SEMICONDUCTOR INC.
[ 5359.264147] hid-generic 0003:20A0:42DD.000F: hiddev100,hidraw10: USB HID v1.00 Device [NXP SEMICONDUCTOR INC. USB COMPOSITE DEVICE] on usb-0000:05:00.1-6/input0

note USB disconnect, device number 15 , which signals I allowed the Nitrokey to update.

After physically reconnecting the nitrokey, nitropy nk3 test runs successfully, so I presume the nitrokey isn't dead :)

Serafean commented 1 year ago

Found the logs in /tmp , missing access rights to the hidraw device. nitropy.txt

Some kind of error message about this would be nice.

daringer commented 1 year ago

The underlying error is originating from pynitrokey there is an issue for that: https://github.com/Nitrokey/nitrokey-3-firmware/issues/250

Nevertheless I keep this open as such an error should: a) not crash the nitrokey-app b) some better error reporting should be in place