Nitrokey Start - benötigte Linux-Pakete für Fimwareupdate

Hallo,

habe hier schon mal nachgefragt, da ich aber den Konto gelöscht, wurde der Beitrag auch gelöscht.
Also Nochmal:
Ich benutze Linux Mint 19.3.
scdaemon, gpg2, Python 2.7.17 Pakete sind installiert. Welche fehlen noch?
Fimwareversion: 1.2.10
Nach dem ich den Befehl

./upgrade_by_passwd.py -f ../prebuilt/RTM.7/{regnual.bin,gnuk.bin}
eingebe bekomme ich folgenden Fehler.
ModuleNotFoundError: No module named 'usb'.

Danke schön

Hi @Stanok!

Sorry for confusion. Please take a look at:

Could you link here the help page you have taken the command from? We will update it.

@jan @nitroalex Could this be added to documentation? I will update the README file and program messages.

Ich kann den Link nicht ansehen. Es steht " Hoppla! Diese Seite existiert nicht oder ist privat."

Bin nach dieser Anleitung vorgegangen:


I can’t see the link. It says “Oops! That page doesn’t exist or is private.”

I followed these instructions:

1 Like

Ah, sorry, I did not noticed. It got deleted for some reason, and I still had access to it as an administrator.

Anyway, repasting the answer from the mentioned link.

Edit: Thank you for the links! I missed updating that, will correct.


Hi!

You need to install missing dependencies with chosen way from below. Only one is required to be executed.

1. Solution one (the fastest):

sudo apt install python3-cffi python3-usb

If that would not work for you, please try any other from below.

2. Solution two, using pipenv (for develoment):

While being in the nitrokey-start-firmware/tool directory:

git pull # to update the repository
# in case Pip is not installed
# sudo apt install python3-pip 
pip3 install pipenv --user
pipenv install --three

3. Solution three, using pip (alternative for development):

While being in the nitrokey-start-firmware/tool directory:

git pull # to update the repository
# in case Pip is not installed
# sudo apt install python3-pip 
pip3 install -r requirements.txt --user

Edit: added a readme file with this content to the tools/ directory.

Flash Vorgang läuft. Wie lange ist “Wait 1 second…”?
Mist, habe jetzt den Vorgang aus Versehen mit Ctrl+C unterbrochen. Wollte Terminal kopieren.
Was soll ich jetzt tun? Rote LED blinkt.

Flash process is running. How long is “Wait 1 second…”?
Crap, I accidentally interrupted the process with Ctrl+C. I was trying to copy terminal.
What do I do now? Red LED flashing.

Terminal:

./upgrade_by_passwd.py -f ../prebuilt/RTM.7/{regnual.bin,gnuk.bin}
../prebuilt/RTM.7/regnual.bin: 4504
../prebuilt/RTM.7/gnuk.bin: 115712
Currently connected device strings:
Device: 
    Vendor: Nitrokey
   Product: Nitrokey Start
    Serial: FSIJ-1.2.10-43115045
  Revision: RTM.6
    Config: NITROKEY_START:dfu=no:debug=no:pinpad=no:certdo=yes:factory_reset=yes
       Sys: 3.0
CRC32: ae1cae42

Device: 
Configuration: 1
Interface: 0
20002a00:20005000
Downloading flash upgrade program...
start 20002a00
end   20003b00
Run flash upgrade program...
Waiting for device to appear:
  Wait 1 second...
  Wait 1 second...
  Wait 1 second...
  Wait 1 second...
  Wait 1 second...
  Wait 1 second...
...                                     (10min)
Wait 1 second...
  Wait 1 second...
  Wait 1 second...
^CTraceback (most recent call last):
  File "./upgrade_by_passwd.py", line 200, in <module>
    main(wait_e, keyno, passwd, data_regnual, data_upgrade[4096:])
  File "./upgrade_by_passwd.py", line 97, in main
    time.sleep(wait_e)
KeyboardInterrupt

The device should appear within the 1-10 seconds after the initial message. Could you paste results of the following commands?

  • lsusb | xclip -selection clipboard
  • dmesg | tail -60 | xclip -selection clipboard

Output of each should be copied automatically to the clipboard, so no need to do so manually.

