Closed jasuarez closed 1 year ago
Thanks for the report! It looks like this is the root cause of the rror:
13452 DEBUG pynitrokey.nk3.updates Starting firmware update
13452 INFO spsdk.mboot.mcuboot CMD: ReceiveSBfile(data_length=316496)
13452 INFO spsdk.mboot.mcuboot CMD: GetProperty('MaxPacketSize', index=0)
13452 DEBUG spsdk.mboot.mcuboot TX-PACKET: Tag=GetProperty, Flags=0x00, P[0]=0x0000000B, P[1]=0x00000000
13452 DEBUG spsdk.mboot.interfaces.usb OUT[16]: 01, 00, 0C, 00, 07, 00, 00, 02, 0B, 00, 00, 00, 00, 00, 00, 00
13453 WARNING spsdk.mboot.mcuboot CMD: Unable to get MAX PACKET SIZE, using: 32
13453 INFO spsdk.mboot.mcuboot CMD: Max Packet Size = 32
13453 DEBUG spsdk.mboot.mcuboot TX-PACKET: Tag=ReceiveSBFile, Flags=0x01, P[0]=0x0004D450
13453 DEBUG spsdk.mboot.interfaces.usb OUT[12]: 01, 00, 08, 00, 08, 01, 00, 01, 50, D4, 04, 00
13454 INFO spsdk.mboot.mcuboot Closing: MCU HID GENERIC DEVICE (0x20A0, 0x42DD)
13454 DEBUG spsdk.mboot.interfaces.usb Close Interface
13454 DEBUG pynitrokey.nk3.updates Received connection error
Traceback (most recent call last):
File "/home/jasuarez/.local/lib/python3.11/site-packages/spsdk/mboot/interfaces/usb.py", line 214, in write
_bytes_written = self.device.Write(raw_data, timeout_ms=self.timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jasuarez/.local/lib/python3.11/site-packages/libusbsio/libusbsio.py", line 1357, in wrapper
self._check_device_open()
File "/home/jasuarez/.local/lib/python3.11/site-packages/libusbsio/libusbsio.py", line 1342, in _check_device_open
raise LIBUSBSIO_Exception("HID DEVICE is not open.")
libusbsio.libusbsio.LIBUSBSIO_Exception: LIBUSBSIO: HID DEVICE is not open.
Not sure what causes this. Have you installed a firmware update with that machine before? Is the error reproducible?
Yes, already upgrade the NK3 firmware to 1.2.2 with previous nitropy version (sorry, don't remember the version used).
I tried again multiple times, and everytime I get the same failure.
I've tried in a different host, and still the same issue.
For reference, I've installed nitropy with pip (pip3 install --user --upgrade pynitrokey
) and my host uses Fedora 37.
Can you please try installing pynitrokey in a virtual environment?
$ python3 -m venv /tmp/venv
$ source /tmp/venv/bin/activate
$ pip install pynitrokey
If this does not work either, please share the output of pip freeze
(from the venv).
Didn't work neither
(venv) jasuarez@consul:~$ pip freeze
appdirs==1.4.4
argparse-addons==0.12.0
asn1crypto==1.5.1
astunparse==1.6.3
bincopy==17.10.3
bitstring==3.1.9
capstone==4.0.2
certifi==2022.12.7
cffi==1.15.1
charset-normalizer==3.1.0
click==8.1.3
click-command-tree==1.1.0
click-option-group==0.5.5
cmsis-pack-manager==0.2.10
colorama==0.4.6
commentjson==0.9.0
crcmod==1.7
cryptography==36.0.2
deepmerge==0.3.0
ecdsa==0.18.0
fastjsonschema==2.16.3
fido2==1.1.1
fire==0.5.0
frozendict==2.3.7
future==0.18.3
hexdump==3.3
humanfriendly==10.0
idna==3.4
intelhex==2.3.0
intervaltree==3.1.0
Jinja2==3.0.3
lark-parser==0.7.8
libusb1==3.0.0
libusbsio==2.1.11
MarkupSafe==2.1.2
milksnake==0.1.5
naturalsort==1.5.1
nkdfu==0.2
oscrypto==1.3.0
prettytable==2.5.0
protobuf==3.20.3
psutil==5.9.4
pycparser==2.21
pycryptodome==3.17
pyelftools==0.29
pylink-square==0.11.1
pynitrokey==0.4.36
pyocd==0.31.0
pyocd-pemicro==1.1.5
pypemicro==0.1.11
pyserial==3.5
python-dateutil==2.7.5
pyusb==1.2.1
PyYAML==5.4.1
requests==2.28.2
ruamel.yaml==0.17.21
six==1.16.0
sly==0.4
sortedcontainers==2.4.0
spsdk==1.7.1
termcolor==2.2.0
tlv8==0.10.0
tqdm==4.65.0
typing_extensions==4.3.0
urllib3==1.26.15
wcwidth==0.2.6
I installed the same versions but could not reproduce the problem. Please try the following steps to make sure that the bootloader communication works:
$ nitropy nk3 reboot --bootloader
$ nitropy nk3 list
# output should include Nitrokey 3 Bootloader (LPC55) followed by the UUID
$ nitropy nk3 update
Now it worked! Thanks a lot!
Great! Though I’m not really sure what caused the problem. Please open a new issue if the problem happens again.
Not reopening this issue, but I keep having the same problem to update to v.1.4.0. Just following the steps to reboot first in bootloader mode worked.
Sounds like the problem still occurs. Let's reopen this one.
I’ve created a new issue with a more informative subject so that it is easier to find for users with a similar problem: https://github.com/Nitrokey/pynitrokey/issues/394
I was trying to update my nitrokey3 from 1.2.2 to 1.3.1 firmware version using nitropy (0.4.36), but it fails:
Exception encountered: RuntimeError("generator didn't stop after throw()")
Afterwards, if I try to get the device status, it shows me no device found; I need to re-attach it.
nitropy.log.nskbsyuu.gz