Nitrokey / pynitrokey

Python client for Nitrokey devices
Apache License 2.0
94 stars 28 forks source link

[Arch Linux] nitropy does not work any more #562

Open klakomuc opened 3 weeks ago

klakomuc commented 3 weeks ago

Hi,

I am afraid, nitropy does not work any more on Arch Linux (Linux archie 6.10.6-arch1-1 #1 SMP PREEMPT_DYNAMIC Mon, 19 Aug 2024 17:02:39 +0000 x86_64 GNU/Linux). Trying to execute nitropy nk3 status in GNOME Terminal results in:

/usr/lib/python3.12/site-packages/google/protobuf/internal/api_implementation.py:89: UserWarning: Selected implementation cpp is not available.
  warnings.warn(
Traceback (most recent call last):
  File "/usr/bin/nitropy", line 5, in <module>
    from pynitrokey.cli import main
  File "/usr/lib/python3.12/site-packages/pynitrokey/cli/__init__.py", line 26, in <module>
    from pynitrokey.cli.nk3 import nk3
  File "/usr/lib/python3.12/site-packages/pynitrokey/cli/nk3/__init__.py", line 19, in <module>
    from pynitrokey.nk3 import NK3_DATA
  File "/usr/lib/python3.12/site-packages/pynitrokey/nk3/__init__.py", line 14, in <module>
    from pynitrokey.trussed.bootloader.nrf52 import SignatureKey
  File "/usr/lib/python3.12/site-packages/pynitrokey/trussed/bootloader/nrf52.py", line 29, in <module>
    from .nrf52_upload.dfu.init_packet_pb import InitPacketPB
  File "/usr/lib/python3.12/site-packages/pynitrokey/trussed/bootloader/nrf52_upload/dfu/init_packet_pb.py", line 39, in <module>
    from . import dfu_cc_pb2 as pb
  File "/usr/lib/python3.12/site-packages/pynitrokey/trussed/bootloader/nrf52_upload/dfu/dfu_cc_pb2.py", line 7, in <module>
    from google.protobuf import descriptor as _descriptor
  File "/usr/lib/python3.12/site-packages/google/protobuf/descriptor.py", line 28, in <module>
    from google.protobuf.pyext import _message
ImportError: libabsl_die_if_null.so.2401.0.0: cannot open shared object file: No such file or directory

Best regards klakomuc

daringer commented 2 weeks ago

can not reproduce on Arch on current state, can you confirm you are having pynitrokey 0.4.50 installed ?

klakomuc commented 2 weeks ago

Due to the error message ImportError: libabsl_die_if_null.so.2401.0.0: cannot open shared object file: No such file or directory I assume that the error is related to python-protobuf (v27.3-2). Regardless of this, I have installed the latest version of python-pynitrokey (v0.4.50-1).

pacman -Qi python-pynitrokey

Name                     : python-pynitrokey
Version                  : 0.4.50-1
Beschreibung             : A command line interface for the Nitrokey FIDO2 and Nitrokey Start
Architektur              : any
URL                      : https://github.com/Nitrokey/pynitrokey
Lizenzen                 : Apache-2.0 OR MIT
Gruppen                  : Nichts
Stellt bereit            : Nichts
Hängt ab von             : libnitrokey  python  python-certifi  python-cffi  python-click
                           python-click-aliases  python-cryptography  python-dateutil
                           python-ecdsa  python-fido2  python-frozendict  python-intelhex
                           python-nethsm  python-nkdfu  python-protobuf  python-pyserial
                           python-pyusb  python-requests  python-semver  python-spsdk
                           python-tlv8  python-tqdm  python-typing_extensions
Optionale Abhängigkeiten : python-libusb1: for pro and storage subcommands [Installiert]
                           python-pyscard: for pcsclite integration [Installiert]
Benötigt von             : nitrokey-app2
Optional für             : Nichts
In Konflikt mit          : Nichts
Ersetzt                  : Nichts
Installationsgröße       : 2,43 MiB
Packer                   : David Runge <dvzrv@archlinux.org>
Erstellt am              : So 11 Aug 2024 21:46:57 CEST
Installiert am           : Mo 12 Aug 2024 04:01:35 CEST
Installationsgrund       : Ausdrücklich installiert
Installations-Skript     : Nein
Verifiziert durch        : Signatur
daringer commented 2 weeks ago

okok, v0.4.50 looks good, but the missing library is weird, so for me (on Arch) there is no: libabsl_die_if_null.so.2401.0.0 only /usr/lib/libabsl_die_if_null.so.2407.0.0 which originates in the abseil-cpp package in version 20240722.0-1.

Could you check your abseil-cpp version please and where this 2401 lib variant originates from?

klakomuc commented 2 weeks ago

I found out that libabsl_die_if_null.so.2401.0.0 is part of abseil-cpp 20240116.2-3, but abseil-cpp 20240722.0-1 is currently installed on my system. After downgrading to abseil-cpp 20240116.2-3 nitropy and nitrokeyapp works like a charm. A subsequent update to abseil-cpp 20240722.0-1 leads to exactly the error that I recently reported.

robin-nitrokey commented 4 days ago

AFAIS this should be fixed by python-protobuf 27.2-2. Can you check if updating python-protobuf fixes the problem?

klakomuc commented 4 days ago

At the moment I have installed python-protobuf 27.3-2, and it does not work. I must have installed this version on 17.08.2024.

A downgrade to python-protobuf 27.2-2 is not possible without further ado due to an unfulfillable dependency.

However, there seems to be an update to python-protobuf 28.0-1 coming soon. When it is available, I will install it, test it and report back here.

klakomuc commented 1 day ago

An update to python-protobuf-28.0-2 could not solve the problem.

robin-nitrokey commented 18 hours ago

Strange, I cannot reproduce this problem with:

$ pacman -Q python-pynitrokey
python-pynitrokey 0.4.50-1
$ pacman -Q python-protobuf
python-protobuf 28.0-2
$ pacman -Q abseil-cpp
abseil-cpp 20240722.0-1

If you try to run this line in Python directly, does it work?

$ python3
>>> from google.protobuf import descriptor