Edit: if not, please execute them without | xclip ...
Edit: Feel free to write in language the most suits you.

lsusb | xclip -selection clipboard
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 006: ID 20a0:4211 Clay Logic 
Bus 001 Device 002: ID 80ee:0021 VirtualBox USB Tablet
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
dmesg | tail -60 | xclip -selection clipboard
[ 2683.494042] usb 1-2: new full-speed USB device number 3 using xhci_hcd
[ 2683.838287] usb 1-2: New USB device found, idVendor=20a0, idProduct=4211, bcdDevice= 2.00
[ 2683.838291] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2683.838293] usb 1-2: Product: Nitrokey Start
[ 2683.838295] usb 1-2: Manufacturer: Nitrokey
[ 2683.838297] usb 1-2: SerialNumber: FSIJ-1.2.10-43115045
[ 4879.813114] usb 1-2: USB disconnect, device number 3
[ 7474.075989] usb 1-2: new full-speed USB device number 4 using xhci_hcd
[ 7474.421121] usb 1-2: New USB device found, idVendor=20a0, idProduct=4211, bcdDevice= 2.00
[ 7474.421124] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 7474.421127] usb 1-2: Product: Nitrokey Start
[ 7474.421129] usb 1-2: Manufacturer: Nitrokey
[ 7474.421132] usb 1-2: SerialNumber: FSIJ-1.2.10-43115045
[ 8283.274150] usb 1-2: USB disconnect, device number 4
[17678.088688] usb 1-2: new full-speed USB device number 5 using xhci_hcd
[17678.440930] usb 1-2: New USB device found, idVendor=20a0, idProduct=4211, bcdDevice= 2.00
[17678.440933] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[17678.440936] usb 1-2: Product: Nitrokey Start
[17678.440938] usb 1-2: Manufacturer: Nitrokey
[17678.440940] usb 1-2: SerialNumber: FSIJ-1.2.10-43115045
[17758.868614] usb 1-2: USB disconnect, device number 5
[19678.264838] usb 1-2: new full-speed USB device number 6 using xhci_hcd
[19678.603180] usb 1-2: New USB device found, idVendor=20a0, idProduct=4211, bcdDevice= 2.00
[19678.603184] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[19678.603186] usb 1-2: Product: Nitrokey Start
[19678.603188] usb 1-2: Manufacturer: Nitrokey
[19678.603190] usb 1-2: SerialNumber: FSIJ-0.0

Thank you. The device has switched with success to the bootloader. I need to check the update script for potential issues. While the device should be possible to safely disconnect, please wait with it until my confirmation. I should be ready in 15-20 minutes.

Sorry, it took longer than expected.

Assuming the whole Nitrokey Start repository was downloaded through Git (as in mentioned guide), please execute in the nitrokey-start-firmware/tool directory:

  • git pull
    to download updated script;
  • git describe
    please confirm its result is the same with RTM.7-16-g41cc384;
  • ./upgrade_by_passwd.py -f ../prebuilt/RTM.7/{regnual.bin,gnuk.bin} -b
    to resume update process from the uploaded bootloader stage.

The third command will resume the connection attempt with the device’s bootloader. In my attempts it turned out that on this stage removing device from power will erase the bootloader from device’s memory, making it effectively not able to be updated further by this way. It will stop communicating through the USB interface at all.
A 5$ STM32 debug adapter would be required, and a simple soldering in such a case, however the device’s case might get broken in the process.

bevor ich wieder etwas falsch mache, soll ich RTM.7-16-g41cc384 durch meine Daten ersetzen? Wo finde ich das?

What I meant here is to compare your version string of the downloaded code with this one RTM.7-16-g41cc384. Command for showing this is git describe - it will show the current code revision.

The only thing right know is to focus on keeping the device connected, and to try to execute the update command again, with the -b argument.

Es hat funktioniert!!!
schwere Geburt :smiley:
vielen vielen Dank!

Morgen werd ich die Keys erzeugen

1 Like

:wink:

I am glad it worked! I assume then the -b switch has helped in your case. I do not remember we have seen such case yet. Thanks to your help I will add this to the documentation, and I will improve the update application. Sorry for the trouble!

Edit: Crossreferencing connected tickets: