Zymkey4 install failed - Forbidden

Hi,

I tried to install Zymkey4 on RaspberryPi4 (Raspbian OS GNU/Linux 11), When I running the install script I got the error:

pi@raspberrypi:~/zk_sw $ curl -G https://s3.amazonaws.com/zk-sw-repo/install_zk_sw.sh | sudo bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  5234  100  5234    0     0   8401      0 --:--:-- --:--:-- --:--:--  8401
Hit:1 http://raspbian.raspberrypi.org/raspbian bullseye InRelease
Hit:2 http://archive.raspberrypi.org/debian bullseye InRelease
Err:3 https://zk-sw-repo.s3.amazonaws.com/apt-repo-bullseye-aarch64 bullseye InRelease
  403  Forbidden [IP: 52.217.42.76 443]
Reading package lists... Done
E: Failed to fetch https://zk-sw-repo.s3.amazonaws.com/apt-repo-bullseye-aarch64/dists/bullseye/InRelease  403  Forbidden [IP: 52.217.42.76 443]
E: The repository 'https://zk-sw-repo.s3.amazonaws.com/apt-repo-bullseye-aarch64 bullseye InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details

Where I wrong?
I will be happy to any assistance
Thanks,
Ron

@ron - Can you confirm you are using bullseye 32-bit? We do not support bullseye 64bit.

Hi, Thanks for your responsed.
Yes, I installed on 64 bit. :slight_smile:

But, Now I replaced the OS and installed Ubuntu Server 20.04 on my Raspberry.
The install script run successfully but I got the flowing errors:

ubuntu@ubuntu:~$ dmesg
[  206.303615] i2c-bcm2835 fe804000.i2c: i2c transfer timed out
ubuntu@ubuntu:~$ python3
Python 3.8.10 (default, Nov 26 2021, 20:14:08)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import zymkey
Exception ignored in: <function Zymkey.__del__ at 0xffff8c1793a0>
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/zymkey/__init__.py", line 205, in __del__
    raise AssertionError("bad return code %d" % ret)
AssertionError: bad return code -1
>>>

I notice that the example python script not exists on my Raspberry.

* `python3 /usr/local/share/zymkey/examples/zk_app_utils_test.py`
* `python3 /usr/local/share/zymkey/examples/zk_crypto_test.py`

The LED blinking slow 8 times and then blinking fast.

My Raspberry:

  • Raspberry 4
  • Ubuntu 20.04.3 LTS
  • OS is up to date. (apt update + upgrade)
  • Linux ubuntu 5.4.0-1047-raspi #52-Ubuntu SMP PREEMPT Wed Nov 24 08:16:38 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux

Can you help me?
Thanks :slight_smile:

Here’s a link to the example python scripts.

You will need to sort out your i2c problem first. The 8 flashes on the ZYMKEY means i2c is not communicating. The error from python when you attempt to import zymkey is also due to i2c communication failure. The example scripts will fail in the same manner.

A couple of things to check:

  • Power supply: You need a good Power Supply like the official Raspberry PI or Canakit. The PI4 needs 3.5A. A phone charge will not work. This is the most common problem we see.
  • Anything else using GPIO pins. Is the ZYMKEY the only device on your PI? The ZYMKEY needs exclusive use of GPIO4
  • Sometimes with Ubuntu 20.04, the automatic upgrade process interferes with a regular apt-get update, apt-get upgrade. Did the installation go smoothly or did you have to re-run, etc.

Thanks. The issue was Power supply

Is there any plan to support bullseye 64bit?

Thanks
Rajesh

2 Likes

Hi all,
I installed my ZYmkey 4i on a Raspberry pi4b and it is getting this error for a library when I run the following test_zym.py script. Many thanks if you have some info on this.
So do I need to update that library?
Thanks, Luke


import ecdsa
import hashlib

import zym
import crypto

def verify(msg, sig, pub_key):
    byte_msg = bytearray(msg, "utf-8")
    byte_sig = bytearray.fromhex(sig)
    byte_pub_key = bytearray.fromhex(pub_key)

    vk = ecdsa.VerifyingKey.from_string(byte_pub_key, ecdsa.NIST256p)

    return vk.verify(byte_sig, byte_msg, hashfunc=hashlib.sha256)

if __name__ == "__main__":
    pub_key = zym.get_public_key()
    hash = crypto.hash(pub_key)
    sig = zym.sign(hash)

Error from console:

Traceback (most recent call last):
  File "test_zym.py", line 4, in <module>
    import zym
  File "/home/pi/data-logger-v2/zym/src/zym.py", line 5, in <module>
    import zymkey
  File "/home/pi/.local/lib/python3.7/site-packages/zymkey/__init__.py", line 3, in <module>
    from .module import Zymkey
  File "/home/pi/.local/lib/python3.7/site-packages/zymkey/module.py", line 50, in <module>
    raise ZymkeyLibraryError('unable to find {}, checked {}'.format(os.path.basename(ZYMKEY_LIBRARY_PATH), prefixes))
zymkey.exceptions.ZymkeyLibraryError: unable to find libzk_app_utils.so, checked ['/usr/lib/python3/dist-packages/usr/local/lib', '/usr/local/lib']

My environment:

  • Raspberry Pi 4b
  • OS: Debian GNU/Linux 10 (buster)
  • Zymkey 4i: blinking slowly
  • Sudo apt-get update and upgrade were done.

We are monitoring the release of bullseye 64 bit and will add support in the future.

Luke - Please re-install the latest python code and try again.

sudo pip3 uninstall zku
sudo pip3 install zku
sudo pip3 show zku

The version should be 1.0.29.

Hi Bob,
thanks for the suggestion. I tried that unistalling zku and reinstalling then checking the version and I still get the same library error.

I should execute pip from the folder above my src folder

pi@pi4:~/data-logger-v2/zym/src $ pip3 install -r requirements.txt

@luke Here’s a snippet of code that you can use to check that sign and verify are working. If this works, you have everything installed properly and need to sort out your side. If this doesn’t work, then I would suggest starting clean.

#!/usr/bin/python3

import zymkey
from zymkey.exceptions import VerificationError


if __name__ == "__main__":

    # Example of sign() and verify()
    secret_message = 'good'

    print('Signing data...', end='')
    signature = zymkey.client.sign(secret_message, slot=0)
    print('OK\n')

    print('Verifying good data...', end='')
    zymkey.client.verify(secret_message, signature, raise_exception=True, pubkey_slot=0)
    print('OK\n')

    print('Verifying bad data...', end='')
    try:
        zymkey.client.verify('bad', signature)
    except VerificationError:
        print('Verification failed (Expected)')
    else:
        raise Exception('verification should have failed, but passed')
1 Like

Thanks Bob, I have sorted out the issue. I was installing Zymbit directly in the folder when I should have just been using the CURL command. Issue solved.

I tired again today with new Raspberry Lite image for bullseye 64-bit (Jan-22). Zymbit install seems to fail. Can we expect a fix in near future?

Thanks & Regards
Rajesh

We have outstanding build issues with the bullseye 64 bit repo unrelated to Zymbit. We added a workaround to use our buster64 repo. It works fine for bullseye 64 bit. Instead of our normal install script, run the following:

curl -G http://s3.amazonaws.com/zk-sw-repo/install_zk_sw_bullseye.sh | sudo bash

Thank you. This is working fine.

-Rajesh

The workaround/build issues with bullseye 64 are no longer needed. The Zymkey installation will work with the standard installation line:

curl -G https://s3.amazonaws.com/zk-sw-repo/install_zk_sw.sh | sudo bash